Help Needed – WRF Setup Using ECMWF IFS Data (Ungrib Failure)

Sorry we didn't see any updates. This is partially because WRF has been frozen and we no longer get involved in developing new utilities/schemes. Hope we can get more inputs from the community.
 
This means WRF has entered 'maintenance status' and we no longer put time and efforts to further develop it.
 
This means WRF has entered 'maintenance status' and we no longer put time and efforts to further develop it.
Can it get a final EOL update where the pull requests and features that are awaiting for implementation be fixed? Such as a version 4.7.2 EOL and WPS 4.7.0 EOL?

Several of the implementations greatly affect the global community and the fixes to manually change them in the source code would be difficult for new users to implement.
 
I have played a bit with this recently as i should really want to get WRF running with ECMWF IFS-data. After reading pieces what came up around this issue in other threads/github I get up with this:

While downloading the IFS gribs:
wgrib2 "$grib_file" -set_grib_type simple -grib_out res1.grb2 >/dev/null 2>&1; then
wgrib2 res1.grb2 -if ":soil level 0 - soil level 1" -set_lev "0-0.07 m below ground" -elseif ":soil level 1 - soil level 2" -set_lev "0.07-0.28 m below ground" -elseif ":soil level 2 - soil level 3" -set_lev "0.28-1 m below ground" -elseif ":soil level 3 - soil level 4" -set_lev "1-2.89 m below ground" -endif -grib res.grb2
mv res.grb2 "$grib_file"

The Vtable.ECMWF i changed like this:
0 | 1 | 0 | 7 | ST000007 | K | T of 0-7 cm ground layer | 2 | 3 | 18 | 106 |
1 | 2 | 7 | 28 | ST007028 | K | T of 7-28 cm ground layer | 2 | 3 | 18 | 106 |
2 | 3 | 28 | 100 | ST028100 | K | T of 28-100 cm ground layer | 2 | 3 | 18 | 106 |
3 | 4 | 100 | 289 | ST100289 | K | T of 100-289 cm ground layer | 2 | 3 | 18 | 106 |
0 | 1 | 0 | 7 | SM000007 | m3 m-3 | Soil moisture of 0-7 cm ground layer | 2 | 0 | 25 | 106 |
1 | 2 | 7 | 28 | SM007028 | m3 m-3 | Soil moisture of 7-28 cm ground layer | 2 | 0 | 25 | 106 |
2 | 3 | 28 | 100 | SM028100 | m3 m-3 | Soil moisture of 28-100 cm ground layer | 2 | 0 | 25 | 106 |
3 | 4 | 100 | 289 | SM100289 | m3 m-3 | Soil moisture of 100-289 cm ground layer | 2 | 0 | 25 | 106 |
And ugrib picks them up fine:

PRES GEOPT HGT TT UU VV RH DEWPT LANDSEA SOILGEO SOILHGT PSFC PMSL SKINTEMP SEAICE SST SNOW_DEN SNOW_EC SNOW ST000007 ST007028 ST028100 ST100289 SM000007 SM007028 SM028100 SM100289
-------------------------------------------------------------------------------
2013.0 O O O O O O O O O O O X O O O O O O O O O O O O O O
2001.0 O O X X X X X X O O X O X O O X X X X X X X X X X X
 
Here is a clean summary you can post on the WRF forum or GitHub that explains the problem and the working solution.


Running WRF/WPS with ECMWF IFS Open Data (soil layer issue and fix)​

I recently worked on running WRF with ECMWF IFS open data, and ran into the known problem where soil temperature (ST) and soil moisture (SM) fields fail in ungrib or are not interpreted correctly.

After reading several forum threads and testing different approaches, here is a working setup and explanation.


Problem​

Newer ECMWF IFS datasets (post ~cycle 49r1) changed the encoding of soil fields.

In particular:

  • soil temperature → discipline=2, category=3, parameter=18
  • volumetric soil water → discipline=2, category=0, parameter=25
  • soil layers use GRIB2 level type 151
However stock WPS only handles soil layers using level type 106, so ungrib cannot properly decode the fields without modification.

The soil layers provided by ECMWF correspond to:

layerdepth
10–7 cm
27–28 cm
328–100 cm
4100–289 cm
WRF expects these as:

ST000007
ST007028
ST028100
ST100289

SM000007
SM007028
SM028100
SM100289


Temporary workaround (GRIB rewriting)​

One workaround is to rewrite the soil-layer levels with wgrib2:

wgrib2 "$grib_file" -set_grib_type simple -grib_out res1.grb2

wgrib2 res1.grb2 \
-if ":soil level 0 - soil level 1" -set_lev "0-0.07 m below ground" \
-elseif ":soil level 1 - soil level 2" -set_lev "0.07-0.28 m below ground" \
-elseif ":soil level 2 - soil level 3" -set_lev "0.28-1 m below ground" \
-elseif ":soil level 3 - soil level 4" -set_lev "1-2.89 m below ground" \
-endif -grib res.grb2

mv res.grb2 "$grib_file"

Then modify the Vtable.ECMWF entries:

0 | 1 | 0 | 7 | ST000007 | K | T of 0-7 cm ground layer | 2 | 3 | 18 | 106
1 | 2 | 7 | 28 | ST007028 | K | T of 7-28 cm ground layer | 2 | 3 | 18 | 106
2 | 3 | 28 | 100 | ST028100 | K | T of 28-100 cm ground layer | 2 | 3 | 18 | 106
3 | 4 | 100 | 289 | ST100289 | K | T of 100-289 cm ground layer | 2 | 3 | 18 | 106

0 | 1 | 0 | 7 | SM000007 | m3 m-3 | Soil moisture 0-7 cm | 2 | 0 | 25 | 106
1 | 2 | 7 | 28 | SM007028 | m3 m-3 | Soil moisture 7-28 cm | 2 | 0 | 25 | 106
2 | 3 | 28 | 100 | SM028100 | m3 m-3 | Soil moisture 28-100 cm | 2 | 0 | 25 | 106
3 | 4 | 100 | 289 | SM100289 | m3 m-3 | Soil moisture 100-289 cm | 2 | 0 | 25 | 106

With this change, ungrib inventories correctly:

ST000007 ST007028 ST028100 ST100289
SM000007 SM007028 SM028100 SM100289

However, this is only a workaround.


Proper solution (recommended)​

A cleaner solution is to patch WPS to support ECMWF soil layers using level type 151.

The fix was implemented in:

WPS PR #266

This patch includes:

  1. new Vtable.ECMWF.IFS.grib2
  2. modifications to
    ungrib/src/ngl/g2/params.f
  3. modifications to
    ungrib/src/rd_grib2.F
These changes allow ungrib to correctly decode ECMWF soil fields without rewriting GRIB files.

Key additions:

  • support for ECMWF parameters
SOT (soil temperature)
VSW (volumetric soil water)
STL1-STL4
SWVL1-SWVL4

  • recognition of GRIB2 level type 151
  • mapping of ECMWF soil layer indices (0-1, 1-2, 2-3, 3-4) to WRF soil depths

Required WRF configuration​

Make sure WRF uses four soil layers:

num_soil_layers = 4

This matches the ECMWF soil layer structure.


Final result​

After applying the patch and using the updated Vtable, ungrib correctly processes:

ST000007
ST007028
ST028100
ST100289
SM000007
SM007028
SM028100
SM100289

and the WRF/WPS workflow runs normally with ECMWF IFS data.


If helpful, can someone please verify this patch suggestion?
 
Here is a clean summary you can post on the WRF forum or GitHub that explains the problem and the working solution.


Running WRF/WPS with ECMWF IFS Open Data (soil layer issue and fix)​

I recently worked on running WRF with ECMWF IFS open data, and ran into the known problem where soil temperature (ST) and soil moisture (SM) fields fail in ungrib or are not interpreted correctly.

After reading several forum threads and testing different approaches, here is a working setup and explanation.


Problem​

Newer ECMWF IFS datasets (post ~cycle 49r1) changed the encoding of soil fields.

In particular:

  • soil temperature → discipline=2, category=3, parameter=18
  • volumetric soil water → discipline=2, category=0, parameter=25
  • soil layers use GRIB2 level type 151
However stock WPS only handles soil layers using level type 106, so ungrib cannot properly decode the fields without modification.

The soil layers provided by ECMWF correspond to:

layerdepth
10–7 cm
27–28 cm
328–100 cm
4100–289 cm
WRF expects these as:

ST000007
ST007028
ST028100
ST100289

SM000007
SM007028
SM028100
SM100289


Temporary workaround (GRIB rewriting)​

One workaround is to rewrite the soil-layer levels with wgrib2:

wgrib2 "$grib_file" -set_grib_type simple -grib_out res1.grb2

wgrib2 res1.grb2 \
-if ":soil level 0 - soil level 1" -set_lev "0-0.07 m below ground" \
-elseif ":soil level 1 - soil level 2" -set_lev "0.07-0.28 m below ground" \
-elseif ":soil level 2 - soil level 3" -set_lev "0.28-1 m below ground" \
-elseif ":soil level 3 - soil level 4" -set_lev "1-2.89 m below ground" \
-endif -grib res.grb2

mv res.grb2 "$grib_file"

Then modify the Vtable.ECMWF entries:

0 | 1 | 0 | 7 | ST000007 | K | T of 0-7 cm ground layer | 2 | 3 | 18 | 106
1 | 2 | 7 | 28 | ST007028 | K | T of 7-28 cm ground layer | 2 | 3 | 18 | 106
2 | 3 | 28 | 100 | ST028100 | K | T of 28-100 cm ground layer | 2 | 3 | 18 | 106
3 | 4 | 100 | 289 | ST100289 | K | T of 100-289 cm ground layer | 2 | 3 | 18 | 106

0 | 1 | 0 | 7 | SM000007 | m3 m-3 | Soil moisture 0-7 cm | 2 | 0 | 25 | 106
1 | 2 | 7 | 28 | SM007028 | m3 m-3 | Soil moisture 7-28 cm | 2 | 0 | 25 | 106
2 | 3 | 28 | 100 | SM028100 | m3 m-3 | Soil moisture 28-100 cm | 2 | 0 | 25 | 106
3 | 4 | 100 | 289 | SM100289 | m3 m-3 | Soil moisture 100-289 cm | 2 | 0 | 25 | 106

With this change, ungrib inventories correctly:

ST000007 ST007028 ST028100 ST100289
SM000007 SM007028 SM028100 SM100289

However, this is only a workaround.


Proper solution (recommended)​

A cleaner solution is to patch WPS to support ECMWF soil layers using level type 151.

The fix was implemented in:

WPS PR #266

This patch includes:

  1. new Vtable.ECMWF.IFS.grib2
  2. modifications to
    ungrib/src/ngl/g2/params.f
  3. modifications to
    ungrib/src/rd_grib2.F
These changes allow ungrib to correctly decode ECMWF soil fields without rewriting GRIB files.

Key additions:

  • support for ECMWF parameters
SOT (soil temperature)
VSW (volumetric soil water)
STL1-STL4
SWVL1-SWVL4

  • recognition of GRIB2 level type 151
  • mapping of ECMWF soil layer indices (0-1, 1-2, 2-3, 3-4) to WRF soil depths

Required WRF configuration​

Make sure WRF uses four soil layers:

num_soil_layers = 4

This matches the ECMWF soil layer structure.


Final result​

After applying the patch and using the updated Vtable, ungrib correctly processes:

ST000007
ST007028
ST028100
ST100289
SM000007
SM007028
SM028100
SM100289

and the WRF/WPS workflow runs normally with ECMWF IFS data.


If helpful, can someone please verify this patch suggestion?
@weatherc also came up with a similar solution too, but i cannot find the post anymore
 
Back
Top