Project

General

Profile

Model level to pressure interpolation for ICON

Added by Guido Cioni over 1 year ago

Hi all,
I was just wondering if anyone has ever tried to use CDO to interpolate the data on model levels to pressure levels.
I think the standard `ml2pl` function won't work here as the levels are defined differently in ICON.

I'm trying to interpolate some of the variables available on the ICON-EU opendata server that have no output on pressure levels.


Replies (13)

RE: Model level to pressure interpolation for ICON - Added by Ralf Mueller over 1 year ago

Hi Guido!

for ICON please check ap2pl and related operators. They are designed to work with ICON. cdo -h ap2pl

cheers
ralf

RE: Model level to pressure interpolation for ICON - Added by Guido Cioni over 1 year ago

Thanks, didn't know about that.

I tried but it's not really clear to me what is CDO looking for in the pressure.
The documentation states

The air pressure is identified by the NetCDF CF standard
name air_pressure

so I tried to rename the pressure variable to have both its name and long_name attributes as "air_pressure":


float air_pressure(time, height, lat, lon) ;
      pres:long_name = "air_pressure" ;
      pres:units = "Pa" ;
      pres:param = "0.3.0" ;

but CDO is still complaining that it cannot find it.

Do I need to define a new attribute for the air_pressure variable with value "air_pressure" ?

RE: Model level to pressure interpolation for ICON - Added by Guido Cioni over 1 year ago

Yes, I have to. Just replied to myself :D

In case anyone wonders, you can add this attribute (or change it) to match the expected string ncatted -a standard_name,pres,o,c,"air_pressure" P_2024032100_eur.nc P_2024032100_eur.nc

RE: Model level to pressure interpolation for ICON - Added by Ralf Mueller over 1 year ago

yes. standard_name is the CF-conform attribute you have to use

RE: Model level to pressure interpolation for ICON - Added by Guido Cioni 2 days ago

Hey Ralf,
quick question. Does this mean I can only use netcdf input file to perform pressure interpolation?
I just tried with a GRIB file (which obviously does not make use of the standard_name attribute) and it still failed.
In theory it should be possible for CDO to retrieve the pressure based solely on the GRIB parameter id.

RE: Model level to pressure interpolation for ICON - Added by Ralf Mueller 1 day ago

Ola!

this is supposed to work with all supported versions of netcdf and grib

RE: Model level to pressure interpolation for ICON - Added by Guido Cioni 1 day ago

Sadly it does not :(
I'm trying to use the ICON opendata (https://opendata.dwd.de/weather/nwp/icon/grib/)

❯ cdo sinfov P_2025062000_global.grib2                                                                                                                                                                             
   File format : GRIB2
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter name
     1 : DWD      unknown  v instant     120   1   2949120   1  P16  : P             
   Grid coordinates :
     1 : unstructured             : points=2949120
                             grid : number=26  position=1
                             uuid : a27b8de6-18c4-11e4-820a-b5b098c6a5c0
   Vertical coordinates :
     1 : generalized_height       : levels=120
                           height : 1 to 120 by 1
                           bounds : 1-2 to 120-121 by 1
                            zaxis : number=0
                             uuid : 77c2c32c-2127-6499-e316-af9358302ec0
   Time coordinate :
                             time : 1 step
     RefTime =  2025-06-20 00:00:00  Units = minutes  Calendar = proleptic_gregorian
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  2025-06-20 00:00:00
cdo    sinfon: Processed 1 variable over 1 timestep [0.16s 52MB]

❯ cdo sinfov QV_2025062000_global.grib2                                                                                                                                                                            
   File format : GRIB2
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter name
     1 : DWD      unknown  v instant     120   1   2949120   1  P16  : QV            
   Grid coordinates :
     1 : unstructured             : points=2949120
                             grid : number=26  position=1
                             uuid : a27b8de6-18c4-11e4-820a-b5b098c6a5c0
   Vertical coordinates :
     1 : generalized_height       : levels=120
                           height : 1 to 120 by 1
                           bounds : 1-2 to 120-121 by 1
                            zaxis : number=0
                             uuid : 77c2c32c-2127-6499-e316-af9358302ec0
   Time coordinate :
                             time : 1 step
     RefTime =  2025-06-20 00:00:00  Units = minutes  Calendar = proleptic_gregorian
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  2025-06-20 00:00:00
cdo    sinfon: Processed 1 variable over 1 timestep [0.16s 51MB]

then I try

❯ cdo ap2plx,15000,20000,25000,30000,40000,50000,60000,70000,80000,85000,90000,95000,100000 -merge P_2025062000_global.grib2 QV_2025062000_global.grib2 QV_2025062000_global_pres.grib2                            
cdo(1) merge: Process started

cdo    ap2plx (Abort): air_pressure not found!

I used to fix this by adding the standard_name attribute when using netcdf but obviously this should not be needed here.

This is how the pressure variable looks like

    float Pressure_UnknownLevelType-150_layer(time=1, y=1, x=2949120);
      :long_name = "Pressure @ Generalized vertical height coordinate layer";
      :units = "Pa";
      :abbreviation = "PS";
      :missing_value = NaNf; // float
      :grid_mapping = "GdsUnstructured_Projection";
      :coordinates = "reftime time y x ";
      :Grib_Variable_Id = "VAR_0-3-0_L150_layer";
      :Grib2_Parameter = 0, 3, 0; // int
      :Grib2_Parameter_Discipline = "Meteorological products";
      :Grib2_Parameter_Category = "Mass";
      :Grib2_Parameter_Name = "Pressure";
      :Grib2_Level_Type = 150; // int
      :Grib2_Level_Desc = "Generalized vertical height coordinate";
      :Grib2_Generating_Process_Type = "Forecast";
      :Grib2_Statistical_Process_Type = "UnknownStatType--1";

Do you see anything obviously wrong?

RE: Model level to pressure interpolation for ICON - Added by Ralf Mueller 1 day ago

Sorry, my bad: the docu is explicit: it only works for netcdf output of ICON

check `cdo -h ap2pl`

can u provide a complete link to your input files, please?

RE: Model level to pressure interpolation for ICON - Added by Guido Cioni 1 day ago

Yep, that's what I thought.
You can find the files directly in the link I sent you. I just downloaded all the levels for a variable and merged them into a single file.
I would send them to you but they're to large to be uploaded here.

RE: Model level to pressure interpolation for ICON - Added by Ralf Mueller about 24 hours ago

just post the urls. I can download them on my own.

RE: Model level to pressure interpolation for ICON - Added by Ralf Mueller about 18 hours ago

with at least these two files, I tried this

cdo -f nc -showname -merge [ icon_global_icosahedral_model-level_2025062000_000_100_QV.grib2 -chname,pfull,air_pressure icon_global_icosahedral_model-level_2025062000_000_100_P.grib2

and it shows:

cdo(1) merge: Process started                                                                                                                                                                                                                                                                                           │
│cdo(2) chname: Process started                                                                                                                                                                                                                                                                                          │
│ hus air_pressure                                                                                                                                                                                                                                                                                                       │
│cdo(2) chname: Processed 2949120 values from 1 variable over 1 timestep                                                                                                                                                                                                                                                 │
│cdo(1) merge: Processed 5898240 values from 2 variables over 2 timesteps                                                                                                                                                                                                                                                │
│cdo    showname: Processed 2 variables [0.31s 111MB]       

but using ap2pl throws the same error

    (1-13/13)