Project

General

Profile

RE: Type of interpolation in ml2pl-function ยป interpolation.py

Pablo Conrat, 2020-03-24 12:05

 
# Calculating the pressure levels I want the data on
p_lev_final = ds_ml.hyam + ds_ml.hybm * 101300

# Selecting one vertical profile out of the dataset ds_ml
ml_profile = ds_ml.isel(time=i, lat=j, lon=k)

# Calculating the pressure levels the data is stored on
p_lev_model = ds_ml.hyam + ds_ml.hybm * np.exp(ml_profile.lnsp.values)

# Interpolating the variable (u in this case) to my desired pressure levels
linear_interpolation = np.interp(p_lev_final, p_lev_model, ml_profile.u)
    (1-1/1)