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

ERROR with Intermediate Files for SST Update

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.


New member
Hi MPAS Community

I am having issues with intermediate files when trying to generate the file in MPAS 7.

I think the issue stems from when I had to convert the CFSR grib2 files into netcdf to replace SSTs over the Pacific with averages. I then converted the netcdf file into grib2 and then into intermediate format. And now it gives me issues with regards to Gaussian Latitude Computation.

I created the intermediate files using ungrib.exe and changed the pole_lat from 90.00 to 89.7610 in the namelist.wps file hoping it will resolve the issue.
I am not sure what else to do in this case.

Attached is the namelist for ungrib.exe and the Model log file. I have also attached the manipulated grib2 file (please remove the txt extension, I only put it there so it can be attached to this message).

Kind Regards
Linda Maoyi


  • namelist.wps
    853 bytes · Views: 55
  • log.init_atmosphere.0000.err.txt
    629 bytes · Views: 58
  • 198301010000.flxf06.gdas.19821226-19821231.grb2.txt
    4.8 MB · Views: 59
This looks like it may be due to a bug in the ungrib.exe program. When I check the "startlat" value in the header of your GRIB2 file, I'm seeing a value of -89760992.000000, which looks like the correct starting latitude scaled by 1e6. If I'm understanding the GRIB2 format specification correctly (see, e.g., this NCEP documentation), that seems correct unless an alternate "basic angle" value is provided.

In the ungrib/src/rd_grib2.F source file from ungrib.exe around line 494, we have the following code:
              ! Scale lat/lon values to 0-180, default range is 1e6.
              if ( then
                 map%lat1 = map%lat1/scale_factor
This works as long as the starting latitude is positive, but if the starting latitude is negative, no scaling will occur.

I think it should work to change the code in ungrib/src/rd_grib2.F to look like the following:
              ! Scale lat/lon values to 0-180, default range is 1e6.
              if (abs(map%lat1).ge.scale_factor) then
                 map%lat1 = map%lat1/scale_factor
Essentially, we just compare the absolute value of "lat1" with the scale factor.
Many thanks Michael

I have implemented the changes on rd_grib2.F and it works well now.

Kind regards
Linda Maoyi
That's good to hear, and thanks so much for following up! I've opened an issue (#142) in the WPS repository so that we can track this bug and get it fixed in the next release.