pl_to_pl
- pl_to_pl(fs, pressures[, method])
New in Metview version 5.17.0.
Interpolates
fs
from pressure levels onto a set of pressure levels defined bypressures
.- Parameters
fs (
Fieldset
) – fieldset to be interpolated (must contain pressure levels!). Does not have to be sorted by level.pressures (list or ndarray) – target pressure levels in hPa. Does not have to be sorted.
method (str) – specifies the interpolation method. The possible values are “linear” and “log”. If it is not specified linear interpolation is used.
- Return type
The input data (
fs
) must contain one field per pressure level only. It means that e.g. data containing multiple timesteps cannot be used as an input.At gridpoints where the interpolation is not possible a missing value is returned. It happens where the target pressure is outside the pressure level range in
fs
.- Example
This code illustrates how to use
pl_to_pl()
with data retrieved from MARS:import metview as mv # get pressure level fields from MARS f = mv.retrieve(type="an", date=-1, time=12, levelist=[1000, 925, 850, 700], param="t", grid=[1,1]) # interpolate onto a list of pressure levels p_levels = [965, 850, 815, 723.5] r = mv.pl_to_pl(f, p_levels)