From 3cf645e949e721abe180cc645c1a87dcb059db17 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Tue, 24 May 2022 14:37:34 +0000 Subject: [PATCH 01/16] Add logic to check if grib2 file is NCEP/GEFS data. If so, set the product template number accordingly. Fixes #651. --- sorc/chgres_cube.fd/input_data.F90 | 56 +++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index ed7f60cd0..48e875035 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -2476,7 +2476,7 @@ subroutine read_input_atm_grib2_file(localpet) integer :: i, j, k, n integer :: ii,jj integer :: rc, clb(3), cub(3) - integer :: vlev, iret,varnum, o3n + integer :: vlev, iret,varnum, o3n, pdt_num integer :: intrp_ier, done_print integer :: trac_names_oct10(ntrac_max) integer :: tracers_input_oct10(num_tracers_input) @@ -2545,12 +2545,29 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! Array of values in identification section, set to wildcard jgdt = -9999 ! Array of values in grid definition template, set to wildcard jgdtn = -1 ! Search for any grid definition number. - jpdtn = 0 ! Search for product def template number 0 - anl or fcst. + jpdtn = -1 ! Search for product def template number 0 - anl or fcst. + unpack =.false. + + call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & + unpack, k, gfld, iret) + + if (iret == 0) then + if (gfld%idsect(1) == 7 .and. gfld%idsect(2) == 2) then + print*,'- THIS IS NCEP GEFS DATA.' + pdt_num = 1 + else + pdt_num = 0 + endif + else + call abort + endif ! First, check for the vertical coordinate. If temperture at the 10 hybrid ! level is found, hybrid coordinates are assumed. Otherwise, data is on ! isobaric levels. + j = 0 + jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. jpdt(1) = 0 ! Sect4/oct 10 - param category - temperature field jpdt(2) = 0 ! Sect4/oct 11 - param number - temperature jpdt(10) = 105 ! Sect4/oct 23 - type of level - hybrid @@ -2561,6 +2578,9 @@ subroutine read_input_atm_grib2_file(localpet) unpack, k, gfld, iret) if (iret == 0) then ! data is on hybrid levels + print*,'hybrid temp found at ',j,k,maxval(gfld%fld),minval(gfld%fld) + print*,'hybrid temp pdt num ',gfld%ipdtnum + print*,'hybrid temp pdt ',gfld%ipdtmpl octet23 = 105 octet29 = 255 isnative=.true. @@ -2568,6 +2588,8 @@ subroutine read_input_atm_grib2_file(localpet) octet23 = 100 octet29 = 255 endif + + print*,'cggg after check of temp ',iret, octet23,octet29,isnative ! Now count the number of vertical levels by searching for u-wind. ! Store the value of each level. @@ -2582,10 +2604,15 @@ subroutine read_input_atm_grib2_file(localpet) call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & unpack, k, gfld, iret) +! print*,'in loop ',iret,j,k +! print*,'in loop2 ',gfld%ipdtmpl(1:13) + print*,'in loop idsect ',gfld%idsect + if (iret /= 0) exit + if (gfld%discipline == 0) then ! Discipline - meteorological products - if (gfld%ipdtnum == 0) then ! Product definition template number - + if (gfld%ipdtnum == 0 .or. gfld%ipdtnum == 1) then ! Product definition template number - ! analysis or forecast at single level. if (gfld%ipdtmpl(1) == 2 .and. gfld%ipdtmpl(2) == 2) then ! u-wind ! Sect4/octs 10 and 11. @@ -2608,6 +2635,7 @@ subroutine read_input_atm_grib2_file(localpet) call mpi_barrier(MPI_COMM_WORLD, iret) call MPI_BCAST(isnative,1,MPI_LOGICAL,0,MPI_COMM_WORLD,iret) call MPI_BCAST(lev_input,1,MPI_INTEGER,0,MPI_COMM_WORLD,iret) + call MPI_BCAST(pdt_num,1,MPI_INTEGER,0,MPI_COMM_WORLD,iret) call MPI_BCAST(rlevs_hold, max_levs, MPI_INTEGER,0,MPI_COMM_WORLD,iret) allocate(slevs(lev_input)) @@ -2636,6 +2664,7 @@ subroutine read_input_atm_grib2_file(localpet) enddo if(localpet == 0) then + print*,'cggg found this number of levels ',lev_input do i = 1,lev_input print*, "- LEVEL AFTER SORT = ",trim(slevs(i)) enddo @@ -2869,7 +2898,7 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = 0 ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. jpdt(1) = 0 ! Sect 4/oct 10 - param category - temperature jpdt(2) = 0 ! Sect 4/oct 11 - param number - temperature @@ -2928,7 +2957,7 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = 0 ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. unpack = .false. if (isnative) then jpdt(10) = 105 ! Sect4/oct 23 - type of level - hybrid @@ -3068,7 +3097,7 @@ subroutine read_input_atm_grib2_file(localpet) deallocate(dummy3d_col_in, dummy3d_col_out) - call read_winds(u_tmp_3d,v_tmp_3d,localpet,isnative,rlevs,lugb) + call read_winds(u_tmp_3d,v_tmp_3d,localpet,isnative,rlevs,lugb,pdt_num) if (localpet == 0) print*,"- CALL FieldScatter FOR INPUT U-WIND." call ESMF_FieldScatter(u_input_grid, u_tmp_3d, rootpet=0, rc=rc) @@ -3089,7 +3118,7 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = 0 ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. jpdt(1) = 3 ! Sect4/oct 10 - param category - mass jpdt(2) = 0 ! Sect4/oct 11 - param number - pressure jpdt(10) = 1 ! Sect4/oct 23 - type of level - ground surface @@ -3123,7 +3152,7 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = 0 ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. jpdt(1) = 2 ! Sect4/oct 10 - param category - momentum jpdt(2) = 9 ! Sect4/oct 11 - param number - dzdt @@ -3184,7 +3213,7 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = 0 ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. jpdt(1) = 3 ! Sect4/oct 10 - param category - mass jpdt(2) = 5 ! Sect4/oct 11 - param number - geopotential height jpdt(10) = 1 ! Sect4/oct 23 - type of level - ground surface @@ -3304,7 +3333,7 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = 0 ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. jpdt(1) = 3 ! Sect4/oct 10 - param category - mass jpdt(2) = 0 ! Sect4/oct 11 - param number - pressure jpdt(10) = 105 ! Sect4/oct 23 - type of level - hybrid @@ -6772,8 +6801,9 @@ END SUBROUTINE READ_FV3_GRID_DATA_NETCDF !! data is on isobaric levels. !! @param[in] rlevs Array of atmospheric level values !! @param[in] lugb Logical unit number of GRIB2 file. +!! @param[in] pdt_num Product definition template number. !! @author Larissa Reames - subroutine read_winds(u,v,localpet,isnative,rlevs,lugb) + subroutine read_winds(u,v,localpet,isnative,rlevs,lugb,pdt_num) use grib_mod use program_setup, only : get_var_cond @@ -6784,6 +6814,8 @@ subroutine read_winds(u,v,localpet,isnative,rlevs,lugb) logical, intent(in) :: isnative + integer, intent(in) :: pdt_num + real(esmf_kind_r8), intent(inout), allocatable :: u(:,:,:),v(:,:,:) real(esmf_kind_r8), intent(in), dimension(lev_input) :: rlevs @@ -6842,7 +6874,7 @@ subroutine read_winds(u,v,localpet,isnative,rlevs,lugb) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = 0 ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. unpack=.false. call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & From 2945061453329f2b2d531ff0085a524c7e4b8008 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Tue, 24 May 2022 19:53:44 +0000 Subject: [PATCH 02/16] Add logic to surface read routine for GEFS grib2 data. Fixes #651. --- sorc/chgres_cube.fd/input_data.F90 | 75 ++++++++++++++++++------------ 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index 48e875035..b9a658eaa 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -2612,7 +2612,7 @@ subroutine read_input_atm_grib2_file(localpet) if (gfld%discipline == 0) then ! Discipline - meteorological products - if (gfld%ipdtnum == 0 .or. gfld%ipdtnum == 1) then ! Product definition template number - + if (gfld%ipdtnum == pdt_num) then ! Product definition template number - ! analysis or forecast at single level. if (gfld%ipdtmpl(1) == 2 .and. gfld%ipdtmpl(2) == 2) then ! u-wind ! Sect4/octs 10 and 11. @@ -5046,7 +5046,7 @@ subroutine read_input_sfc_grib2_file(localpet) integer :: rc, varnum, iret, i, j,k integer :: ncid2d, varid, varsize integer :: lugb, lugi - integer :: jdisc, jgdtn, jpdtn + integer :: jdisc, jgdtn, jpdtn, pdt_num integer :: jids(200), jgdt(200), jpdt(200) logical :: rap_latlon, unpack @@ -5087,7 +5087,23 @@ subroutine read_input_sfc_grib2_file(localpet) jpdt = -9999 ! array of values in product definition template, set to wildcard unpack = .false. ! unpack data + call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & + unpack, k, gfld, rc) + + if (rc == 0) then + if (gfld%idsect(1) == 7 .and. gfld%idsect(2) == 2) then + print*,'- THIS IS NCEP GEFS DATA.' + pdt_num = 1 + else + pdt_num = 0 + endif + else + call abort + endif + + j = 0 lsoil_input = 0 + do call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & @@ -5096,7 +5112,7 @@ subroutine read_input_sfc_grib2_file(localpet) if (rc /= 0) exit if (gfld%discipline == 2) then ! discipline - land products - if (gfld%ipdtnum == 0) then ! prod template number - analysis or forecast at single level. + if (gfld%ipdtnum == pdt_num) then ! prod template number - analysis or forecast at single level. if (gfld%ipdtmpl(1) == 0 .and. gfld%ipdtmpl(2) == 2) then ! soil temp ! Sect4/octs 10 and 11 if (gfld%ipdtmpl(10) == 106 .and. gfld%ipdtmpl(13) == 106) then ! Sect4/octs 23/29. @@ -5184,7 +5200,7 @@ subroutine read_input_sfc_grib2_file(localpet) j = 0 jdisc = 0 ! Search for discipline 0 - meteorological products jpdt = -9999 ! array of values in product definition template, set to wildcard. - jpdtn = 0 ! search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! search for product definition template number 0 - anl or fcst. jpdt(1) = 3 ! Sec4/oct 10 - param cat - mass field jpdt(2) = 5 ! Sec4/oct 11 - param number - geopotential height jpdt(10) = 1 ! Sec4/oct 23 - type of level - ground surface @@ -5209,7 +5225,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 10 ! Search for discipline - ocean products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. jpdt = -9999 ! Array of values in Sec 4 product definition template; ! Initialize to wildcard. jpdt(1) = 2 ! Sec4/oct 10 - parameter category - ice @@ -5245,7 +5261,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template - Sec 4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 218 ! Sec4/oct 11 - parameter number - land nearest neighbor @@ -5261,7 +5277,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template - Sec 4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 0 ! Sec4/oct 11 - parameter number - land cover (fraction) @@ -5302,7 +5318,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 0 ! Sec4/oct 10 - parameter category - temperature jpdt(2) = 0 ! Sec4/oct 11 - parameter number - temperature @@ -5335,7 +5351,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 1 ! Sec4/oct 10 - parameter category - moisture jpdt(2) = 13 ! Sec4/oct 11 - parameter number - liquid equiv snow depth @@ -5369,7 +5385,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 1 ! Sec4/oct 10 - parameter category - moisture jpdt(2) = 11 ! Sec4/oct 11 - parameter number - snow depth @@ -5406,7 +5422,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 0 ! Sec4/oct 10 - parameter category - temperature jpdt(2) = 0 ! Sec4/oct 11 - parameter number - temperature @@ -5435,7 +5451,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 1 ! Sec4/oct 10 - parameter category - moisture jpdt(2) = 0 ! Sec4/oct 11 - parameter number - specific humidity @@ -5464,7 +5480,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 0 ! Sec4/oct 10 - parameter category - temperature jpdt(2) = 0 ! Sec4/oct 11 - parameter number - temperature @@ -5516,7 +5532,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 0 ! Search at beginning of file - jpdtn = 0 ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 3 ! Sec4/oct 10 - parameter category - soil products jpdt(2) = 0 ! Sec4/oct 11 - parameter number - soil type @@ -5649,7 +5665,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 4 ! Sec4/oct 11 - parameter number - vegetation @@ -5687,7 +5703,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 1105 ! grib2 file does not distinguish between the various veg ! fractions. Need to search using record number. - jpdtn = 0 ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 4 ! Sec4/oct 11 - parameter number - vegetation @@ -5727,7 +5743,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 1106 ! Have to search by record number. - jpdtn = 0 ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 4 ! Sec4/oct 11 - parameter number - vegetation @@ -5770,7 +5786,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 7 ! Sec4/oct 10 - parameter category - thermo stability indices jpdt(2) = 198 ! Sec4/oct 11 - parameter number - leaf area index @@ -5805,7 +5821,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 10 ! Search for discipline - ocean products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 2 ! Sec4/oct 10 - parameter category - ice jpdt(2) = 1 ! Sec4/oct 11 - parameter number - thickness @@ -5901,7 +5917,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = 0 ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 2 ! Sec4/oct 10 - parameter category - momentum jpdt(2) = 30 ! Sec4/oct 11 - parameter number - friction velocity @@ -5973,7 +5989,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 0 ! Search from beginning of file - jpdtn = 0 ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 13 ! Sec4/oct 11 - parameter number - canopy water @@ -6020,7 +6036,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 0 ! Search from beginning of file. - jpdtn = 0 ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 1 ! Sec4/oct 11 - parameter number - surface roughness @@ -6055,7 +6071,7 @@ subroutine read_input_sfc_grib2_file(localpet) print*,"- READ LIQUID SOIL MOISTURE." vname = "soill" vname_file = ":SOILL:" - call read_grib_soil(vname,vname_file,lugb, dummy3d) !!! NEED TO HANDLE + call read_grib_soil(vname,vname_file,lugb, pdt_num,dummy3d) !!! NEED TO HANDLE !!! SOIL LEVELS endif @@ -6068,7 +6084,7 @@ subroutine read_input_sfc_grib2_file(localpet) print*,"- READ TOTAL SOIL MOISTURE." vname = "soilw" vname_file = "var2_2_1_" ! the var number instead - call read_grib_soil(vname,vname_file,lugb,dummy3d) + call read_grib_soil(vname,vname_file,lugb, pdt_num,dummy3d) endif print*,"- CALL FieldScatter FOR INPUT TOTAL SOIL MOISTURE." @@ -6093,7 +6109,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 0 ! Search from beginning of file. - jpdtn = 0 ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 198 ! Sec4/oct 11 - parameter number - vegetation type @@ -6170,7 +6186,7 @@ subroutine read_input_sfc_grib2_file(localpet) print*,"- READ SOIL TEMPERATURE." vname = "soilt" vname_file = ":TSOIL:" - call read_grib_soil(vname,vname_file,lugb,dummy3d) + call read_grib_soil(vname,vname_file,lugb,pdt_num,dummy3d) call check_soilt(dummy3d,slmsk_save,tsk_save) deallocate(tsk_save) endif @@ -7213,9 +7229,10 @@ end subroutine handle_grib_error !! @param [in] vname variable name in varmap table !! @param [in] vname_file variable name in grib2 file !! @param [in] lugb logical unit number for surface grib2 file +!! @param [in] pdt_num product definition template number. !! @param [inout] dummy3d array of soil data !! @author George Gayno NCEP/EMC - subroutine read_grib_soil(vname, vname_file, lugb, dummy3d) + subroutine read_grib_soil(vname, vname_file, lugb, pdt_num, dummy3d) use grib_mod @@ -7223,7 +7240,7 @@ subroutine read_grib_soil(vname, vname_file, lugb, dummy3d) character(len=20), intent(in) :: vname,vname_file - integer, intent(in) :: lugb + integer, intent(in) :: lugb, pdt_num real(esmf_kind_r8), intent(inout) :: dummy3d(:,:,:) @@ -7266,7 +7283,7 @@ subroutine read_grib_soil(vname, vname_file, lugb, dummy3d) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template 3.m jgdtn = -1 ! search for any grid definition number. - jpdtn = 0 ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. jpdt(1) = 0 ! oct 10 - param cat - veg/biomass if (trim(vname) == 'soilt') jpdt(2) = 2 ! oct 11 - param number - soil temp if (trim(vname) == 'soilw') jpdt(2) = 192 ! oct 11 - param number - total soilm From 567519a9426fa956ec6e2a6db611199562daf3f3 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Tue, 24 May 2022 20:21:16 +0000 Subject: [PATCH 03/16] Minor fix. Fixes #651. --- sorc/chgres_cube.fd/input_data.F90 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index b9a658eaa..44320c5c6 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -2598,6 +2598,7 @@ subroutine read_input_atm_grib2_file(localpet) lev_input = 0 iret = 0 j = 0 + jpdtn = -1 jpdt = -9999 do @@ -2674,6 +2675,7 @@ subroutine read_input_atm_grib2_file(localpet) if (localpet == 0) then + jpdtn = pdt_num jpdt = -9999 jpdt(1) = 1 ! Sect4/oct 10 - param category - moisture jpdt(2) = 0 ! Sect4/oct 11 - param number - specific humidity @@ -2740,6 +2742,7 @@ subroutine read_input_atm_grib2_file(localpet) if (localpet == 0) then + jpdtn = pdt_num jpdt = -9999 if (isnative) then jpdt(10) = 105 ! Sect4/oct 23 - type of level - hybrid From 0d34ff29095a9aea0a4010c031871f9e4423765c Mon Sep 17 00:00:00 2001 From: George Gayno Date: Tue, 24 May 2022 20:54:11 +0000 Subject: [PATCH 04/16] Remove some diagnostic print that cause unit test failures. Fixes #651. --- sorc/chgres_cube.fd/input_data.F90 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index 44320c5c6..d8fec988d 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -2605,13 +2605,8 @@ subroutine read_input_atm_grib2_file(localpet) call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & unpack, k, gfld, iret) -! print*,'in loop ',iret,j,k -! print*,'in loop2 ',gfld%ipdtmpl(1:13) - print*,'in loop idsect ',gfld%idsect - if (iret /= 0) exit - if (gfld%discipline == 0) then ! Discipline - meteorological products if (gfld%ipdtnum == pdt_num) then ! Product definition template number - ! analysis or forecast at single level. From 32e5ba7a9578f91d803272e0f12d12389a0cb623 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Mon, 6 Jun 2022 19:47:09 +0000 Subject: [PATCH 05/16] Add regression test for GEFS GRIB2 data. Fixes #651. --- reg_tests/chgres_cube/c96.gefs.grib2.sh | 77 +++++++++++++++++++ reg_tests/chgres_cube/driver.wcoss_dell_p3.sh | 11 ++- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100755 reg_tests/chgres_cube/c96.gefs.grib2.sh diff --git a/reg_tests/chgres_cube/c96.gefs.grib2.sh b/reg_tests/chgres_cube/c96.gefs.grib2.sh new file mode 100755 index 000000000..20aa61a0a --- /dev/null +++ b/reg_tests/chgres_cube/c96.gefs.grib2.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# Invoke chgres to create C96 coldstart files using GEFS GRIB2 data +# as input. The coldstart files are then compared to baseline files +# using the 'nccmp' utility. This script is run by the machine specific +# driver script. +#----------------------------------------------------------------------------- + +set -x + +export DATA=$OUTDIR/c96_gefs_grib2 +rm -fr $DATA + +export CRES=96 +export FIXfv3=${HOMEreg}/fix/C96 +export COMIN=${HOMEreg}/input_data.gefs/gefs.grib2 + +export GRIB2_FILE_INPUT=gep02.t06z.pgrb2abf06 +export VCOORD_FILE=${HOMEufs}/fix/fix_am/global_hyblev.l65.txt +export VARMAP_FILE=${HOMEufs}/parm/varmap_tables/GFSphys_var_map.txt +export INPUT_TYPE='grib2' +export CONVERT_NST=".false." + +export CDATE=2020082506 + +export OMP_NUM_THREADS_CH=${OMP_NUM_THREADS:-1} + +NCCMP=${NCCMP:-$(which nccmp)} + +#----------------------------------------------------------------------------- +# Invoke chgres program. +#----------------------------------------------------------------------------- + +echo "Starting at: " `date` + +${HOMEufs}/ush/chgres_cube.sh + +iret=$? +if [ $iret -ne 0 ]; then + set +x + echo "<<< C96 GEFS GRIB2 TEST FAILED. <<<" + exit $iret +fi + +echo "Ending at: " `date` + +#----------------------------------------------------------------------------- +# Compare output from chgres to baseline set of data. +#----------------------------------------------------------------------------- + +cd $DATA + +test_failed=0 +for files in *.nc +do + if [ -f $files ]; then + echo CHECK $files + $NCCMP -dmfqS $files $HOMEreg/baseline_data/c96_gefs_grib2/$files + iret=$? + if [ $iret -ne 0 ]; then + test_failed=1 + fi + fi +done + +set +x +if [ $test_failed -ne 0 ]; then + echo "<<< C96 GEFS GRIB2 TEST FAILED. >>>" + if [ "$UPDATE_BASELINE" = "TRUE" ]; then + $HOMEufs/reg_tests/update_baseline.sh $HOMEreg "c96_gefs_grib2" $commit_num + fi +else + echo "<<< C96 GEFS GRIB2 TEST PASSED. >>>" +fi + +exit 0 diff --git a/reg_tests/chgres_cube/driver.wcoss_dell_p3.sh b/reg_tests/chgres_cube/driver.wcoss_dell_p3.sh index 6f4e8e821..126b415b6 100755 --- a/reg_tests/chgres_cube/driver.wcoss_dell_p3.sh +++ b/reg_tests/chgres_cube/driver.wcoss_dell_p3.sh @@ -49,7 +49,7 @@ fi export HOMEufs=$PWD/../.. -export HOMEreg=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/ufs_utils.git/reg_tests/chgres_cube +export HOMEreg=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/ufs_utils.git/reg_tests.test/chgres_cube SUM_FILE=summary.log @@ -205,6 +205,15 @@ export OMP_NUM_THREADS=1 bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J chgres16 -W 0:05 -x -n 6 \ -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/25km.conus.gfs.pbgrib2.sh" +#----------------------------------------------------------------------------- +# Initialize C96 USING GEFS GRIB2 files. +#----------------------------------------------------------------------------- + +LOG_FILE=consistency.log17 +export OMP_NUM_THREADS=1 +bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J chgres17 -W 0:05 -x -n 6 \ + -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/c96.gefs.grib2.sh" + #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- From 1e6a910bc9f8f867c3a54dc993400acfc2ad01d4 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Tue, 14 Jun 2022 14:54:02 -0500 Subject: [PATCH 06/16] Update regression test on Orion. Fixes #651. --- reg_tests/chgres_cube/c96.gefs.grib2.sh | 6 ++++-- reg_tests/chgres_cube/driver.orion.sh | 11 ++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/reg_tests/chgres_cube/c96.gefs.grib2.sh b/reg_tests/chgres_cube/c96.gefs.grib2.sh index 20aa61a0a..3b2823252 100755 --- a/reg_tests/chgres_cube/c96.gefs.grib2.sh +++ b/reg_tests/chgres_cube/c96.gefs.grib2.sh @@ -14,13 +14,15 @@ rm -fr $DATA export CRES=96 export FIXfv3=${HOMEreg}/fix/C96 -export COMIN=${HOMEreg}/input_data.gefs/gefs.grib2 +export COMIN=${HOMEreg}/input_data/gefs.grib2 -export GRIB2_FILE_INPUT=gep02.t06z.pgrb2abf06 +export GRIB2_FILE_INPUT=gec00.t06z.pgrb2abf00 export VCOORD_FILE=${HOMEufs}/fix/fix_am/global_hyblev.l65.txt export VARMAP_FILE=${HOMEufs}/parm/varmap_tables/GFSphys_var_map.txt export INPUT_TYPE='grib2' export CONVERT_NST=".false." +export TRACERS_TARGET='"sphum","liq_wat","o3mr"' +export TRACERS_INPUT='"spfh","clwmr","o3mr"' export CDATE=2020082506 diff --git a/reg_tests/chgres_cube/driver.orion.sh b/reg_tests/chgres_cube/driver.orion.sh index bfa1c543c..66de8b85b 100755 --- a/reg_tests/chgres_cube/driver.orion.sh +++ b/reg_tests/chgres_cube/driver.orion.sh @@ -213,13 +213,22 @@ export OMP_NUM_THREADS=1 # should match cpus-per-task TEST16=$(sbatch --parsable --ntasks-per-node=12 --nodes=1 --mem=75G -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.pbgrib2 \ --open-mode=append -o $LOG_FILE16 -e $LOG_FILE16 ./25km.conus.gfs.pbgrib2.sh) +#----------------------------------------------------------------------------- +# Initialize C96 using GEFS GRIB2 file. +#----------------------------------------------------------------------------- + +LOG_FILE17=${LOG_FILE}17 +export OMP_NUM_THREADS=1 # needs to match cpus-per-task +TEST17=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 --mem=75G -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c96.gefs.grib2 \ + --open-mode=append -o $LOG_FILE17 -e $LOG_FILE17 ./c96.gefs.grib2.sh) + #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE \ - -d afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16 << EOF + -d afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16:$TEST17 << EOF #!/bin/bash grep -a '<<<' ${LOG_FILE}* > $SUM_FILE EOF From da9a3f4b288f4b6d2030250915603cb6ab901e09 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Tue, 14 Jun 2022 20:21:43 +0000 Subject: [PATCH 07/16] Add new regression test to Hera driver script. Fixes #651. --- reg_tests/chgres_cube/driver.hera.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/reg_tests/chgres_cube/driver.hera.sh b/reg_tests/chgres_cube/driver.hera.sh index d95cbadf9..d7a42a80a 100755 --- a/reg_tests/chgres_cube/driver.hera.sh +++ b/reg_tests/chgres_cube/driver.hera.sh @@ -209,13 +209,22 @@ export OMP_NUM_THREADS=1 # should match cpus-per-task TEST16=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.pbgrib2.conus \ -o $LOG_FILE -e $LOG_FILE ./25km.conus.gfs.pbgrib2.sh) +#----------------------------------------------------------------------------- +# Initialize global C96 using GEFS GRIB2 files. +#----------------------------------------------------------------------------- + +LOG_FILE=consistency.log17 +export OMP_NUM_THREADS=1 # should match cpus-per-task +TEST17=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c96.gefs.grib2 \ + -o $LOG_FILE -e $LOG_FILE ./c96.gefs.grib2.sh) + #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- LOG_FILE=consistency.log sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE -d\ - afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16 << EOF + afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16:$TEST17 << EOF #!/bin/bash grep -a '<<<' $LOG_FILE* > $SUM_FILE EOF From 65357f1f5f9139840fa75faf7766ed137276303c Mon Sep 17 00:00:00 2001 From: George Gayno Date: Tue, 14 Jun 2022 21:01:40 +0000 Subject: [PATCH 08/16] Add comments and clean up. Fixes #651. --- sorc/chgres_cube.fd/input_data.F90 | 39 ++++++++++++++++++------------ 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index d8fec988d..764c3d200 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -2545,21 +2545,30 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! Array of values in identification section, set to wildcard jgdt = -9999 ! Array of values in grid definition template, set to wildcard jgdtn = -1 ! Search for any grid definition number. - jpdtn = -1 ! Search for product def template number 0 - anl or fcst. + jpdtn = -1 ! Search for any product definition template number. unpack =.false. call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & unpack, k, gfld, iret) +! Read first record and check if this is NCEP GEFS data. +! This will determine what product definition template number to +! search for (Section 4/Octets 8-9). +! +! Section 1/Octets 6-7 is '7' (NCEP) +! Section 1/Octets 8-9 is '2' (NCEP Ensemble products). + if (iret == 0) then if (gfld%idsect(1) == 7 .and. gfld%idsect(2) == 2) then print*,'- THIS IS NCEP GEFS DATA.' - pdt_num = 1 + pdt_num = 1 ! Search for product definition template number 1. + ! Individual ensember forecast. else - pdt_num = 0 + pdt_num = 0 ! Search for product definition template number 0. + ! Analysis or forecast. endif else - call abort + call error_handler("READING GRIB2 FILE", iret) endif ! First, check for the vertical coordinate. If temperture at the 10 hybrid @@ -2567,7 +2576,7 @@ subroutine read_input_atm_grib2_file(localpet) ! isobaric levels. j = 0 - jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the specific product definition template number. jpdt(1) = 0 ! Sect4/oct 10 - param category - temperature field jpdt(2) = 0 ! Sect4/oct 11 - param number - temperature jpdt(10) = 105 ! Sect4/oct 23 - type of level - hybrid @@ -2577,19 +2586,17 @@ subroutine read_input_atm_grib2_file(localpet) call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & unpack, k, gfld, iret) - if (iret == 0) then ! data is on hybrid levels - print*,'hybrid temp found at ',j,k,maxval(gfld%fld),minval(gfld%fld) - print*,'hybrid temp pdt num ',gfld%ipdtnum - print*,'hybrid temp pdt ',gfld%ipdtmpl - octet23 = 105 - octet29 = 255 + if (iret == 0) then + print*,'- DATA IS ON HYBRID LEVELS.' + octet23 = 105 ! Section 4/Oct 23 - type of first fixed surface. + octet29 = 255 ! Section 4/Oct 29 - type of second fixed surface (N/A). isnative=.true. - else ! data is on isobaric levels - octet23 = 100 - octet29 = 255 + else + print*,'- DATA IS ON ISOBARIC LEVELS.' + octet23 = 100 ! Section 4/Oct 23 - type of first fixed surface. + octet29 = 255 ! Section 4/Oct 29 - type of second fixed surface (N/A). + isnative=.false. endif - - print*,'cggg after check of temp ',iret, octet23,octet29,isnative ! Now count the number of vertical levels by searching for u-wind. ! Store the value of each level. From 999e3a70057ef1522177fd9113944aba531b5926 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Wed, 15 Jun 2022 14:49:09 +0000 Subject: [PATCH 09/16] Update Jet driver script for new regression test. Fixes #651. --- reg_tests/chgres_cube/driver.jet.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/reg_tests/chgres_cube/driver.jet.sh b/reg_tests/chgres_cube/driver.jet.sh index 4b7a29786..813f13cfe 100755 --- a/reg_tests/chgres_cube/driver.jet.sh +++ b/reg_tests/chgres_cube/driver.jet.sh @@ -210,6 +210,15 @@ export OMP_NUM_THREADS=1 # should match cpus-per-task TEST16=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.pbgrib2.conus \ --exclusive -o $LOG_FILE -e $LOG_FILE ./25km.conus.gfs.pbgrib2.sh) +#----------------------------------------------------------------------------- +# Initialize C96 using GEFS GRIB2 data. +#----------------------------------------------------------------------------- + +LOG_FILE=consistency.log17 +export OMP_NUM_THREADS=1 +TEST17=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c96.gefs.grib2 \ + --exclusive -o $LOG_FILE -e $LOG_FILE ./c96.gefs.grib2.sh) + #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- @@ -217,7 +226,7 @@ TEST16=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=1 -t 0:0 LOG_FILE=consistency.log sbatch --partition=xjet --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE -d\ - afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16 << EOF + afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16:$TEST17 << EOF #!/bin/bash grep -a '<<<' $LOG_FILE* > $SUM_FILE EOF From 381d7f8b5cccce80f91537821148c7c893d263e2 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Wed, 15 Jun 2022 15:41:28 +0000 Subject: [PATCH 10/16] More cleanup. Fixes #651. --- sorc/chgres_cube.fd/input_data.F90 | 47 ++++++++++++++---------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index 764c3d200..d66ddafbc 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -2483,7 +2483,7 @@ subroutine read_input_atm_grib2_file(localpet) integer :: trac_names_oct11(ntrac_max) integer :: tracers_input_oct11(num_tracers_input) integer :: lugb, lugi, jdisc, jpdt(200), jgdt(200), iscale - integer :: jids(200), jpdtn, jgdtn, octet23, octet29 + integer :: jids(200), jpdtn, jgdtn, octet_23, octet_29 integer :: count_spfh, count_rh, count_icmr, count_scliwc integer :: count_cice, count_rwmr, count_scllwc, count @@ -2551,12 +2551,14 @@ subroutine read_input_atm_grib2_file(localpet) call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & unpack, k, gfld, iret) +!---------------------------------------------------------------------- ! Read first record and check if this is NCEP GEFS data. ! This will determine what product definition template number to ! search for (Section 4/Octets 8-9). ! ! Section 1/Octets 6-7 is '7' (NCEP) ! Section 1/Octets 8-9 is '2' (NCEP Ensemble products). +!---------------------------------------------------------------------- if (iret == 0) then if (gfld%idsect(1) == 7 .and. gfld%idsect(2) == 2) then @@ -2571,16 +2573,18 @@ subroutine read_input_atm_grib2_file(localpet) call error_handler("READING GRIB2 FILE", iret) endif +!---------------------------------------------------------------------- ! First, check for the vertical coordinate. If temperture at the 10 hybrid ! level is found, hybrid coordinates are assumed. Otherwise, data is on ! isobaric levels. +!---------------------------------------------------------------------- j = 0 jpdtn = pdt_num ! Search for the specific product definition template number. - jpdt(1) = 0 ! Sect4/oct 10 - param category - temperature field - jpdt(2) = 0 ! Sect4/oct 11 - param number - temperature - jpdt(10) = 105 ! Sect4/oct 23 - type of level - hybrid - jpdt(12) = 10 ! oct 23 - type of level - value of hybrid level + jpdt(1) = 0 ! Sect4/oct 10 - Parameter category - temperature field + jpdt(2) = 0 ! Sect4/oct 11 - Parameter number - temperature + jpdt(10) = 105 ! Sect4/oct 23 - Type of level - hybrid + jpdt(12) = 10 ! Sect4/octs 25/28 - Value of hybrid level unpack=.false. call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & @@ -2588,13 +2592,13 @@ subroutine read_input_atm_grib2_file(localpet) if (iret == 0) then print*,'- DATA IS ON HYBRID LEVELS.' - octet23 = 105 ! Section 4/Oct 23 - type of first fixed surface. - octet29 = 255 ! Section 4/Oct 29 - type of second fixed surface (N/A). + octet_23 = 105 ! Section 4/Oct 23 - type of first fixed surface. + octet_29 = 255 ! Section 4/Oct 29 - type of second fixed surface (N/A). isnative=.true. else print*,'- DATA IS ON ISOBARIC LEVELS.' - octet23 = 100 ! Section 4/Oct 23 - type of first fixed surface. - octet29 = 255 ! Section 4/Oct 29 - type of second fixed surface (N/A). + octet_23 = 100 ! Section 4/Oct 23 - type of first fixed surface. + octet_29 = 255 ! Section 4/Oct 29 - type of second fixed surface (N/A). isnative=.false. endif @@ -2615,11 +2619,10 @@ subroutine read_input_atm_grib2_file(localpet) if (iret /= 0) exit if (gfld%discipline == 0) then ! Discipline - meteorological products - if (gfld%ipdtnum == pdt_num) then ! Product definition template number - - ! analysis or forecast at single level. + if (gfld%ipdtnum == pdt_num) then ! Product definition template number. if (gfld%ipdtmpl(1) == 2 .and. gfld%ipdtmpl(2) == 2) then ! u-wind ! Sect4/octs 10 and 11. - if (gfld%ipdtmpl(10) == octet23 .and. gfld%ipdtmpl(13) == octet29) then + if (gfld%ipdtmpl(10) == octet_23 .and. gfld%ipdtmpl(13) == octet_29) then ! Sect4 octs 23 and 29. ! Hybrid or isobaric. lev_input = lev_input + 1 @@ -2633,7 +2636,7 @@ subroutine read_input_atm_grib2_file(localpet) j = k enddo - endif + endif ! read file on task 0. call mpi_barrier(MPI_COMM_WORLD, iret) call MPI_BCAST(isnative,1,MPI_LOGICAL,0,MPI_COMM_WORLD,iret) @@ -2667,7 +2670,6 @@ subroutine read_input_atm_grib2_file(localpet) enddo if(localpet == 0) then - print*,'cggg found this number of levels ',lev_input do i = 1,lev_input print*, "- LEVEL AFTER SORT = ",trim(slevs(i)) enddo @@ -2677,15 +2679,11 @@ subroutine read_input_atm_grib2_file(localpet) if (localpet == 0) then - jpdtn = pdt_num + jpdtn = pdt_num ! Product definition template number. jpdt = -9999 - jpdt(1) = 1 ! Sect4/oct 10 - param category - moisture - jpdt(2) = 0 ! Sect4/oct 11 - param number - specific humidity - if (isnative) then - jpdt(10) = 105 ! Sect4/oct 23 - type of level - hybrid - else - jpdt(10) = 100 ! Sect4/oct 23 - type of level - isobaric - endif + jpdt(1) = 1 ! Sect4/oct 10 - Parameter category - moisture + jpdt(2) = 0 ! Sect4/oct 11 - Parameter number - specific humidity + jpdt(10) = octet_23 ! Sect4/oct 23 - type of level. unpack=.false. count_spfh=0 @@ -2700,11 +2698,10 @@ subroutine read_input_atm_grib2_file(localpet) if (iret == 0) then count_spfh = count_spfh + 1 endif - enddo - jpdt(1) = 1 ! Sec4/oct 10 - param category - moisture - jpdt(2) = 1 ! Sec4/oct 11 - param number - rel humidity + jpdt(1) = 1 ! Sec4/oct 10 - Parameter category - moisture + jpdt(2) = 1 ! Sec4/oct 11 - Parameter number - rel humidity count_rh=0 do vlev = 1, lev_input From 7dd936f7c2f9388b5f6ec4985197bb33ea6e1ef5 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Wed, 15 Jun 2022 17:55:00 +0000 Subject: [PATCH 11/16] More cleanup Fixes #651. --- sorc/chgres_cube.fd/input_data.F90 | 63 ++++++++++++------------------ 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index d66ddafbc..0333e9c8d 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -2741,13 +2741,9 @@ subroutine read_input_atm_grib2_file(localpet) if (localpet == 0) then - jpdtn = pdt_num + jpdtn = pdt_num ! Product definition template number. jpdt = -9999 - if (isnative) then - jpdt(10) = 105 ! Sect4/oct 23 - type of level - hybrid - else - jpdt(10) = 100 ! Sect4/oct 23 - type of level - isobaric - endif + jpdt(10) = octet_23 ! Sect4/oct 23 - type of level. unpack=.false. count_icmr=0 @@ -2759,8 +2755,8 @@ subroutine read_input_atm_grib2_file(localpet) do vlev = 1, lev_input j = 0 - jpdt(1) = 1 ! Sect4/oct 10 - param category - moisture - jpdt(2) = 23 ! Sect4/oct 11 - param number - ice water mixing ratio + jpdt(1) = 1 ! Sect4/oct 10 - Parameter category - moisture + jpdt(2) = 23 ! Sect4/oct 11 - Parameter number - ice water mixing ratio jpdt(12) = nint(rlevs(vlev)) call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & @@ -2771,8 +2767,8 @@ subroutine read_input_atm_grib2_file(localpet) endif j = 0 - jpdt(1) = 1 ! Sect4/oct 10 - param category - moisture - jpdt(2) = 84 ! Sect4/oct 11 - param number - cloud ice water content. + jpdt(1) = 1 ! Sect4/oct 10 - Parameter category - moisture + jpdt(2) = 84 ! Sect4/oct 11 - Parameter number - cloud ice water content. call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & unpack, k, gfld, iret) @@ -2781,8 +2777,8 @@ subroutine read_input_atm_grib2_file(localpet) endif j = 0 - jpdt(1) = 6 ! Sect4/oct 10 - param category - clouds - jpdt(2) = 0 ! Sect4/oct 11 - param number - cloud ice + jpdt(1) = 6 ! Sect4/oct 10 - Parameter category - clouds + jpdt(2) = 0 ! Sect4/oct 11 - Parameter number - cloud ice call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & unpack, k, gfld, iret) @@ -2791,8 +2787,8 @@ subroutine read_input_atm_grib2_file(localpet) endif j = 0 - jpdt(1) = 1 ! Sect4/oct 10 - param category - moisture - jpdt(2) = 24 ! Sect4/oct 11 - param number - rain mixing ratio + jpdt(1) = 1 ! Sect4/oct 10 - Parameter category - moisture + jpdt(2) = 24 ! Sect4/oct 11 - Parameter number - rain mixing ratio call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & unpack, k, gfld, iret) @@ -2801,9 +2797,9 @@ subroutine read_input_atm_grib2_file(localpet) endif j = 0 - jpdt(1) = 1 ! Sect4/oct 10 - param category - moisture - jpdt(2) = 83 ! Sect4/oct 11 - param number - specific cloud liquid - ! water content. + jpdt(1) = 1 ! Sect4/oct 10 - Parameter category - moisture + jpdt(2) = 83 ! Sect4/oct 11 - Parameter number - specific cloud liquid + ! water content. call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & unpack, k, gfld, iret) @@ -2818,13 +2814,13 @@ subroutine read_input_atm_grib2_file(localpet) if (count_cice == 0) then print*,'- FILE DOES NOT CONTAIN CICE.' else - trac_names_oct10(4) = 6 ! Sect4/oct 10 - param category - clouds - trac_names_oct11(4) = 0 ! Sect4/oct 11 - param number - cloud ice + trac_names_oct10(4) = 6 ! Sect4/oct 10 - Parameter category - clouds + trac_names_oct11(4) = 0 ! Sect4/oct 11 - Parameter number - cloud ice print*,"- FILE CONTAINS CICE." endif else - trac_names_oct10(4) = 1 ! Sect4/oct 10 - param category - moisture - trac_names_oct11(4) = 84 ! Sect4/oct 11 - param number - cloud ice water content. + trac_names_oct10(4) = 1 ! Sect4/oct 10 - Parameter category - moisture + trac_names_oct11(4) = 84 ! Sect4/oct 11 - Parameter number - cloud ice water content. print*,"- FILE CONTAINS SCLIWC." endif else @@ -2835,8 +2831,8 @@ subroutine read_input_atm_grib2_file(localpet) if (count_scllwc == 0) then print*,"- FILE DOES NOT CONTAIN SCLLWC." else - trac_names_oct10(4) = 1 ! Sect4/oct 10 - param category - moisture - trac_names_oct11(4) = 83 ! Sect4/oct 11 - param number - specific cloud liquid + trac_names_oct10(4) = 1 ! Sect4/oct 10 - Parameter category - moisture + trac_names_oct11(4) = 83 ! Sect4/oct 11 - Parameter number - specific cloud liquid ! water content. print*,"- FILE CONTAINS SCLLWC." endif @@ -2900,15 +2896,10 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. - jpdt(1) = 0 ! Sect 4/oct 10 - param category - temperature - jpdt(2) = 0 ! Sect 4/oct 11 - param number - temperature - - if (isnative) then - jpdt(10) = 105 ! Sect 4/oct 23 - type of level - hybrid - else - jpdt(10) = 100 ! Sect 4/oct 23 - type of level - isobaric - endif + jpdtn = pdt_num ! Search for specific product definition template number. + jpdt(1) = 0 ! Sect 4/oct 10 - parameter category - temperature + jpdt(2) = 0 ! Sect 4/oct 11 - parameter number - temperature + jpdt(10) = octet_23 ! Sect4/oct 23 - type of level. unpack=.true. @@ -2959,13 +2950,9 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. + jpdt(10) = octet_23 ! Sect4/oct 23 - type of level. unpack = .false. - if (isnative) then - jpdt(10) = 105 ! Sect4/oct 23 - type of level - hybrid - else - jpdt(10) = 100 ! Sect4/oct 23 - type of level - isobaric - endif count = 0 From 98bb0e36d299167729dc6fe56d4f021b89a8c2a9 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Wed, 15 Jun 2022 18:19:17 +0000 Subject: [PATCH 12/16] More cleanup. Fixes #651. --- sorc/chgres_cube.fd/input_data.F90 | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index 0333e9c8d..b7128d3bc 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -3086,7 +3086,7 @@ subroutine read_input_atm_grib2_file(localpet) deallocate(dummy3d_col_in, dummy3d_col_out) - call read_winds(u_tmp_3d,v_tmp_3d,localpet,isnative,rlevs,lugb,pdt_num) + call read_winds(u_tmp_3d,v_tmp_3d,localpet,octet_23,rlevs,lugb,pdt_num) if (localpet == 0) print*,"- CALL FieldScatter FOR INPUT U-WIND." call ESMF_FieldScatter(u_input_grid, u_tmp_3d, rootpet=0, rc=rc) @@ -6802,13 +6802,12 @@ END SUBROUTINE READ_FV3_GRID_DATA_NETCDF !! @param [inout] u u-component wind !! @param [inout] v v-component wind !! @param[in] localpet ESMF local persistent execution thread -!! @param[in] isnative When true, data on hybrid levels. Otherwise -!! data is on isobaric levels. +!! @param[in] octet_23 Section 4/Octet 23 - Type of first fixed surface. !! @param[in] rlevs Array of atmospheric level values !! @param[in] lugb Logical unit number of GRIB2 file. !! @param[in] pdt_num Product definition template number. !! @author Larissa Reames - subroutine read_winds(u,v,localpet,isnative,rlevs,lugb,pdt_num) + subroutine read_winds(u,v,localpet,octet_23,rlevs,lugb,pdt_num) use grib_mod use program_setup, only : get_var_cond @@ -6816,10 +6815,7 @@ subroutine read_winds(u,v,localpet,isnative,rlevs,lugb,pdt_num) implicit none integer, intent(in) :: localpet, lugb - - logical, intent(in) :: isnative - - integer, intent(in) :: pdt_num + integer, intent(in) :: pdt_num, octet_23 real(esmf_kind_r8), intent(inout), allocatable :: u(:,:,:),v(:,:,:) real(esmf_kind_r8), intent(in), dimension(lev_input) :: rlevs @@ -6879,7 +6875,7 @@ subroutine read_winds(u,v,localpet,isnative,rlevs,lugb,pdt_num) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. unpack=.false. call getgb2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, & @@ -6906,11 +6902,7 @@ subroutine read_winds(u,v,localpet,isnative,rlevs,lugb,pdt_num) endif - if (isnative) then - jpdt(10) = 105 ! Sec4/oct 23 - type of level - hybrid - else - jpdt(10) = 100 ! Sec4/oct 23 - type of level - isobaric - endif + jpdt(10) = octet_23 ! Sec4/oct 23 - type of level. unpack=.true. From a8b0ad651eb8eea4b1d8295b23a4c83981ca3cae Mon Sep 17 00:00:00 2001 From: George Gayno Date: Wed, 15 Jun 2022 18:43:32 +0000 Subject: [PATCH 13/16] More cleanup. Fixes #651. --- sorc/chgres_cube.fd/input_data.F90 | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index b7128d3bc..8f10c59f8 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -3107,7 +3107,7 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt(1) = 3 ! Sect4/oct 10 - param category - mass jpdt(2) = 0 ! Sect4/oct 11 - param number - pressure jpdt(10) = 1 ! Sect4/oct 23 - type of level - ground surface @@ -3141,15 +3141,10 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt(1) = 2 ! Sect4/oct 10 - param category - momentum jpdt(2) = 9 ! Sect4/oct 11 - param number - dzdt - - if (isnative) then - jpdt(10) = 105 ! Sect4/oct 23 - type of level - hybrid - else - jpdt(10) = 100 ! Sect4/oct 23 - type of level - isobaric - endif + jpdt(10) = octet_23 ! Sect4/oct 23 - type of level unpack=.true. @@ -3202,7 +3197,7 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt(1) = 3 ! Sect4/oct 10 - param category - mass jpdt(2) = 5 ! Sect4/oct 11 - param number - geopotential height jpdt(10) = 1 ! Sect4/oct 23 - type of level - ground surface @@ -3322,10 +3317,10 @@ subroutine read_input_atm_grib2_file(localpet) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template, set to wildcard jgdtn = -1 ! search for any grid definition number. - jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. - jpdt(1) = 3 ! Sect4/oct 10 - param category - mass - jpdt(2) = 0 ! Sect4/oct 11 - param number - pressure - jpdt(10) = 105 ! Sect4/oct 23 - type of level - hybrid + jpdtn = pdt_num ! Search for the product definition template number. + jpdt(1) = 3 ! Sect4/oct 10 - parameter category - mass + jpdt(2) = 0 ! Sect4/oct 11 - parameter number - pressure + jpdt(10) = octet_23 ! Sect4/oct 23 - type of level. unpack=.true. do vlev = 1, lev_input From eafa7425803ab2adbf8085ecf4afb11fbb5b5530 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Wed, 15 Jun 2022 19:08:17 +0000 Subject: [PATCH 14/16] Update comments. Fixes #651. --- sorc/chgres_cube.fd/input_data.F90 | 46 +++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index 8f10c59f8..775ef0042 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -5335,7 +5335,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 1 ! Sec4/oct 10 - parameter category - moisture jpdt(2) = 13 ! Sec4/oct 11 - parameter number - liquid equiv snow depth @@ -5369,7 +5369,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 1 ! Sec4/oct 10 - parameter category - moisture jpdt(2) = 11 ! Sec4/oct 11 - parameter number - snow depth @@ -5406,7 +5406,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 0 ! Sec4/oct 10 - parameter category - temperature jpdt(2) = 0 ! Sec4/oct 11 - parameter number - temperature @@ -5435,7 +5435,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 1 ! Sec4/oct 10 - parameter category - moisture jpdt(2) = 0 ! Sec4/oct 11 - parameter number - specific humidity @@ -5464,7 +5464,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 0 ! Sec4/oct 10 - parameter category - temperature jpdt(2) = 0 ! Sec4/oct 11 - parameter number - temperature @@ -5516,7 +5516,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 0 ! Search at beginning of file - jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template - Sec4 jpdt(1) = 3 ! Sec4/oct 10 - parameter category - soil products jpdt(2) = 0 ! Sec4/oct 11 - parameter number - soil type @@ -5649,7 +5649,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 0 ! Search at beginning of file. - jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 4 ! Sec4/oct 11 - parameter number - vegetation @@ -5687,7 +5687,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 1105 ! grib2 file does not distinguish between the various veg ! fractions. Need to search using record number. - jpdtn = pdt_num ! Search for product definition template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 4 ! Sec4/oct 11 - parameter number - vegetation @@ -5727,7 +5727,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 1106 ! Have to search by record number. - jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 4 ! Sec4/oct 11 - parameter number - vegetation @@ -5770,7 +5770,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 7 ! Sec4/oct 10 - parameter category - thermo stability indices jpdt(2) = 198 ! Sec4/oct 11 - parameter number - leaf area index @@ -5805,7 +5805,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 10 ! Search for discipline - ocean products j = 0 ! Search at beginning of file. - jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 2 ! Sec4/oct 10 - parameter category - ice jpdt(2) = 1 ! Sec4/oct 11 - parameter number - thickness @@ -5901,7 +5901,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 0 ! Search for discipline - meteorological products j = 0 ! Search at beginning of file. - jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 2 ! Sec4/oct 10 - parameter category - momentum jpdt(2) = 30 ! Sec4/oct 11 - parameter number - friction velocity @@ -5973,7 +5973,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 0 ! Search from beginning of file - jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 13 ! Sec4/oct 11 - parameter number - canopy water @@ -6020,7 +6020,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 0 ! Search from beginning of file. - jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 1 ! Sec4/oct 11 - parameter number - surface roughness @@ -6093,7 +6093,7 @@ subroutine read_input_sfc_grib2_file(localpet) jdisc = 2 ! Search for discipline - land products j = 0 ! Search from beginning of file. - jpdtn = pdt_num ! Search for product def template number 0 - anl or fcst. + jpdtn = pdt_num ! Search for the product definition template number. jpdt = -9999 ! Initialize array of values in product definition template Sec4. jpdt(1) = 0 ! Sec4/oct 10 - parameter category - veg/biomass jpdt(2) = 198 ! Sec4/oct 11 - parameter number - vegetation type @@ -7259,16 +7259,16 @@ subroutine read_grib_soil(vname, vname_file, lugb, pdt_num, dummy3d) jids = -9999 ! array of values in identification section, set to wildcard jgdt = -9999 ! array of values in grid definition template 3.m jgdtn = -1 ! search for any grid definition number. - jpdtn = pdt_num ! search for product def template number 0 - anl or fcst. - jpdt(1) = 0 ! oct 10 - param cat - veg/biomass - if (trim(vname) == 'soilt') jpdt(2) = 2 ! oct 11 - param number - soil temp - if (trim(vname) == 'soilw') jpdt(2) = 192 ! oct 11 - param number - total soilm + jpdtn = pdt_num ! Search for the product definition template number. + jpdt(1) = 0 ! Section 4/Octet 10 - parameter category - veg/biomass + if (trim(vname) == 'soilt') jpdt(2) = 2 ! Section 4/Octet 11 - parameter number - soil temp + if (trim(vname) == 'soilw') jpdt(2) = 192 ! Section 4/Octet 11 - parameter number - total soilm if (trim(vname) == 'soill') then - jpdt(1) = 3 ! oct 10 - soil products - jpdt(2) = 192 ! oct 11 - param number - liquid soilm + jpdt(1) = 3 ! Section 4/Octet 10 - soil products + jpdt(2) = 192 ! Section 4/Octet 11 - parameter number - liquid soilm endif - jpdt(10) = 106 ! oct 23 - depth below ground - jpdt(13) = 106 ! oct 29 - depth below ground + jpdt(10) = 106 ! Section 4/Octet 23 - depth below ground + jpdt(13) = 106 ! Section 4/Octet 29 - depth below ground unpack=.true. do i = 1,lsoil_input From 314a3ca012f8c27c135d211e45a2c5ce3423af4d Mon Sep 17 00:00:00 2001 From: George Gayno Date: Wed, 15 Jun 2022 19:43:57 +0000 Subject: [PATCH 15/16] Fix error handler on read of grib2 file. Fixes #651. --- sorc/chgres_cube.fd/input_data.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index 775ef0042..193d295de 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -5082,7 +5082,7 @@ subroutine read_input_sfc_grib2_file(localpet) pdt_num = 0 endif else - call abort + if (rc /= 0) call error_handler("ERROR READING GRIB2 FILE.", rc) endif j = 0 From cf90323694e7e2f339e2842177e884d3fa6a491b Mon Sep 17 00:00:00 2001 From: George Gayno Date: Wed, 15 Jun 2022 19:53:32 +0000 Subject: [PATCH 16/16] Remove new regression test from WCOSS P3 script as that machine will be turned off soon. Fixes #651. --- reg_tests/chgres_cube/driver.wcoss_dell_p3.sh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/reg_tests/chgres_cube/driver.wcoss_dell_p3.sh b/reg_tests/chgres_cube/driver.wcoss_dell_p3.sh index 126b415b6..6f4e8e821 100755 --- a/reg_tests/chgres_cube/driver.wcoss_dell_p3.sh +++ b/reg_tests/chgres_cube/driver.wcoss_dell_p3.sh @@ -49,7 +49,7 @@ fi export HOMEufs=$PWD/../.. -export HOMEreg=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/ufs_utils.git/reg_tests.test/chgres_cube +export HOMEreg=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/ufs_utils.git/reg_tests/chgres_cube SUM_FILE=summary.log @@ -205,15 +205,6 @@ export OMP_NUM_THREADS=1 bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J chgres16 -W 0:05 -x -n 6 \ -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/25km.conus.gfs.pbgrib2.sh" -#----------------------------------------------------------------------------- -# Initialize C96 USING GEFS GRIB2 files. -#----------------------------------------------------------------------------- - -LOG_FILE=consistency.log17 -export OMP_NUM_THREADS=1 -bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J chgres17 -W 0:05 -x -n 6 \ - -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/c96.gefs.grib2.sh" - #----------------------------------------------------------------------------- # Create summary log. #-----------------------------------------------------------------------------