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 ungrib.exe on modified SST files

ejones

New member
Hi all,

I am working on a WRF simulation where I modify ERA5 SST boundary conditions and trying to replace the original, time-varying ones with SSTs that linearly dampen over time to a particular state that are then held constant over the rest of the simulation. I am using the pre-compiled WRF model on Cheyenne.

The issue I am running into is that after I make the modification from the original GRIB file, I use the cfgrib package in Python to write the modified dataset to a GRIB file, but it is a GRIB2 file, while the original was GRIB1. I can’t find a way to write it to GRIB1 directly from that package. Then I tried just converting the GRIB2 file to GRIB1 format, but that was giving me issues as well. I also tried doing ungrib.exe separately for the SSTs but it could not find the times for some reason?

Lastly, I was trying to look into a way to just avoid using ungrib.exe by writing a netCDF of the modified SSTs to an intermediate file (see https://www2.mmm.ucar.edu/wrf/src/netcdf-to-intermediate.f) but I’m not super familiar with fortran code. That seems like a more complicated route versus just using a GRIB file and using ungrib.exe, but it sounds like doing it from nc to intermediate files has worked for some in the past.

I know some previous posts have been made about both using ungrib.exe on different GRIB file types ((RESOLVED) ungrib treats grib2 data as grib1) as well as using netCDF to intermediate files as the boundary conditions (NetCDF as input and Error to compile netcdf-to-intermediate.f program).

Would there be an easier/better way to go about this? Thank you for any insight you have!

Sincerely,
Evan
 
After some more thinking/emailing around, one suggestion made to me is to just modify the met_em files themselves, since they are netcdf and would be easier to work with. Would that be a potential pathway that could work for what I am trying to do? Thanks!
 
Hi Evan,
I do believe it would likely be a much easier path to simply modify the met_em* files, if you are able to figure out a way to modify them the way you want them. Let us know if that works out for you, and if there are any suggestions you would make to anyone else wanting to do something similar in the future!
 
Hi, thanks so much for your answer--yes, it is much simpler and easier to modify the met_em files, and I was able to successfully run a simulation using those modified met_em files. I did not look further into the GRIB file modifications (I'm sure there is a way, but it does seem overly complicated). Thanks again!
 
Top