interpolate_to_isosurface not returning nan values
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
@kgoebber Do you have any idea what you were trying to accomplish with these lines here?
https://github.com/Unidata/MetPy/blob/71596b89ff1010138da52e39686302599e4e7426/src/metpy/interpolate/grid.py#L356-L359
I think this is trying to fill some values at the top and bottom of the interpolation, especially when the interpolation gets to the surface and above the tropopause where the requested level exceeds what’s in the data, so setting it to the max and min values.
It’s been a hot second though…don’t know how often this section of the code actually changes the values.
-- Kevin Goebbert, Ph.D. Professor of Meteorology Kallay-Christopher Hall, 201-F 1809 Chapel Drive Valparaiso, IN 46383 (219) 464-5517 fax: (219) 548-7738 https://kevingoebbert.youcanbook.me/ On Sep 16, 2022, 7:43 PM -0500, Ryan May @.***>, wrote:
@kgoebber Do you have any idea what you were trying to accomplish with these lines here? https://github.com/Unidata/MetPy/blob/71596b89ff1010138da52e39686302599e4e7426/src/metpy/interpolate/grid.py#L356-L359 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>