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

Exception: coordinate lev is non-uniform #37

Open
ngyawali opened this issue Jul 18, 2024 · 1 comment
Open

Exception: coordinate lev is non-uniform #37

ngyawali opened this issue Jul 18, 2024 · 1 comment

Comments

@ngyawali
Copy link

Hi,

I am trying to work on the 11_Omega_equation.ipynb notebook. I am currently experiencing "Exception: coordinate lev is non-uniform". The dataset I am using has the following pressure levels array([100000., 97500., 95000., 92500., 90000., 87500., 85000., 82500., 80000., 77500., 75000., 72500., 70000., 65000., 60000., 55000.,50000., 45000., 40000., 35000., 30000., 25000., 20000.])

Do I need to make those levels uniform or is there any other way I could work on this issue without changing the current levels?

@miniufo
Copy link
Owner

miniufo commented Jul 19, 2024

Hi @ngyawali, thanks for your interests. The xinvert package is built on finite difference schemes. So it would be more accurate if the grid interval is uniform. In your case, I would interpolate the whole dataset into a vertically uniform one, with a interval of 25hPa. This is not too hard if you use xarray:

dset_new = dset.interp({'lev': np.linspace(100000, 20000, 33)})

or just interpolate those variables you need, if you feel that interpolation of the whole dataset is memory consuming.

A secondary choice is to use a interval of 50hPa, and you only need to drop off those data at 975, 925, 875, 825, 775, and 725 hPas. This is also easy with xarray's .sel({'lev': np.linspace(100000, 20000, 17)})

Maybe I could do this interpolation internally. But I feel that let the user know what is happening is much better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants