xarray-contrib / xwrf

A lightweight interface for working with the Weather Research and Forecasting (WRF) model output in Xarray.
https://xwrf.readthedocs.io/
Apache License 2.0
58 stars 16 forks source link

[FEATURE]: Implement map_proj==6 #174

Open taoansf opened 4 months ago

taoansf commented 4 months ago

What is your issue?

Hello,

I'm trying to load wrf data using xarray open_mfdataset and xwrf.postprocess() However xwrf is return this error message

_ds=xa.open_mfdataset(dados_wrf,concatdim='Time',combine='nested').xwrf.postprocess()

File ~/miniconda3/envs/geo/lib/python3.12/site-packages/xwrf/accessors.py:147 in postprocess _ds = ds.pipe(_include_projectioncoordinates)

File ~/miniconda3/envs/geo/lib/python3.12/site-packages/xarray/core/common.py:775 in pipe return func(self, *args, **kwargs)

_File ~/miniconda3/envs/geo/lib/python3.12/site-packages/xwrf/postprocess.py:105 in _include_projectioncoordinates _grid_components = _wrf_grid_fromdataset(ds)

_File ~/miniconda3/envs/geo/lib/python3.12/site-packages/xwrf/grid.py:61 in _wrf_grid_fromdataset _raise NotImplementedError(f'WRF proj not implemented yet: {projid}')

NotImplementedError: WRF proj not implemented yet: 6

Could help me with this problem? Is there some argument that I'm missing in my code?

Thank you for any help

With best regards,

Taoan

lpilz commented 4 months ago

Hi, thanks for making an issue. This means that the cylindrical equidistant projection is not yet implemented in xwrf. As you can see here, for now we only support the map projections 0-3.

https://github.com/xarray-contrib/xwrf/blob/37dad39bee2817498b309c3804c19f613f01768a/xwrf/grid.py#L41-L61

However, a quick google search reveals that salem already implemented map_proj 6, so it should be easy to do on our end. We will require tests before merging this into main but you're welcome to start a pull request and we'll guide you along.

taoansf commented 4 months ago

Hi, thank you for the clarification. I don't have experience with this type of implementation, but I'll study it to try to make some contribution.