Skip to content

Commit

Permalink
fix(dxdy): avoid error if GRID_DX/GRID_DY are not present
Browse files Browse the repository at this point in the history
Check if GRID_DX/GRID_DY are present in the attributes of files that have proj_envi_string.
GRID_DX/GRID_DY should be preferred over DX/DY in this case as they are
specifically defined in product generation at least for files generated
at TUB.

Fixes an issue where the test errors if GRID_DX/GRID_DY are not present.
  • Loading branch information
benatouba committed Jul 9, 2024
1 parent 5172f7c commit 74882df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions salem/sio.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ def _wrf_grid_from_dataset(ds):
pargs = {}
if hasattr(ds, 'PROJ_ENVI_STRING'):
# HAR and other TU Berlin files
dx = ds.GRID_DX or ds.DX
dy = ds.GRID_DY or ds.DY
dx = ds.GRID_DX if hasattr(ds, 'GRID_DX') else ds.DX
dy = ds.GRID_DY if hasattr(ds, 'GRID_DY') else ds.DY
if ds.PROJ_NAME in ['Lambert Conformal Conic',
'WRF Lambert Conformal']:
proj_id = 1
Expand Down

0 comments on commit 74882df

Please sign in to comment.