arlmet.converters.from_icon#
- arlmet.converters.from_icon(datasets)[source]#
Convert ICON forecasts on a regular lat/lon grid to a Dataset for
arlmet.write_dataset().This reads DWD’s ICON-EU and ICON-D2 GRIB2 files on their regular lat/lon grids (DWD’s open data,
regular-lat-lon_pressure-levelandsingle-level, one file per variable, level and forecast step), taking the Datasetscfgrib.open_datasets()returns for them. HYSPLIT has no converter for ICON. Each valid time is one time step, on ICON’s pressure levels (vertical flag 2); the levels of each variable are stacked.ICON’s precipitation and surface fluxes are totals and means from the start of the forecast. Each is written as the total or mean since the step before among the files given, of the same forecast (since the start of the forecast for its first):
TPP1is that precipitation per hour, asarw2arlwrites WRF’s. A forecast’s step 0 has none. Where two files hold a field at the same valid time, the one with the shorter forecast step is used, as infrom_gfs(), so the forecasts of several runs make one series, each step 0 taking its fluxes from the run before. A field a time step has no file for is written as a missing record there. The index record’s forecast hour is the step of the pressure-level fields.ICON (cfgrib name)
ARL
conversion
FI(z)HGTS
geopotential (m2 s-2) / 9.80665
T,U,VTEMP, UWND, VWND
K, m s-1
OMEGA(w)WWND
Pa s-1 to hPa s-1
RELHUM(r)RELH
%
PSPRSS
Pa to hPa
PMSLMSLP
Pa to hPa
HSURFSHGT
m, the same at every time step
T_GTMPS
K
T_2M,RELHUMT02M,
K, %
_2MRH2M
U_10M,V_10MU10M, V10M
m s-1
CLCTTCLD
%
CAPE_ML,CAPE,
J kg-1
CIN_MLCINH
MHPBLH
m
Z0RGHS
m
TOT_PRECTPP1
kg m-2 to m, per hour since the step before
ASHFL_SSHTF
W m-2, sign changed (positive upward)
ALHFL_SLHTF
W m-2, sign changed (positive upward)
ASWDIR_S+DSWF
W m-2, direct plus diffuse downward
ASWDIFD_SAUMFL_S,UMOF,
N m-2
AVMFL_SVMOF
cfgrib names some of these by ecCodes’ standard names (
sp,t2m,tp,avg_slhtf,mld,fsr, …) and the rest by DWD’s; both, and DWD’s in lower case, are read.- Parameters:
datasets (
Iterable[Dataset]) – The Datasets of ICON GRIB2 files, ascfgrib.open_datasets()returns them (each with scalartime,stepandvalid_timecoordinates), one list after another. Datasets and variables not in the table are left out. Every time step must have the same pressure levels.- Returns:
The fields in
arlmet.open_dataset()’s layout, with source"ICON"and each variable’s ARLunitsin its attrs.- Return type:
- Raises:
ValueError – If no Dataset holds pressure-level fields, a Dataset lacks its scalar times, a field is given twice for one step, the time steps have different pressure levels, or the grids differ.
Notes
ICON’s own grid (icosahedral, as in DWD’s global ICON files) and its model levels (heights that follow the terrain, which no ARL vertical coordinate describes) are not converted; regrid to a lat/lon grid and interpolate to pressure levels first. No
DIF*records are written.Examples
>>> import glob >>> import cfgrib >>> import arlmet >>> files = sorted(glob.glob("icon-eu_europe_regular-lat-lon_*.grib2")) >>> datasets = [ ... ds for f in files for ds in cfgrib.open_datasets(f) ... ] >>> ds = arlmet.converters.from_icon(datasets) >>> arlmet.write_dataset(ds, "icon-eu.arl")