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

wrf.interplevel returns NaN when interpolating at a level where the sample points are #198

Open
qiuyang50 opened this issue Dec 2, 2022 · 1 comment

Comments

@qiuyang50
Copy link

Hi, I recently used wrf.interplevel to interpolate a 3d field onto a single pressure level 50000 Pa. I found a very wired result that every time when the 50000 Pa appears in the sample points, the result is NaN. If I added a little value to 50000Pa, it returns the correct value (approximately). Below is just a simple example to reproduce the issue. Please help!

# construct vert array
xx = np.linspace(0,1,11)
xg = np.zeros((11,4,3))
for j in np.arange(4):
for i in np.arange(3):
xg[:,j,i] = xx

# assign field3d array
yg = np.random.rand(11,4,3)

# print results for comparison
print(' True answer: ', yg[5,:,:])
print(' NaN result: ', wrf.interplevel(yg,xg,0.5).to_numpy())
print('Corrected result: ', wrf.interplevel(yg,xg,0.5+1e-8).to_numpy())

@erogluorhan
Copy link
Collaborator

Hi @qiuyang50 thanks very much for sharing this with us! We'll look into it when we have some time.

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