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

interpolate_to_isosurface not returning nan values #2555

Open
alexcharn5 opened this issue Jun 27, 2022 · 2 comments
Open

interpolate_to_isosurface not returning nan values #2555

alexcharn5 opened this issue Jun 27, 2022 · 2 comments
Labels
Type: Bug Something is not working like it should

Comments

@alexcharn5
Copy link

alexcharn5 commented Jun 27, 2022

What went wrong?

I'm using Metpy's interpolate_to_isosurface function, in my case to interpolate theta to a PV surface (of 2 PVU). In a column (an atmospheric column, not an array column) with all PV values less than 2 PVU or all values greater than 2 PVU, I'd expect to get a nan value. However, it returns the first value in the array; using the code below, it returns

[[200. 200.]
[200. 200.]]

Short of editing the code myself, is there a way to not set values outside the domain to the first/last value, e.g., through a flag/parameter?

Operating System

Linux

Version

1.3.0

Python Version

3.8.5

Code to Reproduce

from numpy import *
from metpy import interpolate

pv       = linspace(-2,-3,5)
theta    = linspace(200,300,5)
pv_array = empty((5,2,2)); theta_array = empty((5,2,2))
for i in range(2):
    for j in range(2):
        pv_array[:,i,j]    = pv
        theta_array[:,i,j] = theta

result = interpolate.interpolate_to_isosurface(pv_array,theta_array,2)

Errors, Traceback, and Logs

No response

@alexcharn5 alexcharn5 added the Type: Bug Something is not working like it should label Jun 27, 2022
@dopplershift
Copy link
Member

@kgoebber Do you have any idea what you were trying to accomplish with these lines here?

minvar = (np.min(level_var, axis=0) >= level)
maxvar = (np.max(level_var, axis=0) <= level)
interp_level[0][minvar] = interp_var[-1][minvar]
interp_level[0][maxvar] = interp_var[0][maxvar]

@kgoebber
Copy link
Collaborator

kgoebber commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something is not working like it should
Projects
Status: No status
Development

No branches or pull requests

3 participants