Skip to content

Commit

Permalink
add catch for when calling tropo_delay as a fcn
Browse files Browse the repository at this point in the history
  • Loading branch information
jlmaurer committed Jan 17, 2024
1 parent ffd399d commit fcaa16e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tools/RAiDER/delay.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def tropo_delay(
wm_levels = ds.z.values
toa = wm_levels.max() - 1


if height_levels is None:
if aoi.type() == 'Geocube':
height_levels = aoi.readZ()
Expand Down Expand Up @@ -129,6 +128,15 @@ def _get_delays_on_cube(dt, weather_model_file, wm_proj, aoi, heights, los, crs,
"""
zpts = np.array(heights)

try:
aoi.xpts
except AttributeError:
with xarray.load_dataset(weather_model_file) as ds:
x_spacing = ds.x.diff(dim='x').values.mean()
y_spacing = ds.y.diff(dim='y').values.mean()
aoi.set_output_spacing(ll_res=np.min([x_spacing, y_spacing]))
aoi.set_output_xygrid(crs)

# If no orbit is provided
if los.is_Zenith() or los.is_Projected():
out_type = ["zenith" if los.is_Zenith() else 'slant - projected'][0]
Expand Down

0 comments on commit fcaa16e

Please sign in to comment.