NCAR / wrf-python

A collection of diagnostic and interpolation routines for use with output from the Weather Research and Forecasting (WRF-ARW) Model.
https://wrf-python.readthedocs.io
Apache License 2.0
411 stars 155 forks source link

What are the conditions under which an interpolation routine will return NaN? #120

Closed irowebbn closed 3 years ago

irowebbn commented 4 years ago

I have a few 3D fields that I got from my WRF output using wrf.getvar, temp, rel humidity, wind speed, etc. The vertical levels are according to eta level. To get values at a given altitude in meters, I have used both the wrf.vinterp function with ght_agl or wrf.interplevel with the height_agl as the vert field, depending on what I'm trying to do.

For the most part, I get what I expect from these, except for the first 25 meters above ground level (the region I am most concerned with), which are always NaN. If I do Extrapolate=True, they are filed in as below-ground values, which is not the case. The terrain is very flat at the location being modelled, but just to check I interpolated with the sea level values and plotted the terrain top and there was still a 25 meter or so gap.

Is there a base surface value that needs to be provided in order for interpolation to continue all the way down to the ground?

I can provide code snippets as needed but I am not sure what would be most helpful.

michaelavs commented 4 years ago

I believe a NaN return will come from data not being present. I am tempted to say your namelist.input file may not have specified close enough to the ground level, but I don't want to resolve that that is truly the case just yet. Have you tried using the z variable in getvar instead? We had another issue open (#124) that was having issues with interpolation using z and a fix is using z = getvar(wrfin, "z", msl=False). Let me know if that fixes it or if anything changes in your output.

irowebbn commented 4 years ago

Let me give that a try and see what I can come up with.