Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Using the ERA5 land/sea mask data in WRF

ccalkins

New member
I have noticed that there is an issue with the land sea mask that you get from ECMWF is not binary.

1698687975769.png
1698687975796.png
This is also noted on ECMWF webpage:
Land-sea mask in ERA5 and ERA-Interim - Copernicus User Support Forum - ECMWF Confluence Wiki

Because the mask is not binary I believe it creates an issue with metgrid log
INFORM: Field LANDSEA.mask does not have a valid mask and will not be checked for missing values

which I believe causes issues with TSLB in the wrfinput files
1698687975822.png

Is there a standard with dealing with these issues? Such as modifying the SFC grib file and changing the values to be either 0/1 based or modifying the TSLB or some other variable in the met_em files to be the fill_value of 285? I thought it could possiblyy be a issue with the model level data but I've done it with Pressure levels from ERA5 and TSLB also shows up as 0K along areas of water. I should note that TSLB is 0K in the wrfout 00 hour file but in other files, the 0K issue has been fixed to be a single constant value over areas of water.

I have also provided a MFT link to some of my files from my run, that I left uncompleted. Let me know if other files would be needed that you also wish to examine.
https://mft.aer.com/download?domain...b8ec5d5b903b-104f5fa9fc1045ef8b22d2518bb0efa4

Chase
 
Hi Chase,
NCAR RDA provides ERA5 dataset (NCAR RDA Dataset ds633.0). From this website you can find the link to "ERA5 atmospheric invariant fields", where you can download the datafile

e5.oper.invariant.128_172_lsm.ll025sc.1979010100_1979010100.grb

WPS can ungrib this file and yield correct landsea mask.

Would you please try and let me know if you have any issue? Thanks.
 
Hi,
I think I faced the same issue. If yes, the answer is in this post :
You need to change the metgrid.TBL file.
I join a modified version that works for me.
Mathieu
 

Attachments

  • METGRID_ERA5.TBL.txt
    38.3 KB · Views: 73
Mathieu,
Would you please provide more information regarding the changes in METGRID.TBL? Specifically,
(1) It is based on which version of WPS?
(2) Where did you download the ERA5 reanalysis data? What is the resolution of the ERA5 data?
(3) Does this modified METGRID.TBL work for ERA5 data of various resolution?
Thank you.
 
Hi,
1- I faced this issue on version 4.4, I am still using this metgrid.TBL on version 4.5
2- I downloaded ERA5 data on Copernicus with a resolution of 31 km, with 37 pressure levels
3- I tried only with my ERA5 dataset

More informations :
With the default metgrid.TBL file, the landmask used in metgrid.exe seems to be the ERA5 landmask. SST was defined only at points considered as water in ERA5 (see figures a_LANDMASK and a_SST, the coastline resolution is not the same). This cause wrong values in TSLB but only in water points (which is not that much a problem). However, it also creates wrong SST values near the coastline (extrapolated from land points TSK). These wrong SST are kept all along the simulation if sst_update isn't used.
With the modified Metgrid.TBL, these problems are fixed.

Mathieu
 

Attachments

  • b_TSK.png
    b_TSK.png
    69.8 KB · Views: 23
  • a_TSLB.png
    a_TSLB.png
    29.3 KB · Views: 20
  • a_SST.png
    a_SST.png
    16.3 KB · Views: 20
  • a_LANDMASK.png
    a_LANDMASK.png
    17.9 KB · Views: 24
This works for ERA5 (0.25deg), but what about IFS? The IFS landmask has the same problem with fractional values, and I don't think NOAA/RDA has a 0.1degree landmask available.
 
Hi Ming,

I am working with Chase who posted the first message in this thread. I tried your solution using the file e5.oper.invariant.128_172_lsm.ll025sc.1979010100_1979010100.grb to create a constants file with the landsea mask. I also tried Mathieu's solution modifying the interpolation of SST in METGRID.TBL. Interestingly, when I looked at the TSK and T2 fields after 1-hour of simulation time on a 12 km grid they were almost identical for the two cases even though the SST fields at the coast were still very wrong in the landsea mask case. I have attached some files to illustrate this point. I am wondering how the TSK and T2 can be correct if SST is wrong and which solution is preferable. Thanks for your help. Jen
 

Attachments

  • TSK_ML_tbl.png
    TSK_ML_tbl.png
    291.7 KB · Views: 17
  • SST_ML_tbl.png
    SST_ML_tbl.png
    129.4 KB · Views: 16
  • TSK_LANDSEA.png
    TSK_LANDSEA.png
    293.5 KB · Views: 18
  • SST_LANDSEA.png
    SST_LANDSEA.png
    113.3 KB · Views: 18
Hi Jen,

Let's try the option: remove the following line from Vtable.ECMWF

34 | 1 | 0 | | SST | K | Sea-Surface Temperature |

Then rerun ungrib.exe. In this case you will have no SST. SKINTEMP will be used as SST later. In this way I expect that there is no unreasonable SST along the coastline.

Let me know if you have more questions.
 
I would like to add that while this issue seems insignificant, it could cause an obscure WRF runtime error that will crash the entire WRF model. That is why this issue should be corrected by using one of the above described methods.

I will provide an example of the WRF runtime error and my troubleshooting.

1) I was running a 1 year WRF simulation with ERA5 data. 1 domain with 16 processors. I am using the fractional LANDSEA field described above. Can WPS handle this field correctly (or handle it well enough where it doesn't really matter)?
Or should I use the "e5.oper.invariant.128_172_lsm.ll025sc.1979010100_1979010100.grb" file @Ming Chen mentioned?


2) The WRF model suddenly crashes on Jaunary 26th (about 1 month into the simulation) for no reason.

3) There are no CFL errors in any of the rsl files.

4) The main rsl files give no hint of what caused the error.

5) Some (but not all) of the rsl files specific to each processor have strange repeated output:

Flerchinger USEd in NEW version. Iterations= 10

6) This is the first clue.

7) I tried starting the WRF simulation just a few hours before the hour in January 26th when it fails. It still fails at exactly the same hour as when starting the run ~40 days earlier. From this, I know the problem is related to the input data at this specific time only (possibly more times later in the year).

8) I have sst_update = 1. If I change my namelist.input to use sst_update = 0, the run no longer fails at this time. This means sst is somehow related to the error.

9) I compare the SST and LANDSEA variables in the met_em file that gives the WRF error downstream, and the met_em file the hour before this file that does not give the WRF error downstream.
Surprisingly SST = SST and LANDSEA = LANDSEA between both files.

10) I change all the SST values that are 0 to 310.1 (a valid value) in the met_em file that gives the error. I rerun real.exe and wrf.exe, and WRF does not crash anymore. This indicates that SST is not really the issue but it indicates there is an issue with a different variable (maybe TSLB)?

11) The issue is not significant enough or doesn't exist frequently enough to cause all hours in the WRF simulation to fail. For my situation, it ran for over a month without issue, before a sudden issue. This likely indicates the issue could be related to missing data for a variable, and how that interacts with the LANDSEA mask and the WRF calculations related to sea surface temperature.

12) I have not tried any of the above methods to fix/get around this issue, but I plan to first try to remove SST from the Vtable so WRF will use SKINTEMP instead.

Josh
 
Have you tried to read directly the ERA5 grib file at the time when it crash ?
The number 10) is weird. Is it possible that you reached values lower than 0°C somewhere? I don't know how sea-ice is managed.
```
import xarray
ds = xarray.load_dataset(era_filename, engine="cfgrib")
sst = ds.sst
```
 
I would like to point out few other issues but I first need to explain how WPS works (what I understood from my experience and using the file I gave earlier) :

How it works ?


To build SST in WRF
- WPS takes the ERA5 "sst" field where it is defined (only in cells that are fully offshore in ERA5, so not too close to the coastline)
- Then it interpolates and also Extrapolates this "sst" field to the WRF grid sea cells,
To build the initial TSK
- WPS takes the ERA5 "skt" field
- Then it interpolates is to the WRF grid land cells,
- In sea cells, it takes the value of SST calculated previously
To build the initial SMOIS
- WPS takes the ERA5 moisture field "swvl1", defined everywhere
- Then it interpolates is to the WRF grid land cells,
- And set a value of 1 for sea cells


Issue n° 1 :

The field "sst" in the ERA5 file is defined hourly but its value is constant during a day, and changes only once a day (at 2300 UTC). So this is a bit sad, when using sst_update in WRF, because it also changes only once a day.
In opposite, the field "skt" (skin temperature) evolves over time but it is defined in the whole domain. We could use directly this field in WPS to force the SST, which seems appropriate for WRF simulation with resolution close to the ERA5 dataset (around 31 km)
However, for fine-resolution coastal simulation this solution is not very appropriate because, if doing so, the SST within a few kilometers of the coastline will be an average between the real SST and the land skin temperature. Indeed, ERA5 considers that a coastal cell is partly land and partly sea, so that the "skt" in a coastal cell is an average between the land and the sea skin temperatures.

An appropriate solution would therefore be to :
- select the "skt" values only where "sst" is defined
- Interpolate and Extrapolate this field as it is already done with "sst"
I haven't tried this, and I don't know if it is easy.
Since coastal atmospheric flows are highly dependant on the wind speed

Issue n°2 : Moisture in the land coastal cells

The field "swvl1" and "tsk" fields in ERA5 in coastal cells are an average between the land value and the sea value. NOTE that the "swvl1" over sea in ERA5 is surprisingly 0. Based on the method described earlier, we understant that the land cells in WRF are initialized with an unrealisticly low moisture. The tsk temperature initial difference adjust quite rapidly but the low moisture can take many days to adjust (even months, [1], [2]) and results in unrealisticly large skin temperature variations (error in Bowen ratio).
I don't have any idee to fix this. but it might be a more important issue than the SST.

I uploaded few pictures to support the text.

Mathieu

[1] Jerez, Sonia, Jose María López-Romero, Marco Turco, Raquel Lorente-Plazas, Juan José Gómez-Navarro, Pedro Jiménez-Guerrero, et Juan Pedro Montávez. 2020. « On the Spin-Up Period in WRF Simulations Over Europe: Trade-Offs Between Length and Seasonality ». Journal of Advances in Modeling Earth Systems 12 (4): e2019MS001945. https://doi.org/10.1029/2019MS001945.

[2] Angevine, W. M., E. Bazile, D. Legain, et D. Pino. 2014. « Land Surface Spinup for Episodic Modeling ». Atmospheric Chemistry and Physics 14 (15): 8165‑72. ACP - Land surface spinup for episodic modeling.
 

Attachments

  • ERA5_lsm_land_sea_mask.png
    ERA5_lsm_land_sea_mask.png
    19.6 KB · Views: 5
  • ERA5_skt.png
    ERA5_skt.png
    19.6 KB · Views: 5
  • ERA5_swvl1.png
    ERA5_swvl1.png
    18.3 KB · Views: 4
  • WRF_SMOIS_after_1day.png
    WRF_SMOIS_after_1day.png
    107.8 KB · Views: 4
  • WRF_TSKIN_degC_after_2days_at_noon.png
    WRF_TSKIN_degC_after_2days_at_noon.png
    150.3 KB · Views: 4
I would like to point out few other issues but I first need to explain how WPS works (what I understood from my experience and using the file I gave earlier) :

How it works ?

To build SST in WRF
- WPS takes the ERA5 "sst" field where it is defined (only in cells that are fully offshore in ERA5, so not too close to the coastline)
- Then it interpolates and also Extrapolates this "sst" field to the WRF grid sea cells,
To build the initial TSK
- WPS takes the ERA5 "skt" field
- Then it interpolates is to the WRF grid land cells,
- In sea cells, it takes the value of SST calculated previously
To build the initial SMOIS
- WPS takes the ERA5 moisture field "swvl1", defined everywhere
- Then it interpolates is to the WRF grid land cells,
- And set a value of 1 for sea cells


Issue n° 1 :

The field "sst" in the ERA5 file is defined hourly but its value is constant during a day, and changes only once a day (at 2300 UTC). So this is a bit sad, when using sst_update in WRF, because it also changes only once a day.
In opposite, the field "skt" (skin temperature) evolves over time but it is defined in the whole domain. We could use directly this field in WPS to force the SST, which seems appropriate for WRF simulation with resolution close to the ERA5 dataset (around 31 km)
However, for fine-resolution coastal simulation this solution is not very appropriate because, if doing so, the SST within a few kilometers of the coastline will be an average between the real SST and the land skin temperature. Indeed, ERA5 considers that a coastal cell is partly land and partly sea, so that the "skt" in a coastal cell is an average between the land and the sea skin temperatures.

An appropriate solution would therefore be to :
- select the "skt" values only where "sst" is defined
- Interpolate and Extrapolate this field as it is already done with "sst"
I haven't tried this, and I don't know if it is easy.
Since coastal atmospheric flows are highly dependant on the wind speed

Issue n°2 : Moisture in the land coastal cells

The field "swvl1" and "tsk" fields in ERA5 in coastal cells are an average between the land value and the sea value. NOTE that the "swvl1" over sea in ERA5 is surprisingly 0. Based on the method described earlier, we understant that the land cells in WRF are initialized with an unrealisticly low moisture. The tsk temperature initial difference adjust quite rapidly but the low moisture can take many days to adjust (even months, [1], [2]) and results in unrealisticly large skin temperature variations (error in Bowen ratio).
I don't have any idee to fix this. but it might be a more important issue than the SST.

I uploaded few pictures to support the text.

Mathieu

[1] Jerez, Sonia, Jose María López-Romero, Marco Turco, Raquel Lorente-Plazas, Juan José Gómez-Navarro, Pedro Jiménez-Guerrero, et Juan Pedro Montávez. 2020. « On the Spin-Up Period in WRF Simulations Over Europe: Trade-Offs Between Length and Seasonality ». Journal of Advances in Modeling Earth Systems 12 (4): e2019MS001945. https://doi.org/10.1029/2019MS001945.

[2] Angevine, W. M., E. Bazile, D. Legain, et D. Pino. 2014. « Land Surface Spinup for Episodic Modeling ». Atmospheric Chemistry and Physics 14 (15): 8165‑72. ACP - Land surface spinup for episodic modeling.
Thanks for your info. This helps me understand everything better!
 
Have you tried to read directly the ERA5 grib file at the time when it crash ?
The number 10) is weird. Is it possible that you reached values lower than 0°C somewhere? I don't know how sea-ice is managed.
```
import xarray
ds = xarray.load_dataset(era_filename, engine="cfgrib")
sst = ds.sst
```
So I tried looking at my original ERA5 GRIB file at the times around when WRF crashed. It turns out that 22 UTC is the time when both the sst and sea ice is updated once per day. It seems that sea ice is also a fractional field. Does this mean I should modify the METGRID.TBL.ARW in a similar way that you did for sst?

The original data both before and after the time of the model crash has sea ice in some cells, and also temperatures lower than 0°C in some areas. I don't see anything weird with the data though. I have attached the original ERA5 file based on before and after the times of the crash, with the sst and sea ice variables in it.
 

Attachments

  • siconc_sst_1988-01-26T21_00_00.csv.txt
    366.6 KB · Views: 2
  • siconc_sst_1988-01-26T22_00_00.csv.txt
    366.4 KB · Views: 1
Hi Jen,

Let's try the option: remove the following line from Vtable.ECMWF

34 | 1 | 0 | | SST | K | Sea-Surface Temperature |

Then rerun ungrib.exe. In this case you will have no SST. SKINTEMP will be used as SST later. In this way I expect that there is no unreasonable SST along the coastline.

Let me know if you have more questions.
I have just confirmed that this method appears to work for me. If I remove SST from my Vtable, WRF does not stop at the problematic date. All my ERA5 data including the mask is from the Copernicus website. The SST field was also downloaded from ERA5 hourly data on single levels from 1940 to present

I am not too worried about the issue @rmcardoso mentions in this post: Issue with ERA5 SST fields

"
Hi David,
This is an old issue. If you replace the SST by the skin temperature you will have unrealistic warm waters near the coast in summer. Particularly near the capes. You just need to edit the SST field in METGRID.TBL.ARW and add a four-point weighted average in the interpolation option and declare the field as masked. See below.

name=SST
interp_option=sixteen_pt+four_pt+wt_average_4pt+search
interp_mask=LANDSEA(1)
masked=land
fill_missing=0.
missing_value=-1.E30
flag_in_output=FLAG_SST
"
My skin temperatures are probably good enough for my purposes.

However, I did try the above modifications to the METGRID.TBL.ARW, and my WRF run seems to be successful and does not stop at the problematic date.

If anyone has any suggestion as to which of the above 2 options I should use, that would be really helpful. I am running a WRF simulation for the whole year over the Northeast USA. I will eventually nest down to 12 km child domain. My location of interest is over land, but about 40 miles away from the ocean. Thanks.

Josh
 
I would like to point out few other issues but I first need to explain how WPS works (what I understood from my experience and using the file I gave earlier) :

How it works ?

To build SST in WRF
- WPS takes the ERA5 "sst" field where it is defined (only in cells that are fully offshore in ERA5, so not too close to the coastline)
- Then it interpolates and also Extrapolates this "sst" field to the WRF grid sea cells,
To build the initial TSK
- WPS takes the ERA5 "skt" field
- Then it interpolates is to the WRF grid land cells,
- In sea cells, it takes the value of SST calculated previously
To build the initial SMOIS
- WPS takes the ERA5 moisture field "swvl1", defined everywhere
- Then it interpolates is to the WRF grid land cells,
- And set a value of 1 for sea cells


Issue n° 1 :

The field "sst" in the ERA5 file is defined hourly but its value is constant during a day, and changes only once a day (at 2300 UTC). So this is a bit sad, when using sst_update in WRF, because it also changes only once a day.
In opposite, the field "skt" (skin temperature) evolves over time but it is defined in the whole domain. We could use directly this field in WPS to force the SST, which seems appropriate for WRF simulation with resolution close to the ERA5 dataset (around 31 km)
However, for fine-resolution coastal simulation this solution is not very appropriate because, if doing so, the SST within a few kilometers of the coastline will be an average between the real SST and the land skin temperature. Indeed, ERA5 considers that a coastal cell is partly land and partly sea, so that the "skt" in a coastal cell is an average between the land and the sea skin temperatures.

An appropriate solution would therefore be to :
- select the "skt" values only where "sst" is defined
- Interpolate and Extrapolate this field as it is already done with "sst"
I haven't tried this, and I don't know if it is easy.
Since coastal atmospheric flows are highly dependant on the wind speed

Issue n°2 : Moisture in the land coastal cells

The field "swvl1" and "tsk" fields in ERA5 in coastal cells are an average between the land value and the sea value. NOTE that the "swvl1" over sea in ERA5 is surprisingly 0. Based on the method described earlier, we understant that the land cells in WRF are initialized with an unrealisticly low moisture. The tsk temperature initial difference adjust quite rapidly but the low moisture can take many days to adjust (even months, [1], [2]) and results in unrealisticly large skin temperature variations (error in Bowen ratio).
I don't have any idee to fix this. but it might be a more important issue than the SST.

I uploaded few pictures to support the text.

Mathieu

[1] Jerez, Sonia, Jose María López-Romero, Marco Turco, Raquel Lorente-Plazas, Juan José Gómez-Navarro, Pedro Jiménez-Guerrero, et Juan Pedro Montávez. 2020. « On the Spin-Up Period in WRF Simulations Over Europe: Trade-Offs Between Length and Seasonality ». Journal of Advances in Modeling Earth Systems 12 (4): e2019MS001945. https://doi.org/10.1029/2019MS001945.

[2] Angevine, W. M., E. Bazile, D. Legain, et D. Pino. 2014. « Land Surface Spinup for Episodic Modeling ». Atmospheric Chemistry and Physics 14 (15): 8165‑72. ACP - Land surface spinup for episodic modeling.
Hello Mathieu,

Thank you for sharing the valuable information — it really helped me crack this weird data issue!

When I checked the “swvl1” values for July 24, 2023 at 00:00 UTC, I was surprised to find 730 entries below zero. Unfortunately, the same problem shows up in “swvl2” and “swvl3” too! I've already posted about this on the ECMWF forum and hope to get a response from them.

Jasper
 
Last edited:
Jasper,
The Data Engineering and Curation Section (DECS) of NSF NCAR CISL is in the process of phasing out whole file download, subsetting, and campaign storage access to RDA ERA5 Reanalysis in GRIB format (d633000). We encourage users to transition to the NetCDF files produced by DECS for the RDA. For more details, including the NetCDF data inventory, please visit the ERA5 Reanalysis dataset website.

WRF and MPAS users who previously relied on ERA5 in GRIB format for model initialization should transition to using NetCDF-based initialization scripts developed by NSF NCAR MMM.

Would you please try this script? Let us know if you have any issues.
 
Top