From af4c5a1306361d64345284784013d8ec3ac0fc83 Mon Sep 17 00:00:00 2001 From: Edward Hartnett <38856240+edwardhartnett@users.noreply.github.com> Date: Tue, 16 Apr 2024 12:07:07 -0600 Subject: [PATCH] fix doxygen and some code warnings (#120) * fix doxygen * fixed some warnings * more warning fixes * more warning fixes * more warnings fixed * fixed more warnings * fixed more warnings * turned on -Werror * fixed warning * fixed warning * fixed warning --- .github/workflows/developer.yml | 2 +- src/grib2_all_tables_module.F90 | 80 +++++++++++++++++---------------- tests/test_g2tmpl_pdt4_1.F90 | 2 +- tests/test_g2tmpl_pdt4_11.F90 | 2 +- tests/test_g2tmpl_pdt4_12.F90 | 4 +- 5 files changed, 47 insertions(+), 43 deletions(-) diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index 38f55bf..09f5a56 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -37,7 +37,7 @@ jobs: cd g2tmpl mkdir build cd build - cmake -DENABLE_DOCS=ON -DCMAKE_C_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -fsanitize=address -Wall -Werror" -DCMAKE_Fortran_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -fsanitize=address -Wall" -DCMAKE_BUILD_TYPE=Debug .. + cmake -DENABLE_DOCS=ON -DCMAKE_C_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -fsanitize=address -Wall -Werror" -DCMAKE_Fortran_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -fsanitize=address -Wall -Werror" -DCMAKE_BUILD_TYPE=Debug .. make -j2 VERBOSE=1 - name: test diff --git a/src/grib2_all_tables_module.F90 b/src/grib2_all_tables_module.F90 index ac118d0..0fe67d1 100644 --- a/src/grib2_all_tables_module.F90 +++ b/src/grib2_all_tables_module.F90 @@ -220,7 +220,7 @@ module grib2_all_tables_module data table1_4(8) /type_of_data('proc_rad_obs',7)/ data table1_4(9) /type_of_data('event_prob',8)/ data table1_4(10) /type_of_data('missing',255)/ - data table1_4(11) /type_of_data('experimental_products',192)/ + data table1_4(11) /type_of_data('experimental_product',192)/ ! ! type type_of_gen_proc @@ -1172,7 +1172,7 @@ module grib2_all_tables_module data on388_tablea(112) /gen_proc('extra_trop_storm_surge_pacific',17)/ data on388_tablea(113) /gen_proc('prob_extra_trop_storm_surge',18)/ data on388_tablea(114) /gen_proc('linmit_fine_mesh_anal',19)/ - data on388_tablea(115) /gen_proc('extra_trop_storm_surge_micronesia',20)/ + data on388_tablea(115) /gen_proc('extra_trop_storm_surge_microne',20)/ data on388_tablea(116) /gen_proc('hur_weather_res_and_fcst',71)/ data on388_tablea(117) /gen_proc('hur_non-hydro_multi',72)/ ! @@ -1188,7 +1188,7 @@ module grib2_all_tables_module ! data on388_tablea(120) /gen_proc('extra_trop_storm_surge_atl_3d',21)/ data on388_tablea(121) /gen_proc('extra_trop_storm_surge_pac_3d',22)/ - data on388_tablea(122) /gen_proc('extra_trop_storm_surge_micro_3d',23)/ + data on388_tablea(122) /gen_proc('extra_trop_storm_surge_micro_3',23)/ contains ! @@ -1394,13 +1394,14 @@ end subroutine get_g2_unitoftimerange !> !> @param[in] key - GRIB2 character short key for fixed surface types from Table 4.5 !> @param[out] value - corresponding GRIB2 value from Table 4.5 - !> @param[out] ierr - error messages + !> @param[out] ierr - 0 for success, 9 if key not found !> - !> @author V. Krishna Kumar ORG: W/NP12 @date 2009-12-10 + !> @author V. Krishna Kumar ORG: W/NP12 @date 2009-12-10 subroutine get_g2_fixedsurfacetypes(key, value, ierr) character(len=*) :: key integer :: value, n, ierr ! + ierr = 0 do n=1, MAXFIXEDSURFACETYPES if (trim(table4_5(n)%fixedsurfacetypeskey).eq.trim(key)) then value=table4_5(n)%fixedsurfacetypesval @@ -1411,7 +1412,7 @@ subroutine get_g2_fixedsurfacetypes(key, value, ierr) value=table4_5(66)%fixedsurfacetypesval ! print *, 'get_g2_fixedsurfacetypes key: ', trim(key), value, & ! ' not found in table 4.5' - ! ierr=9 + ierr=9 return end subroutine get_g2_fixedsurfacetypes !> @@ -2034,9 +2035,9 @@ subroutine g2sec4_temp44(icatg, iparm, aer_type, typ_intvl_size, & call get_g2_typeofintervals(typ_intvl_size, value, ierr) ipdstmpl44(4) = value ipdstmpl44(5) = scale_fac1_size - ipdstmpl44(6) = scale_val1_size + ipdstmpl44(6) = int(scale_val1_size) ipdstmpl44(7) = scale_fac2_size - ipdstmpl44(8) = scale_val2_size + ipdstmpl44(8) = int(scale_val2_size) ! call get_g2_typeofgenproc(typ_gen_proc_key, value, ierr) ipdstmpl44(9) = value @@ -2066,11 +2067,14 @@ subroutine g2sec4_temp44(icatg, iparm, aer_type, typ_intvl_size, & ! end subroutine g2sec4_temp44 !> - !> This subroutine returns the Grib2 Section 4 Template 4.0 list for given keys - !> PDT 4.46 - Average, accumulation, and/or extreme values or other - !> statistically processed values at a horizontal level - !> or in a horizontal layer in a continuous or - !> non-continuous time interval for aerosol. + !> Returns the GRIB2 Section 4 Template 4.0 list. + !> + !>
+  !> PDT 4.46 - Average, accumulation, and/or extreme values or other
+  !>            statistically processed values at a horizontal level
+  !>            or in a horizontal layer in a continuous or
+  !>            non-continuous time interval for aerosol.
+  !> 
!> !> @param[in] icatg - Parameter category (see Code table 4.1) !> @param[in] iparm - Parameter number (see Code table 4.2) @@ -2098,28 +2102,33 @@ end subroutine g2sec4_temp44 !> @param[in] hour_intvl - Hour Time of end of overall time interval !> @param[in] min_intvl - Minute Time of end of overall time interval !> @param[in] sec_intvl - Second Time of end of overall time interval - !> @param[in] num_time_range - n number of time ranges specifications describing - !> the time intervals used to calculate the - !> statistically-processed field - !> @param[in] stat_miss_val - Total number of data values missing in statistical process - !> Specification of the outermost (or only) time range over - !> which statistical processing is done - !> @param[in] type_of_stat_proc - Statistical process used to calculate the processed - !> field from the field at each time increment during the - !> time range (see Code Table 4.10) - !> @param[in] type_of_time_inc - Type of time increment between successive fields - !> used in the statistical processing (see Code Table 4.11) - !> @param[in] stat_unit_time_key - Indicator of unit of time for time range over which - !> statistical processing is done (see Code Table 4.4) - !> @param[in] leng_time_range_stat - Length of the time range over which statistical processing - !> is done, in units defined by the previous octet - !> @param[in] stat_unit_time_key_succ - Indicator of unit of time for the increment between the - !> successive fields used (see Code table 4.4) - !> @param[in] time_inc_betwn_succ_fld - Time increment between successive fields, - !> in units defined by the previous octet (see Notes 3 & 4) + !> @param[in] num_time_range - n number of time ranges + !> specifications describing the time intervals used to calculate + !> the statistically-processed field + !> @param[in] stat_miss_val - Total number of data values missing in + !> statistical process Specification of the outermost (or only) time + !> range over which statistical processing is done + !> @param[in] type_of_stat_proc - Statistical process used to + !> calculate the processed field from the field at each time + !> increment during the time range (see Code Table 4.10) + !> @param[in] type_of_time_inc - Type of time increment between + !> successive fields used in the statistical processing (see Code + !> Table 4.11) + !> @param[in] stat_unit_time_key - Indicator of unit of time for + !> time range over which statistical processing is done (see Code + !> Table 4.4) + !> @param[in] leng_time_range_stat - Length of the time range over + !> which statistical processing is done, in units defined by the + !> previous octet + !> @param[in] stat_unit_time_key_succ - Indicator of unit of time + !> for the increment between the successive fields used (see Code + !> table 4.4) + !> @param[in] time_inc_betwn_succ_fld - Time increment between + !> successive fields, in units defined by the previous octet (see + !> Notes 3 & 4) !> @param[out] ipdstmpl46 - GRIB2 PDS Template 4.46 listing !> - !> @author E. JAMES ORG: NOAA/GSL @date 2024-04-02 + !> @author E. JAMES, NOAA/GSL @date 2024-04-02 subroutine g2sec4_temp46(icatg, iparm, aer_type, typ_intvl_size, & scale_fac1_size, scale_val1_size, scale_fac2_size, & scale_val2_size, typ_gen_proc_key, gen_proc_or_mod_key, & @@ -2409,7 +2418,6 @@ subroutine g2sec5_temp0(dec_scale_fac, bin_scale_fac, tlnumbits, ifield5) integer(4), intent(in) :: bin_scale_fac, dec_scale_fac, tlnumbits integer(4), intent(out) :: ifield5(5) ! character(len=50) :: type_of_field - integer(4) :: value, ierr ! ifield5(1) = 0 ! Any value. Will be later overwritten ifield5(2) = bin_scale_fac @@ -2439,8 +2447,6 @@ subroutine g2sec5_temp2(dec_scale_fac, bin_scale_fac, ifield5) integer(4), intent(inout) :: ifield5(16) integer(4), intent(in) :: dec_scale_fac, bin_scale_fac ! - integer(4) :: value, ierr - ! ifield5=0 ifield5(1) = 0 ! Any value. Will be later overwritten ifield5(2) = bin_scale_fac @@ -2519,8 +2525,6 @@ subroutine g2sec5_temp40(dec_scale_fac, bin_scale_fac, tlnumbits, !--- local variable integer(4) :: value, ierr integer, parameter :: MAX_NUMBIT=16 - integer ibm - integer, allocatable :: mg(:) ! ifield5(1) = 0 ! Any value. Will be later overwritten ifield5(2) = bin_scale_fac diff --git a/tests/test_g2tmpl_pdt4_1.F90 b/tests/test_g2tmpl_pdt4_1.F90 index 0818928..ae5f4e5 100755 --- a/tests/test_g2tmpl_pdt4_1.F90 +++ b/tests/test_g2tmpl_pdt4_1.F90 @@ -18,7 +18,7 @@ Program test_g2tmpl_pdt4_1 unit_of_time_key,lvl_type1,lvl_type2, & type_ens_fcst_key - integer(4) :: bckgnd_gen_proc_id ! defined by the center +! integer(4) :: bckgnd_gen_proc_id ! defined by the center integer(4) :: ipdstmpl1_old(18)=(/0, 4, 4, 0, 107, 0, 0, 1, 6, & 103, 0, 2, 255, 0, 0, 3, 5, 10/) diff --git a/tests/test_g2tmpl_pdt4_11.F90 b/tests/test_g2tmpl_pdt4_11.F90 index 6fce7c0..09fbd39 100755 --- a/tests/test_g2tmpl_pdt4_11.F90 +++ b/tests/test_g2tmpl_pdt4_11.F90 @@ -24,7 +24,7 @@ Program test_g2tmpl_pdt4_11 stat_unit_time_key,stat_unit_time_key_succ, & type_ens_fcst_key ! - integer(4) :: bckgnd_gen_proc_id ! defined by the center +! integer(4) :: bckgnd_gen_proc_id ! defined by the center ! integer(4) :: ipdstmpl11_old(32)=(/0, 4, 4, 0, 107, 0, 0, 1, 6, & diff --git a/tests/test_g2tmpl_pdt4_12.F90 b/tests/test_g2tmpl_pdt4_12.F90 index 454c477..32244d9 100755 --- a/tests/test_g2tmpl_pdt4_12.F90 +++ b/tests/test_g2tmpl_pdt4_12.F90 @@ -16,7 +16,7 @@ Program test_g2tmpl_pdt4_12 integer(4) :: year_intvl,mon_intvl,day_intvl,hour_intvl,min_intvl, & sec_intvl,num_time_range,stat_miss_val, & leng_time_range_stat,time_inc_betwn_succ_fld - integer(4) :: perturb_num, num_fcst_ens + integer(4) :: num_fcst_ens ! character(len=80) :: typ_gen_proc_key,gen_proc_or_mod_key, & unit_of_time_key,lvl_type1,lvl_type2, & @@ -24,7 +24,7 @@ Program test_g2tmpl_pdt4_12 stat_unit_time_key,stat_unit_time_key_succ, & type_derive_fcst_key ! - integer(4) :: bckgnd_gen_proc_id ! defined by the center + !integer(4) :: bckgnd_gen_proc_id ! defined by the center ! integer(4) :: ipdstmpl12_old(31)=(/0, 4, 4, 0, 107, 0, 0, 1, 6, &