Skip to content

Commit

Permalink
Add some error handling for surface g2 data reads.
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGayno-NOAA committed Nov 3, 2021
1 parent 7b87671 commit a4072e7
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions sorc/chgres_cube.fd/input_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5690,7 +5690,9 @@ subroutine read_input_sfc_grib2_file(localpet)
dummy2d(:,:) = 0.0_esmf_kind_r4
endif
endif

call check_cnwat(dummy2d)

dummy2d_8= real(dummy2d,esmf_kind_r8)
print*,'wgrib2 cnwat ',maxval(dummy2d),minval(dummy2d)

Expand All @@ -5705,8 +5707,11 @@ subroutine read_input_sfc_grib2_file(localpet)
call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, &
unpack, k, gfld, rc)

if (rc /= 0 ) call error_handler("READING CNWAT", rc)
print*,'getgb2 cnwat ', maxval(gfld%fld),minval(gfld%fld)
if (rc /= 0 ) then
print*, "getgb2 did not find cnwat in file."
else
print*,'getgb2 cnwat ', maxval(gfld%fld),minval(gfld%fld)
endif

endif

Expand Down Expand Up @@ -5749,9 +5754,12 @@ subroutine read_input_sfc_grib2_file(localpet)
call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, &
unpack, k, gfld, rc)

gfld%fld = gfld%fld * 10.0 ! Grib files have z0 (m), but fv3 expects z0(cm)
if (rc /= 0 ) call error_handler("READING SFCR", rc)
print*,'getgb2 sfcr ', maxval(gfld%fld),minval(gfld%fld)
if (rc /= 0 ) then
print*, "getgb2 did not find sfcr in file."
else
gfld%fld = gfld%fld * 10.0 ! Grib files have z0 (m), but fv3 expects z0(cm)
print*,'getgb2 sfcr ', maxval(gfld%fld),minval(gfld%fld)
endif

endif

Expand Down Expand Up @@ -5842,11 +5850,11 @@ subroutine read_input_sfc_grib2_file(localpet)
call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, &
unpack, k, gfld, rc)

if (rc /= 0 ) call error_handler("READING VGTYP", rc)
print*,'getgb2 vgtyp ', maxval(gfld%fld),minval(gfld%fld)



if (rc /= 0 ) then
print*,'getgb2 could not find vgtyp'
else
print*,'getgb2 vgtyp ', maxval(gfld%fld),minval(gfld%fld)
endif

if (trim(external_model) .ne. "GFS") then
do j = 1, j_input
Expand Down

0 comments on commit a4072e7

Please sign in to comment.