Skip to content

Commit 740bd87

Browse files
Adding GRIB2 template 4.46 for RRFS use. (#115)
1 parent 86be852 commit 740bd87

File tree

1 file changed

+159
-0
lines changed

1 file changed

+159
-0
lines changed

src/grib2_all_tables_module.F90

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,6 +2067,165 @@ subroutine g2sec4_temp44(icatg, iparm, aer_type, typ_intvl_size, &
20672067
end subroutine g2sec4_temp44
20682068
!>
20692069
!> This subroutine returns the Grib2 Section 4 Template 4.0 list for given keys
2070+
!> PDT 4.46 - Average, accumulation, and/or extreme values or other
2071+
!> statistically processed values at a horizontal level
2072+
!> or in a horizontal layer in a continuous or
2073+
!> non-continuous time interval for aerosol.
2074+
!>
2075+
!> @param[in] icatg - Parameter category (see Code table 4.1)
2076+
!> @param[in] iparm - Parameter number (see Code table 4.2)
2077+
!> @param[in] aer_type - Aetosol type (see Code table 4.233)
2078+
!> @param[in] typ_intvl_size - Type of interval for first and second size (see Code table 4.91)
2079+
!> @param[in] scale_fac1_size - Scale factor of first size
2080+
!> @param[in] scale_val1_size - Scale value of first size in meters
2081+
!> @param[in] scale_fac2_size - Scale factor of second size
2082+
!> @param[in] scale_val2_size - Scale value of second size in meters
2083+
!> @param[in] typ_gen_proc_key - Type of generating process (see Code table 4.3)
2084+
!> @param[in] gen_proc_or_mod_key - Analysis or forecast generating process identified (see Code ON388 Table A)
2085+
!> @param[in] hrs_obs_cutoff - Hours of observational data cutoff after reference time (see Note)
2086+
!> @param[in] min_obs_cutoff - Minutes of observational data cutoff after reference time (see Note)
2087+
!> @param[in] unit_of_time_key - Indicator of unit of time range (see Code table 4.4)
2088+
!> @param[in] fcst_time - Forecast time in units defined by octet 18
2089+
!> @param[in] lvl_type1 - Type of first fixed surface (see Code table 4.5)
2090+
!> @param[in] scale_fac1 - Scale factor of first fixed surface
2091+
!> @param[in] scaled_val1 - Scaled value of first fixed surface
2092+
!> @param[in] lvl_type2 - Type of second fixed surfaced (see Code table 4.5)
2093+
!> @param[in] scale_fac2 - Scale factor of second fixed surface
2094+
!> @param[in] scaled_val2 - Scaled value of second fixed surfaces
2095+
!> @param[in] year_intvl - Year Time of end of overall time interval
2096+
!> @param[in] mon_intvl - Month Time of end of overall time interval
2097+
!> @param[in] day_intvl - Day Time of end of overall time interval
2098+
!> @param[in] hour_intvl - Hour Time of end of overall time interval
2099+
!> @param[in] min_intvl - Minute Time of end of overall time interval
2100+
!> @param[in] sec_intvl - Second Time of end of overall time interval
2101+
!> @param[in] num_time_range - n number of time ranges specifications describing
2102+
!> the time intervals used to calculate the
2103+
!> statistically-processed field
2104+
!> @param[in] stat_miss_val - Total number of data values missing in statistical process
2105+
!> Specification of the outermost (or only) time range over
2106+
!> which statistical processing is done
2107+
!> @param[in] type_of_stat_proc - Statistical process used to calculate the processed
2108+
!> field from the field at each time increment during the
2109+
!> time range (see Code Table 4.10)
2110+
!> @param[in] type_of_time_inc - Type of time increment between successive fields
2111+
!> used in the statistical processing (see Code Table 4.11)
2112+
!> @param[in] stat_unit_time_key - Indicator of unit of time for time range over which
2113+
!> statistical processing is done (see Code Table 4.4)
2114+
!> @param[in] leng_time_range_stat - Length of the time range over which statistical processing
2115+
!> is done, in units defined by the previous octet
2116+
!> @param[in] stat_unit_time_key_succ - Indicator of unit of time for the increment between the
2117+
!> successive fields used (see Code table 4.4)
2118+
!> @param[in] time_inc_betwn_succ_fld - Time increment between successive fields,
2119+
!> in units defined by the previous octet (see Notes 3 & 4)
2120+
!> @param[out] ipdstmpl46 - GRIB2 PDS Template 4.46 listing
2121+
!>
2122+
!> @author E. JAMES ORG: NOAA/GSL @date 2024-04-02
2123+
subroutine g2sec4_temp46(icatg, iparm, aer_type, typ_intvl_size, &
2124+
scale_fac1_size, scale_val1_size, scale_fac2_size, &
2125+
scale_val2_size, typ_gen_proc_key, gen_proc_or_mod_key, &
2126+
hrs_obs_cutoff, min_obs_cutoff, &
2127+
unit_of_time_key, fcst_time, lvl_type1, scale_fac1, &
2128+
scaled_val1, lvl_type2, scale_fac2, scaled_val2, &
2129+
year_intvl, &
2130+
mon_intvl, day_intvl, hour_intvl, min_intvl, sec_intvl, &
2131+
num_time_range, stat_miss_val, type_of_stat_proc, &
2132+
type_of_time_inc, stat_unit_time_key, &
2133+
leng_time_range_stat, stat_unit_time_key_succ, &
2134+
time_inc_betwn_succ_fld, ipdstmpl46)
2135+
integer(4), intent(in) :: icatg, iparm, hrs_obs_cutoff, min_obs_cutoff, &
2136+
scale_fac1_size, scale_fac2_size, &
2137+
fcst_time, scale_fac1, scaled_val1, &
2138+
scale_fac2, scaled_val2
2139+
integer(4), intent(in) :: year_intvl, mon_intvl, day_intvl, hour_intvl, min_intvl, &
2140+
sec_intvl, num_time_range, stat_miss_val, &
2141+
leng_time_range_stat, time_inc_betwn_succ_fld
2142+
!
2143+
real, intent(in) :: scale_val1_size, scale_val2_size
2144+
!
2145+
character(len=*), intent(in) :: aer_type, typ_intvl_size, &
2146+
typ_gen_proc_key, &
2147+
gen_proc_or_mod_key, unit_of_time_key, lvl_type1, lvl_type2, &
2148+
type_of_stat_proc, type_of_time_inc, &
2149+
stat_unit_time_key, stat_unit_time_key_succ
2150+
!
2151+
integer(4), intent(inout) :: ipdstmpl46(35)
2152+
!
2153+
!local vars
2154+
integer(4) :: value, ierr
2155+
integer(4) :: bckgnd_gen_proc_id ! defined by the center
2156+
!
2157+
bckgnd_gen_proc_id=0 ! defined by the center
2158+
!
2159+
ipdstmpl46(1) = icatg
2160+
ipdstmpl46(2) = iparm
2161+
!
2162+
call get_g2_typeofaerosol(aer_type, value, ierr)
2163+
ipdstmpl46(3) = value
2164+
!
2165+
call get_g2_typeofintervals(typ_intvl_size, value, ierr)
2166+
ipdstmpl46(4) = value
2167+
ipdstmpl46(5) = scale_fac1_size
2168+
ipdstmpl46(6) = nint(scale_val1_size)
2169+
ipdstmpl46(7) = scale_fac2_size
2170+
ipdstmpl46(8) = nint(scale_val2_size)
2171+
2172+
call get_g2_typeofgenproc(typ_gen_proc_key, value, ierr)
2173+
ipdstmpl46(9) = value
2174+
!
2175+
ipdstmpl46(10) = bckgnd_gen_proc_id
2176+
!
2177+
call get_g2_on388genproc(gen_proc_or_mod_key, value, ierr)
2178+
ipdstmpl46(11) = value
2179+
!
2180+
ipdstmpl46(12) = hrs_obs_cutoff
2181+
ipdstmpl46(13) = min_obs_cutoff
2182+
!
2183+
call get_g2_unitoftimerange(unit_of_time_key, value, ierr)
2184+
ipdstmpl46(14) = value
2185+
ipdstmpl46(15) = fcst_time
2186+
!
2187+
call get_g2_fixedsurfacetypes(lvl_type1, value, ierr)
2188+
ipdstmpl46(16) = value
2189+
ipdstmpl46(17) = scale_fac1
2190+
ipdstmpl46(18) = scaled_val1
2191+
!
2192+
call get_g2_fixedsurfacetypes(lvl_type2, value, ierr)
2193+
ipdstmpl46(19) = value
2194+
!
2195+
ipdstmpl46(20) = scale_fac2
2196+
ipdstmpl46(21) = scaled_val2
2197+
ipdstmpl46(22) = year_intvl
2198+
ipdstmpl46(23) = mon_intvl
2199+
ipdstmpl46(24) = day_intvl
2200+
ipdstmpl46(25) = hour_intvl
2201+
ipdstmpl46(26) = min_intvl
2202+
ipdstmpl46(27) = sec_intvl
2203+
!
2204+
ipdstmpl46(28) = num_time_range ! choose n=1 for this case
2205+
ipdstmpl46(29) = stat_miss_val ! choose 0 for this case
2206+
!
2207+
call get_g2_statprocesstypes(type_of_stat_proc, value, ierr)
2208+
ipdstmpl46(30) = value ! types_of_stat_proc='accumulation'
2209+
!
2210+
call get_g2_typeoftimeintervals(type_of_time_inc, value, ierr)
2211+
ipdstmpl46(31) = value ! type_of_time_inc='same_start_time_fcst_fcst_time_inc'
2212+
! value = 2 (Successive times processed have same start
2213+
! time of forecast, forecast time is incremented)
2214+
!
2215+
call get_g2_unitoftimerange(stat_unit_time_key, value, ierr)
2216+
ipdstmpl46(32) = value ! stat_unit_time_key='hour'
2217+
! value = 1
2218+
ipdstmpl46(33) = leng_time_range_stat ! value = 6
2219+
!
2220+
call get_g2_unitoftimerange(stat_unit_time_key_succ, value, ierr)
2221+
! stat_unit_time_key_succ='missing'
2222+
ipdstmpl46(34) = value ! value = 255
2223+
!
2224+
ipdstmpl46(35) = time_inc_betwn_succ_fld ! value = 0
2225+
!
2226+
end subroutine g2sec4_temp46
2227+
!>
2228+
!> This subroutine returns the Grib2 Section 4 Template 4.0 list for given keys
20702229
!> PDT 4.48 - Analysis or forecast at a horizontal level or in a
20712230
!> horizontal layer at a point in time for aerosol.
20722231
!>

0 commit comments

Comments
 (0)