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

ungrib with Cray compiler

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
There is a problem running ungrib with the Cray compiler.

Specifically, not all of the 4 soil levels were picked up from the GFS
in ungrib.exe.

In rd_grib2.F, there is a block

if ((g2code(4,j) .eq. 106) .and.
& (gfld%ipdtmpl(2) .eq. g2code(3,j)) .and.
& (glevel1 .eq. level1(j)) .and.
& ((glevel2 .eq. level2(j)) .or.
& (level2(j) .le. -88))) then

In the Cray compiler, there is a small difference between (glevel1 and level1(j))
and (glevel2 and level2(j)) that not all 4 soil levels from GFS are picked up.

A small fix was applied:

if ((g2code(4,j) .eq. 106) .and.
& (gfld%ipdtmpl(2) .eq. g2code(3,j)) .and.
& (abs(glevel1-level1(j)) .lt. 0.001 ) .and.
& ((abs(glevel2-level2(j)) .lt. 0.001) .or.
& (level2(j) .le. -88))) then

Credit goes to Francois Thomas from HPE who fixed this.

There are also a few additional modifications. I have the new and
old code attached.

This may be worth putting in for the new release.

I presume we need to do the same thing for the grib1 version.


  • rd_grib2.F
    49.2 KB · Views: 12
  • rd_grib2_old.F
    49 KB · Views: 13