Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAR/TU WRF-Mercator #242

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions salem/sio.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,25 @@ def read_shapefile_to_grid(fpath, grid):

def _wrf_grid_from_dataset(ds):
"""Get the WRF projection out of the file."""

pargs = dict()
pargs = {}
if hasattr(ds, 'PROJ_ENVI_STRING'):
# HAR and other TU Berlin files
dx = ds.GRID_DX
dy = ds.GRID_DY
pargs['lat_1'] = ds.PROJ_STANDARD_PAR1
pargs['lat_2'] = ds.PROJ_STANDARD_PAR2
pargs['lat_0'] = ds.PROJ_CENTRAL_LAT
pargs['lon_0'] = ds.PROJ_CENTRAL_LON
pargs['center_lon'] = ds.PROJ_CENTRAL_LON
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
pargs['lat_1'] = ds.PROJ_STANDARD_PAR1
pargs['lat_2'] = ds.PROJ_STANDARD_PAR2
pargs['lat_0'] = ds.PROJ_CENTRAL_LAT
pargs['lon_0'] = ds.PROJ_CENTRAL_LON
pargs['center_lon'] = ds.PROJ_CENTRAL_LON
elif ds.PROJ_NAME in ['lat-lon']:
proj_id = 6
elif "mercator" in ds.PROJ_NAME.lower():
proj_id = 3
pargs['lat_ts'] = ds.TRUELAT1
pargs['center_lon'] = ds.CEN_LON
else:
proj_id = 99 # pragma: no cover
else:
Expand Down Expand Up @@ -1214,4 +1217,4 @@ def ds_closer():
except AttributeError:
combined = combined.drop(vns)

return combined
return combined
Loading