dbekaert / RAiDER

Raytracing Atmospheric Delay Estimation for RADAR
Apache License 2.0
70 stars 39 forks source link

[BUG] tropo_delay raise AttributeError when using StationFile as input for AOI #655

Closed Xiao-Yixin closed 3 months ago

Xiao-Yixin commented 3 months ago

Describe the bug

tropo_delay raises AttributeError when using StationFile as input for AOI, which indicates 'StationFile' object has no attribute 'xpts'.

To Reproduce Steps to reproduce the behavior:

  1. Use the example given in RAiDER-docs/RAiDER_tutorial/RAiDER_Python_access.ipynb
  2. In cell[55] under Raytracing calculation, change 'aoi' into 'test_aoi' previously defined in cell[50]
  3. Error Output:

    AttributeError Traceback (most recent call last) Cell In[55], line 1 ----> 1 ds, _ = tropo_delay( 2 date_time, 3 weather_model.out_file('weather_files'), 4 test_aoi, 5 los_ray, 6 height_levels=[0, 100, 500, 1000] 7 )

File ~/miniconda3/envs/alt/lib/python3.11/site-packages/RAiDER/delay.py:90, in tropo_delay(dt, weather_model_file, aoi, los, height_levels, out_proj, zref) 86 logger.warning('Requested integration height (zref) is higher than top of weather model. Forcing to top ({toa}).') 89 #TODO: expose this as library function ---> 90 ds = _get_delays_on_cube(dt, weather_model_file, wm_proj, aoi, height_levels, 91 los, crs, zref) 93 if (aoi.type() == 'bounding_box') or (aoi.type() == 'Geocube'): 94 return ds, None

File ~/miniconda3/envs/alt/lib/python3.11/site-packages/RAiDER/delay.py:164, in _get_delays_on_cube(dt, weather_model_file, wm_proj, aoi, heights, los, crs, zref, nproc) 161 # Build cube 162 if nproc == 1: 163 wetDelay, hydroDelay = _build_cube_ray( --> 164 aoi.xpts, aoi.ypts, zpts, los, 165 wm_proj, crs, 166 [ifWet, ifHydro], MAX_TROPO_HEIGHT=zref) 168 ### Use multi-processing here 169 else: 170 # Pre-build output arrays (...) 173 174 # Loop over heights 175 raise NotImplementedError

AttributeError: 'StationFile' object has no attribute 'xpts'

Desktop (please complete the following information):

Xiao-Yixin commented 3 months ago

Missed the AOI parameters setup. Fix by prepending:

aoi.add_buffer() aoi.set_output_xygrid(4326)