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

[FEATURE]: Implement map_proj==6 #174

Open
taoansf opened this issue May 14, 2024 · 2 comments
Open

[FEATURE]: Implement map_proj==6 #174

taoansf opened this issue May 14, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@taoansf
Copy link

taoansf commented May 14, 2024

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,concat_dim='Time',combine='nested').xwrf.postprocess()

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

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_projection_coordinates
_grid_components = wrf_grid_from_dataset(ds)

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

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
Copy link
Collaborator

lpilz commented May 14, 2024

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.

xwrf/xwrf/grid.py

Lines 41 to 61 in 37dad39

if proj_id == 0:
# Idealized Run, Cartesian grid
pass
elif proj_id == 1:
# Lambert
pargs['proj'] = 'lcc'
del pargs['center_lon']
elif proj_id == 2:
# Polar stereo
pargs['proj'] = 'stere'
pargs['lat_ts'] = pargs['lat_1']
pargs['lat_0'] = 90.0
del pargs['lat_1'], pargs['lat_2'], pargs['center_lon']
elif proj_id == 3:
# Mercator
pargs['proj'] = 'merc'
pargs['lat_ts'] = pargs['lat_1']
pargs['lon_0'] = pargs['center_lon']
del pargs['lat_0'], pargs['lat_1'], pargs['lat_2'], pargs['center_lon']
else:
raise NotImplementedError(f'WRF proj not implemented yet: {proj_id}')

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.

@lpilz lpilz added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels May 14, 2024
@lpilz lpilz changed the title NotImplementedError: WRF proj not implemented yet: 6 [FEATURE]: Implement map_proj==6 May 14, 2024
@taoansf
Copy link
Author

taoansf commented May 15, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants