forrestfwilliams commited on
Commit
7e896b5
1 Parent(s): 17da4a9

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +7 -7
  2. los_palette.py +6 -6
app.py CHANGED
@@ -56,8 +56,8 @@ def satellite_marker(axis, angle=0, center=(0, 0)):
56
  def get_params(heading_angle, grazing_angle, look_direction):
57
  left_looking = look_direction == 'Left Looking'
58
  away_vector = angles_to_unit_vector(heading_angle, grazing_angle, left_looking)
 
59
  away_color = unit_vector_to_hex(away_vector)
60
- towards_vector = angles_to_unit_vector(heading_angle, 180 + grazing_angle, left_looking)
61
  towards_color = unit_vector_to_hex(towards_vector)
62
  return away_vector, left_looking, (away_color, towards_color)
63
 
@@ -177,11 +177,11 @@ def plot_color_gradient(params):
177
 
178
  def reset_widgets(menu_value):
179
  options = {
180
- 's1a': (348, 34, 'Left Looking'),
181
- 's1d': (193, 34, 'Left Looking'),
182
- 'vert': (0, 0, 'Left Looking'),
183
- 'we': (0, 90, 'Left Looking'),
184
- 'sn': (90, 90, 'Left Looking'),
185
  }
186
  heading_input.value, grazing_input.value, look_switch.value = options[menu_value]
187
 
@@ -196,7 +196,7 @@ heading_input = pn.widgets.IntInput(name='Satellite Heading (0-360)', start=0, e
196
  grazing_input = pn.widgets.IntInput(name='Grazing Angle (0-90)', start=0, end=90, step=5, value=34, **opts)
197
  # heading_input = pn.widgets.IntSlider(name='Satellite Heading', start=0, end=360, step=1, value=360 - 12, **opts)
198
  # grazing_input = pn.widgets.IntSlider(name='Grazing Angle', start=0, end=90, step=1, value=34, **opts)
199
- look_switch = pn.widgets.ToggleGroup(options=['Left Looking', 'Right Looking'], behavior='radio', **opts)
200
  menu_items = [
201
  ('Sentinel-1 Ascending', 's1a'),
202
  ('Sentinel-1 Descending', 's1d'),
 
56
  def get_params(heading_angle, grazing_angle, look_direction):
57
  left_looking = look_direction == 'Left Looking'
58
  away_vector = angles_to_unit_vector(heading_angle, grazing_angle, left_looking)
59
+ towards_vector = away_vector * -1
60
  away_color = unit_vector_to_hex(away_vector)
 
61
  towards_color = unit_vector_to_hex(towards_vector)
62
  return away_vector, left_looking, (away_color, towards_color)
63
 
 
177
 
178
  def reset_widgets(menu_value):
179
  options = {
180
+ 's1a': (348, 34, 'Right Looking'),
181
+ 's1d': (193, 34, 'Right Looking'),
182
+ 'vert': (0, 0, 'Right Looking'),
183
+ 'we': (0, 90, 'Right Looking'),
184
+ 'sn': (90, 90, 'Right Looking'),
185
  }
186
  heading_input.value, grazing_input.value, look_switch.value = options[menu_value]
187
 
 
196
  grazing_input = pn.widgets.IntInput(name='Grazing Angle (0-90)', start=0, end=90, step=5, value=34, **opts)
197
  # heading_input = pn.widgets.IntSlider(name='Satellite Heading', start=0, end=360, step=1, value=360 - 12, **opts)
198
  # grazing_input = pn.widgets.IntSlider(name='Grazing Angle', start=0, end=90, step=1, value=34, **opts)
199
+ look_switch = pn.widgets.ToggleGroup(options=['Right Looking', 'Left Looking'], behavior='radio', **opts)
200
  menu_items = [
201
  ('Sentinel-1 Ascending', 's1a'),
202
  ('Sentinel-1 Descending', 's1d'),
los_palette.py CHANGED
@@ -1,20 +1,20 @@
1
  import numpy as np
2
 
3
 
4
- def angles_to_unit_vector(heading_angle_degrees, incidence_angle_degrees, left_looking=True):
5
  # Convert angles to radians
6
  heading_angle_start_at_east = 90 - heading_angle_degrees
7
  look_offset = 90 if left_looking else -90
8
  heading_los = heading_angle_start_at_east + look_offset
9
  heading_angle_radians = np.radians(heading_los)
10
 
11
- incidence_angle_sensor_to_ground = -(90 - incidence_angle_degrees)
12
- incidence_angle_radians = np.radians(incidence_angle_sensor_to_ground)
13
 
14
  # Calculate the vector components
15
- x_component = np.cos(heading_angle_radians) * np.cos(incidence_angle_radians)
16
- y_component = np.sin(heading_angle_radians) * np.cos(incidence_angle_radians)
17
- z_component = np.sin(incidence_angle_radians)
18
 
19
  # Create a NumPy array for the vector
20
  vector = np.array([x_component, y_component, z_component])
 
1
  import numpy as np
2
 
3
 
4
+ def angles_to_unit_vector(heading_angle_degrees, grazing_angle_degrees, left_looking=True):
5
  # Convert angles to radians
6
  heading_angle_start_at_east = 90 - heading_angle_degrees
7
  look_offset = 90 if left_looking else -90
8
  heading_los = heading_angle_start_at_east + look_offset
9
  heading_angle_radians = np.radians(heading_los)
10
 
11
+ grazing_angle_sensor_to_ground = -(90 - grazing_angle_degrees)
12
+ grazing_angle_radians = np.radians(grazing_angle_sensor_to_ground)
13
 
14
  # Calculate the vector components
15
+ x_component = np.cos(heading_angle_radians) * np.cos(grazing_angle_radians)
16
+ y_component = np.sin(heading_angle_radians) * np.cos(grazing_angle_radians)
17
+ z_component = np.sin(grazing_angle_radians)
18
 
19
  # Create a NumPy array for the vector
20
  vector = np.array([x_component, y_component, z_component])