From 143d639bda3cf53bbae3af9fbce12921c7f1ff9d Mon Sep 17 00:00:00 2001 From: matthiasdemuzere Date: Fri, 10 Jun 2022 11:17:26 +0200 Subject: [PATCH] add map_proj = 6 (Lat-lon) --- salem/sio.py | 12 ++++++++++++ salem/wrftools.py | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/salem/sio.py b/salem/sio.py index 0c99386..ecbfaf0 100644 --- a/salem/sio.py +++ b/salem/sio.py @@ -140,6 +140,12 @@ def _wrf_grid_from_dataset(ds): if ds.PROJ_NAME in ['Lambert Conformal Conic', 'WRF Lambert Conformal']: proj_id = 1 + elif ds.PROJ_NAME in ['polar stereographic']: + proj_id = 2 + elif ds.PROJ_NAME in ['mercator']: + proj_id = 3 + elif ds.PROJ_NAME in ['LatLon', 'lat-lon', 'LatLong']: + proj_id = 6 else: proj_id = 99 # pragma: no cover else: @@ -172,6 +178,12 @@ def _wrf_grid_from_dataset(ds): '+lon_0={center_lon} ' \ '+x_0=0 +y_0=0 +a=6370000 +b=6370000' p4 = p4.format(**pargs) + elif proj_id == 6: + # Lat-long + p4 = '+proj=eqc ' \ + '+lon_0={lon_0} ' \ + '+x_0=0 +y_0=0 +a=6370000 +b=6370000' + p4 = p4.format(**pargs) else: raise NotImplementedError('WRF proj not implemented yet: ' '{}'.format(proj_id)) diff --git a/salem/wrftools.py b/salem/wrftools.py index 9b7cafb..b727dab 100644 --- a/salem/wrftools.py +++ b/salem/wrftools.py @@ -722,6 +722,11 @@ def geogrid_simulator(fpath, do_maps=True, map_kwargs=None): pwrf = '+proj=stere +lat_ts={lat_1} +lat_0=90.0 +lon_0={lon_0} ' \ '+x_0=0 +y_0=0 +a=6370000 +b=6370000' pwrf = pwrf.format(**pargs) + #TODO: not sure how map_proj is converted to this string instead of int? + elif map_proj == 'LATLON': + pwrf = '+proj=eqc +lon_0={lon_0} ' \ + '+x_0=0 +y_0=0 +a=6370000 +b=6370000' + pwrf = pwrf.format(**pargs) else: raise NotImplementedError('WRF proj not implemented yet: ' '{}'.format(map_proj))