Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

How to plot values which do not exist ?

alainF

Member
Hello,
I am writing a python program to interpolate some variables at a desired surface pressure. Suppose that we want to plot the qv field at 850 hPa. I start from an already existing program attached to this post, that I have retrieved from this forum. In this program the desired pressure 500 hPa is hardcoded.
If I want 850hPa, I just change 500 into 850. But then, python gives an error message saying :
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Traceback (most recent call last):
File "/home/wrf/alain/./interp_qv.py", line 37, in <module>
qvAt850hPa.append( f(desired_pressure) )
File "/home/wrf/anaconda3/lib/python3.9/site-packages/scipy/interpolate/_polyint.py", line 78, in __call__
y = self._evaluate(x)
File "/home/wrf/anaconda3/lib/python3.9/site-packages/scipy/interpolate/_interpolate.py", line 707, in _evaluate
below_bounds, above_bounds = self._check_bounds(x_new)
File "/home/wrf/anaconda3/lib/python3.9/site-packages/scipy/interpolate/_interpolate.py", line 739, in _check_bounds
raise ValueError("A value in x_new is above the interpolation "
ValueError: A value in x_new is above the interpolation range.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Then, I have printed in the interp.log file (attached), the vector of the X values for the (pressure-qv) interpolations, depending on the cell number, each time that the interp function is called. For the first vertical level, I can see values as low as 662 hPa. I imagine that this specific cell is located on a high terrain elevation. But then, how is it possible to figure out a qv value that does not exist in the range of the X axis ? To write a fake value ? To extrapolate ?
I suppose that this question is also valid for all the 3D fields.


Thank you for your help
 

Attachments

  • interp_qv.py.txt
    1.3 KB · Views: 4
  • interp.log.txt
    19.3 KB · Views: 1
Top