Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for ICON in WPS #221

Merged
merged 6 commits into from
Apr 13, 2023
Merged

Conversation

grafmi
Copy link
Contributor

@grafmi grafmi commented Apr 1, 2023

The ICON grib2 data set is now able to be ingested by the ungrib program. Informations about the ICON data set can be found here: https://www.dwd.de/DWD/forschung/nwv/fepub/icon_database_main.pdf

  1. Two Vtable files (pressure and model levels) have been created with the fields required by the WRF model. Minor changes have been adapted compared to PR Adding support for ICON-EU in WPS #154
  2. Modifications to the ungrib source code: Adding support for level code 150 in rd_grid2.F because model levels of ICON are on generalized vertical height coordinates. The general vertical height coordinate is not specified by vertical coordinate parameters but by providing a 3D field, that specifies the geometric height of every model grid point in meters. For more details, see Appendix in: https://www.dwd.de/DWD/forschung/nwv/fepub/icon_database_main.pdf
  3. Addition of new soil levels: New soil levels from ICON are added to METGRID.TBL.ARW for metgrid.exe. Details about the soil levels in ICON can be found in the documentation (see above). Compared to PR Adding support for ICON-EU in WPS #154 all available model levels (soil moisture and temperature) are included now.
  4. Conversion of soil moisture units to those expected by the WRF model: The preprocessing in rrpr.F has to be modified to convert the units of column-integrated soil moisture provided by ICON from kg m-2 to m3 m-2 for WRF input.
  5. Addition of an identifier for DWD models (ICON) in rd_grib2.F and rd_grib1.F as done by @WQadam

This PR has been tested with ICON-EU (~6.6 km resolution) data, but it should be able to run with ICON-D2 (~2.2 km resolution) and ICON-Global. For the latter it needs to be converted from an icosahedral grid to a regular lat-lon grid. Data for testing can be taken from PR #154

This PR is very similar to PR #220. Nevertheless I published it, so you can decide which one is more appropriate for your needs.

@weiwangncar
Copy link
Collaborator

@grafmi Thanks for redoing this PR. I was able to compile the code, download the 0.6 deg ICON data using download_icon.sh, and run through ungrib, metgrid, real and wrf. I like that the Vtable included the GHT data from the model. This will provide a better estimate for input geopotential for the WRF model. I have a couple of quetions:

  1. The link for the sited documentation file in pdf is not there any more. Can you provide the correct link?
  2. Do you know the latitude/longitude bounds of the 0.6 degree dataset?
  3. When I downloaded the data, the last two layers of soil T were not there. Is this typical?
  4. Are the downloaded qv and qv_2m mixing ratio or specific humidity?

@mgduda @jimbresch If you would like to take a look at this, I have a couple of downloaded ICON data files on Cheyenne. Let me know.

@grafmi
Copy link
Contributor Author

grafmi commented Apr 2, 2023

@weiwangncar

  1. I provided a working link in the description on top
  2. The lat/lon boundaries of ICON-EU are 23.5°W – 62.5°E / 29.5°N – 70.5°N. You will find these information and the domain of ICON-D2 also here: DWD Database Reference for the Global and Regional ICON
  3. According to the documentation (see link above), the last two layers should be there - maybe, my old download script did not include them
  4. qv and qv_2m are specific humidity (see link above)

@weiwangncar
Copy link
Collaborator

weiwangncar commented Apr 10, 2023

@mgduda @jimbresch Can you review this PR? Let's see if we can get it into v4.5 release. Thanks!

Copy link
Collaborator

@jimbresch jimbresch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see expanded comments at the bottom of the Vtable to better document the steps involved in running wps with ICON, but that could be added later. The code modifications seem fine.

@mgduda mgduda merged commit a22c073 into wrf-model:develop Apr 13, 2023
@weiwangncar
Copy link
Collaborator

@grafmi Do you mind making your download script available for others?

@grafmi
Copy link
Contributor Author

grafmi commented Apr 14, 2023

@grafmi Do you mind making your download script available for others?

@weiwangncar It's fine for me to make it available to others. Where should I provide it?

@weiwangncar
Copy link
Collaborator

weiwangncar commented Apr 14, 2023

@grafmi We may add a link in the release note for downloading the script, and we can also add it to our FAQs. Is there anything in the script you'd like to revise? Have you used it recently? It seems the data is update daily on the server and there is no archive of the data, correct?

@sael9740
Copy link

I was having issues with this version when using the ICON-D2 dataset with pressure levels. I am not very familiar with WPS in general so I may be missing something obvious. The file I'm attaching has my namelists, run scripts and log files for downloading the ICON-D2 data, running ungrib and running metgrid.

icon-d2-grafmi-test.tar.gz

It looks like something funky is happening with GEOPT:

metgrid.log:

...
2023-04-14 11:18:36.698 --- DEBUG:         .      PRES SOIL_LEVE     SOILT     SOILM       GHT     GEOPT        TT  SOILM999  SOILM486  SOILM162  SOILM054  SOILM018  SOILM006  SOILM002  SOILM001  SOILT999  SOILT486  SOILT162  SOILT054  SOILT018  SOILT006  SOILT002  SOILT001  SKINTEMP   SOILHGT      PSFC        RH        VV        UU      PMSL 
2023-04-14 11:18:36.698 --- DEBUG:     20000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.698 --- DEBUG:     25000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.698 --- DEBUG:     30000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.698 --- DEBUG:     40000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.698 --- DEBUG:     50000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.698 --- DEBUG:     60000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:     70000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:     85000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:     95000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:     97500         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:    100000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:    200100         X         -         -         -         X         -         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:         1         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:         2         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:         6         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:        18         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:        54         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:       162         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:       486         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:      1458         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:    201300         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X 
...

metgrid.exe stderr/stdout:

...
WARNING: Entry in METGRID.TBL not found for field GEOPT. Default options will be used for this field!
...
 WRF_DEBUG: Warning DIM             4 , NAME num_metgrid_levels REDEFINED  by var GEOPT            12           11  in wrf_io.F90 line         2588
ERROR: Error in ext_pkg_write_field

Interestingly I did have success though when running with @WQadam's WPS:Support-for-DWD-suite-of-models from PR #220.

@WQadam
Copy link

WQadam commented Apr 15, 2023

I was having issues with this version when using the ICON-D2 dataset with pressure levels. I am not very familiar with WPS in general so I may be missing something obvious. The file I'm attaching has my namelists, run scripts and log files for downloading the ICON-D2 data, running ungrib and running metgrid.

icon-d2-grafmi-test.tar.gz

It looks like something funky is happening with GEOPT:

metgrid.log:

...
2023-04-14 11:18:36.698 --- DEBUG:         .      PRES SOIL_LEVE     SOILT     SOILM       GHT     GEOPT        TT  SOILM999  SOILM486  SOILM162  SOILM054  SOILM018  SOILM006  SOILM002  SOILM001  SOILT999  SOILT486  SOILT162  SOILT054  SOILT018  SOILT006  SOILT002  SOILT001  SKINTEMP   SOILHGT      PSFC        RH        VV        UU      PMSL 
2023-04-14 11:18:36.698 --- DEBUG:     20000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.698 --- DEBUG:     25000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.698 --- DEBUG:     30000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.698 --- DEBUG:     40000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.698 --- DEBUG:     50000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.698 --- DEBUG:     60000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:     70000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:     85000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:     95000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:     97500         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:    100000         X         -         -         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:    200100         X         -         -         -         X         -         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         X         - 
2023-04-14 11:18:36.699 --- DEBUG:         1         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:         2         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:         6         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:        18         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:        54         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:       162         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:       486         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:      1458         -         X         X         X         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         - 
2023-04-14 11:18:36.699 --- DEBUG:    201300         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         -         X 
...

metgrid.exe stderr/stdout:

...
WARNING: Entry in METGRID.TBL not found for field GEOPT. Default options will be used for this field!
...
 WRF_DEBUG: Warning DIM             4 , NAME num_metgrid_levels REDEFINED  by var GEOPT            12           11  in wrf_io.F90 line         2588
ERROR: Error in ext_pkg_write_field

Interestingly I did have success though when running with @WQadam's WPS:Support-for-DWD-suite-of-models from PR #220.

Looks like GEOPT is missing from the metgrid.tbl in this PR, hence why it worked in mine but not this one. GEOPT should be added to the metgrid table like HGTT is in the metgrid table.

@grafmi
Copy link
Contributor Author

grafmi commented Apr 15, 2023

Yes, it seems that I forgot to add the field GEOPT to the METGRID.TBL. Thanks for the hint @WQadam. @sael9740 Try to add the lines below to METGRID.TBL.ARW:

name=GEOPT
output=no
interp_option=nearest_neighbor
========================================

@sael9740
Copy link

sael9740 commented Apr 15, 2023

Yes, it seems that I forgot to add the field GEOPT to the METGRID.TBL. Thanks for the hint @WQadam. @sael9740 Try to add the lines below to METGRID.TBL.ARW:

name=GEOPT output=no interp_option=nearest_neighbor ========================================

@grafmi - This fixed the issue for me. Thanks for the help!

@WQadam
Copy link

WQadam commented Apr 16, 2023

I'm guessing it is alright to put GEOPT in the metgrid table like that. I see other vtables use GEOPT, mainly ecmwf. When running the EC and ERA5 models i see its needed to run calc_p_ecmwf before metgrid. I thought this was executable was mainly to calculate pressure which isnt needed for icon but i think this executable might also fill the lowest GEOPT level which metgrid is erroring on.
Basically not sure if by putting GEOPT in the metgrid table we have bypassed a wrf error check for the ECMWF and ERA models? I have run some ERA5 initialized wrf runs without needing to do calc_p_ecmwf and the output has seemed fine.

@weiwangncar
Copy link
Collaborator

weiwangncar commented Apr 20, 2023

@sael9740 There is no need to process GEOPT in metgrid since the model would not know what to do with it. The correct fix is to remove Geopotential in the row for GEOPT in Vtable.ICONp, like it is done in Vtable.ECMWF:

 129 | 100  |   *  |      | GEOPT    | m2 s-2  |                                         |  0  |  3  |  4  | 100 |
     | 100  |   *  |      | HGT      | m       | Height                                  |     |     |     | 100 |

The ungrib program knows to compute HGT from GEOPT and write only HGT out in the intermediate file. Can you give it a try?

@sael9740
Copy link

@weiwangncar - Ya sure. I'll try that now and get back with you.

@sael9740
Copy link

@sael9740 There is no need to process GEOPT in metgrid since the model would not know what to do with it. The correct fix is to remove Geopotential in the row for GEOPT in Vtable.ICONp, like it is done in Vtable.ECMWF:

 129 | 100  |   *  |      | GEOPT    | m2 s-2  |                                         |  0  |  3  |  4  | 100 |
     | 100  |   *  |      | HGT      | m       | Height                                  |     |     |     | 100 |

The ungrib program knows to compute HGT from GEOPT and write only HGT out in the intermediate file. Can you give it a try?

@weiwangncar - Yes this worked. Just to be clear I used a22c073 as is with the exception that I removed the GEOPT entry in the Vtable.ICONp:

129 | 100 | * | | GEOPT | m2 s-2 | Geopotential | 0 | 3 | 4 | 100 |

@weiwangncar
Copy link
Collaborator

@sael9740 @grafmi Thanks for trying.

@andrewsoong
Copy link

@grafmi Do you mind making your download script available for others?

@weiwangncar It's fine for me to make it available to others. Where should I provide it?

Is WPS-V4.5 suitable for handling ICON global forecast data?(Data is downloaded here:https://opendata.dwd.de/weather/nwp/icon/grib)
Thanks!

@WQadam
Copy link

WQadam commented Apr 24, 2023

@grafmi Do you mind making your download script available for others?

@weiwangncar It's fine for me to make it available to others. Where should I provide it?

Is WPS-V4.5 suitable for handling ICON global forecast data?(Data is downloaded here:https://opendata.dwd.de/weather/nwp/icon/grib) Thanks!

Yes it is! You have to do an additional step on download though to get it to a lat lon grid as WPS cant handle the icosahedral grid. Once set up the conversion is quick but can take a while to set up. I have run it from the model level version but i think you should be able to run it with the pressure levels aswell, however there isnt many pressure levels in the global model.

see helpful links here on how to regrid icon global -
https://www.dwd.de/DE/leistungen/opendata/help/modelle/Opendata_cdo_EN.pdf?__blob=publicationFile&v=3
https://github.com/DeutscherWetterdienst/regrid

@andrewsoong
Copy link

andrewsoong commented Apr 24, 2023

@grafmi Do you mind making your download script available for others?

@weiwangncar It's fine for me to make it available to others. Where should I provide it?

Is WPS-V4.5 suitable for handling ICON global forecast data?(Data is downloaded here:https://opendata.dwd.de/weather/nwp/icon/grib) Thanks!

Yes it is! You have to do an additional step on download though to get it to a lat lon grid as WPS cant handle the icosahedral grid. Once set up the conversion is quick but can take a while to set up. I have run it from the model level version but i think you should be able to run it with the pressure levels aswell, however there isnt many pressure levels in the global model.

see helpful links here on how to regrid icon global - https://www.dwd.de/DE/leistungen/opendata/help/modelle/Opendata_cdo_EN.pdf?__blob=publicationFile&v=3 https://github.com/DeutscherWetterdienst/regrid

Thank you so much!
Can you provide a script that can download global ICON model-level data for WRF?

@WQadam
Copy link

WQadam commented Apr 25, 2023

icon_download_modlv_global.txt

See the download file above that is a shell script. I have had to put it as a text file to put it onto github.

You will have to fill out the working directory and create your domain target text files and nc file by looking at the DWD help link in my previous comment.
Things to note are there is a few date variables that are set in the script and you will need to change these to your start and end date of the download. Plus the value in the time do loop sets how often the files are downloaded ie hourly, three hourly etc.
CDO needs to be installed aswell on the machine to use this script as it uses these commands.
Also i have only tested it for reasonable data using soil level 0 rather than 5 (0.5) which is supported by WPS 4.5 but in theory i dont think this will make a difference to the run data much unless you are looking at soil moisture and temperature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants