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
410 stars 155 forks source link

Problem with interplevel #141

Closed refrancesco6 closed 2 years ago

refrancesco6 commented 3 years ago

Hello, best regards. I hope you can help me. I want to interpolate the wind speed at half the height of the Atmospheric Boundary Layer, I have tried the following: wspd = getvar(ncfile, "wspd", timeidx=1) pblh = getvar(ncfile,"PBLH", timeidx=1) height = getvar(ncfile, "height_agl") rh_pblh = interplevel(wspd, height, pblh/2)

or wspd = getvar(ncfile, "wspd", timeidx=1) pblh = getvar(ncfile,"PBLH", timeidx=1) z = getvar(ncfile, "z", msl=False) rh_pblh = interplevel(wspd, z, pblh/2)

However, in the result I get values ​​like NAN. Likewise, when I print to "z" or "height", observe that the altitudes at level 0 are from 25 meters and not at ground level as it should be (0 meters), this could be due?.

Thanks

michaelavs commented 3 years ago

Hi @refrancesco6, I think your issue may be from how you are defining height in the each situation. In your first code excerpt, it looks like you are using height_agl, which stands for 'height above ground level', so the height variable is not starting at the surface, but rather where the model is actually running (25m). In the next code excerpt, you use the z coordinate and set msl=False, which will again allow for the height variable to be run as agl not msl (mean sea level). However, if you were to run the function with MSL over AGL, I believe you would still receive NaN or negative values depending where your model is centered (due to the physical elevation or altitude of the region/model). Generally, when a function is returning NaN in wrf-python, it is because the value does not "make sense" or there is no data for that point.

A couple of options to maybe try: