Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Interpolates pressure levels to a different set of pressure levels

nuvolet

Toni Viudez
Member
Greetings,

I am looking, before I have to write a whole code from scratch, if there is available any package to interpolates pressure levels to a different set of pressure levels for a specific reanalysis files to be used in CESM2.2/CAM6.

I found that there was a interpolation function in NCL int2p_n:


But looks like this language as no more technical support and everything is migrating to Python.

Any suggestion will be helpful.

Thanks in advance
 

brianpm

Active Member
Hi Toni,

Pressure levels to pressure levels is just regular interpolation, so you can use many of the available interpolation tools out there. One that might be well-tailored for your case is GeoCAT's interp_multidim. If you want a way to do extrapolation, you might need something else. I can't remember if MetPy's interpolation has extrapolation, but it does offer both linear and log interpolation in 1D. You could also try xarray's built in 1-d interpolation (it uses SciPy's interpolation methods under the hood). You can also use CDO's intlevel routine from the command line (https://code.mpimet.mpg.de/projects/cdo/embedded/index.html#x1-7470002.12.13). Finally, you can use NCO's ncremap with the "--vrt_out" option (https://nco.sourceforge.net/nco.html#vrt). I haven't done any direct comparisons, but I'd guess that CDO and NCO will both be faster than the python-based options. That might not matter, and if you are already working in python, it might be easier to incorporate the python ones into your workflow. I hope that helps, good luck!
 
Top