From c5759a5058831bf220dcf739fa9e79a2a58fb2d0 Mon Sep 17 00:00:00 2001 From: Eric Kemp Date: Tue, 28 May 2024 09:39:28 -0400 Subject: [PATCH 1/6] Bug fixes to handle unrecognized gage networks. --- lis/metforcing/usaf/USAF_PreobsReaderMod.F90 | 61 ++++++++++++++++++++ lis/metforcing/usaf/USAF_bratsethMod.F90 | 16 +++-- 2 files changed, 72 insertions(+), 5 deletions(-) diff --git a/lis/metforcing/usaf/USAF_PreobsReaderMod.F90 b/lis/metforcing/usaf/USAF_PreobsReaderMod.F90 index e92329c55..a43d155d6 100644 --- a/lis/metforcing/usaf/USAF_PreobsReaderMod.F90 +++ b/lis/metforcing/usaf/USAF_PreobsReaderMod.F90 @@ -43,6 +43,7 @@ subroutine USAF_read_preobs(preobsdir, presavdir, & use LIS_logMod, only: LIS_logunit, LIS_alert, LIS_getNextUnitNumber, & LIS_releaseUnitNumber use LIS_mpiMod, only: LIS_mpi_comm + use USAF_bratsethMod, only: USAF_is_gauge ! EMK 20240524 use USAF_GagesMod, only: USAF_Gages_t ! Defaults @@ -124,6 +125,28 @@ subroutine USAF_read_preobs(preobsdir, presavdir, & character(255) :: timestring integer :: iunit character(255) :: message(20) + integer, parameter :: MAX_NEW_NETWORKS = 20 + character(10), save :: new_networks(MAX_NEW_NETWORKS) = & + (/"NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL ", & + "NULL "/) message = '' @@ -147,6 +170,7 @@ subroutine USAF_read_preobs(preobsdir, presavdir, & inquire(file=trim(filename), exist=found_file) if (.not. found_file) then write(LIS_logunit,*) '[WARN] Cannot find ', trim(filename) + message = '' message(1) = '[WARN] Program: LIS' message(2) = ' Routine: USAF_read_preobs' message(3) = ' Cannot find file ' // trim(filename) @@ -163,6 +187,7 @@ subroutine USAF_read_preobs(preobsdir, presavdir, & open(iunit, file=trim(filename), status='old', iostat=ierr) if (ierr .ne. 0) then write(LIS_logunit,*) '[WARN] Problem opening ', trim(filename) + message = '' message(1) = '[WARN] Program: LIS' message(2) = ' Routine: USAF_read_preobs' message(3) = ' Cannot open file ' // trim(filename) @@ -180,6 +205,7 @@ subroutine USAF_read_preobs(preobsdir, presavdir, & read(iunit, *, iostat=ierr) nsize if (ierr .ne. 0) then write(LIS_logunit,*) '[WARN] Problem reading ', trim(filename) + message = '' message(1) = '[WARN] Program: LIS' message(2) = ' Routine: USAF_read_preobs' message(3) = ' Problem reading file ' // trim(filename) @@ -196,6 +222,7 @@ subroutine USAF_read_preobs(preobsdir, presavdir, & if (nsize == 0) then write(LIS_logunit,*)'[WARN] No precip obs found in ', & trim(filename) + message = '' message(1) = '[WARN] Program: LIS' message(2) = ' Routine: USAF_read_preobs' message(3) = ' No precip obs found in ' // trim(filename) @@ -319,6 +346,39 @@ subroutine USAF_read_preobs(preobsdir, presavdir, & ! Skip if lat/lon is 0 (this is interpreted as missing). if (ilat_tmp == 0 .and. ilon_tmp == 0) cycle + ! EMK 20240524...Skip report if network is not recognized. + ! Issue an alert. Keep track of unknown networks to avoid + ! redundant alerts. + if (.not. USAF_is_gauge(network_tmp)) then + do j = 1, MAX_NEW_NETWORKS + if (trim(new_networks(j)) == trim(network_tmp)) then + exit ! Out of immediate do loop + else if (trim(new_networks(j)) == "NULL") then + new_networks(j) = network_tmp + write(LIS_logunit,*) & + '[WARN] Found unrecognized network ', & + trim(network_tmp) + write(LIS_logunit,*) & + '[WARN] Will skip report in preobs file' + message = '' + message(1) = '[WARN] Program: LIS' + message(2) = ' Routine: USAF_read_preobs' + message(3) = ' Found unrecognized network in '// & + trim(filename) + message(4) = ' Network '//trim(network_tmp) + message(5) = & + ' Contact NASA developers to add this network' + if (LIS_masterproc) then + alert_number = alert_number + 1 + call LIS_alert('LIS.USAF_read_preobs', & + alert_number, message) + end if + exit ! Out of immediate do loop + end if + end do + cycle ! Read next report + end if + ! Skip reports that are too much after the analysis time ! (but allow earlier reports). This is a crude way of ! allowing for Australian reports that are sometimes one or @@ -736,6 +796,7 @@ subroutine USAF_read_preobs(preobsdir, presavdir, & write(LIS_logunit,*) & '[WARN] Will skip reconciling with obs from ', & abs(deltahr),' hours ago' + message = '' message(1) = '[WARN] Program: LIS' message(2) = ' Routine: USAF_read_preobs' message(3) = ' Cannot find earlier presav2 file ' // & diff --git a/lis/metforcing/usaf/USAF_bratsethMod.F90 b/lis/metforcing/usaf/USAF_bratsethMod.F90 index e79a25ffa..883c0b590 100644 --- a/lis/metforcing/usaf/USAF_bratsethMod.F90 +++ b/lis/metforcing/usaf/USAF_bratsethMod.F90 @@ -26,6 +26,8 @@ ! 21 Mar 2024 Changed internal BackQC and SuperstatQC logic to only ! skip for IMERG. This allows use with T, RH, and wind ! speed analyses..........................Eric Kemp/SSAI/NASA +! 24 May 2024 Export USAF_is_gauge function, and add HADS and +! NWSLI gage networks.....................Eric Kemp/SSAI/NASA ! ! DESCRIPTION: ! @@ -139,6 +141,8 @@ module USAF_bratsethMod public :: USAF_snowDepthQC public :: USAF_backQC public :: USAF_superstatQC + ! EMK 20240524 + public :: USAF_is_gauge ! A simple linked list type that can be used in a hash table. Intended ! to store indices of arrays in the USAF_obsData type for efficient look-up. @@ -1673,7 +1677,7 @@ subroutine USAF_analyzePrecip(precipAll,nest,back,hourindex,mrgp,precipOBA) call calc_invDataDensities(precipAll,sigmaBSqr,nest, & agrmet_struc(nest)%bratseth_precip_max_dist, & agrmet_struc(nest)%bratseth_precip_back_err_scale_length, & - is_gauge, & + USAF_is_gauge, & invDataDensities) ! Run Bratseth analysis at observation points, and collect the sum of @@ -1684,7 +1688,7 @@ subroutine USAF_analyzePrecip(precipAll,nest,back,hourindex,mrgp,precipOBA) call calc_obsAnalysis(precipAll,sigmaBSqr,nobs,invDataDensities,nest,& agrmet_struc(nest)%bratseth_precip_max_dist, & agrmet_struc(nest)%bratseth_precip_back_err_scale_length, & - convergeThresh, is_gauge, sumObsEstimates, & + convergeThresh, USAF_is_gauge, sumObsEstimates, & npasses, precipOBA) ! Calculate analysis at grid points. @@ -4280,7 +4284,7 @@ end subroutine USAF_backQC !--------------------------------------------------------------------------- ! Checks if observation network is recognized as a gauge. - logical function is_gauge(net) + logical function USAF_is_gauge(net) implicit none character(len=32), intent(in) :: net logical :: answer @@ -4288,14 +4292,16 @@ logical function is_gauge(net) if (trim(net) .eq. "AMIL") answer = .true. if (trim(net) .eq. "CANA") answer = .true. if (trim(net) .eq. "FAA") answer = .true. + if (trim(net) .eq. "HADS") answer = .true. if (trim(net) .eq. "ICAO") answer = .true. + if (trim(net) .eq. "NWSLI") answer = .true. if (trim(net) .eq. "WMO") answer = .true. if (trim(net) .eq. "MOBL") answer = .true. if (trim(net) .eq. "SUPERGAGE") answer = .true. ! Handle reformatted CDMS data that are missing the network type. if (trim(net) .eq. "CDMS") answer = .true. - is_gauge = answer - end function is_gauge + USAF_is_gauge = answer + end function USAF_is_gauge !--------------------------------------------------------------------------- ! Dummy function for establishing a surface station is uncorrelated. From 821382e09bddec366aaaf51ace76a20fa9d7cba2 Mon Sep 17 00:00:00 2001 From: Eric Kemp Date: Wed, 29 May 2024 10:31:08 -0400 Subject: [PATCH 2/6] Recognized gage networks now specified in lis.config file. User must specify number of gage networks, and then the IDs of the networks. This removes the need to change source code if a new network is added. LIS will continue to reject obs and alert user if an unrecognized network is encountered in a preobs file. --- lis/metforcing/usaf/AGRMET_forcingMod.F90 | 4 ++ lis/metforcing/usaf/USAF_PreobsReaderMod.F90 | 7 +-- lis/metforcing/usaf/USAF_bratsethMod.F90 | 55 +++++++++++++------- lis/metforcing/usaf/USAF_getpcpobs.F90 | 2 +- lis/metforcing/usaf/readcrd_agrmet.F90 | 46 +++++++++++++++- 5 files changed, 89 insertions(+), 25 deletions(-) diff --git a/lis/metforcing/usaf/AGRMET_forcingMod.F90 b/lis/metforcing/usaf/AGRMET_forcingMod.F90 index 2c7f074f8..f98078191 100644 --- a/lis/metforcing/usaf/AGRMET_forcingMod.F90 +++ b/lis/metforcing/usaf/AGRMET_forcingMod.F90 @@ -730,6 +730,10 @@ module AGRMET_forcingMod real, allocatable :: gfs_nrt_bias_ratio(:,:) real, allocatable :: galwem_nrt_bias_ratio(:,:) integer :: pcp_back_bias_ratio_month + + ! EMK Add list of gage networks to use + integer :: num_gage_networks + character(32), allocatable :: gage_networks(:) end type agrmet_type_dec type(agrmet_type_dec), allocatable :: agrmet_struc(:) diff --git a/lis/metforcing/usaf/USAF_PreobsReaderMod.F90 b/lis/metforcing/usaf/USAF_PreobsReaderMod.F90 index a43d155d6..fb5fc386e 100644 --- a/lis/metforcing/usaf/USAF_PreobsReaderMod.F90 +++ b/lis/metforcing/usaf/USAF_PreobsReaderMod.F90 @@ -32,7 +32,7 @@ module USAF_PreobsReaderMod ! Read preobs files, perform simple preprocessing, and store ! in database. - subroutine USAF_read_preobs(preobsdir, presavdir, & + subroutine USAF_read_preobs(n, preobsdir, presavdir, & use_timestamp, & year, month, day, hour, use_expanded_station_ids, & alert_number) @@ -50,6 +50,7 @@ subroutine USAF_read_preobs(preobsdir, presavdir, & implicit none ! Arguments + integer, intent(in) :: n character(*), intent(in) :: preobsdir character(*), intent(in) :: presavdir integer, intent(in) :: use_timestamp @@ -349,7 +350,7 @@ subroutine USAF_read_preobs(preobsdir, presavdir, & ! EMK 20240524...Skip report if network is not recognized. ! Issue an alert. Keep track of unknown networks to avoid ! redundant alerts. - if (.not. USAF_is_gauge(network_tmp)) then + if (.not. USAF_is_gauge(network_tmp, n)) then do j = 1, MAX_NEW_NETWORKS if (trim(new_networks(j)) == trim(network_tmp)) then exit ! Out of immediate do loop @@ -367,7 +368,7 @@ subroutine USAF_read_preobs(preobsdir, presavdir, & trim(filename) message(4) = ' Network '//trim(network_tmp) message(5) = & - ' Contact NASA developers to add this network' + ' Modify lis.config to add this network' if (LIS_masterproc) then alert_number = alert_number + 1 call LIS_alert('LIS.USAF_read_preobs', & diff --git a/lis/metforcing/usaf/USAF_bratsethMod.F90 b/lis/metforcing/usaf/USAF_bratsethMod.F90 index 883c0b590..f5c91950e 100644 --- a/lis/metforcing/usaf/USAF_bratsethMod.F90 +++ b/lis/metforcing/usaf/USAF_bratsethMod.F90 @@ -1987,7 +1987,7 @@ subroutine calc_invDataDensities(this,sigmaBSqr,nest,max_dist, & num = num + this%sigmaOSqr(job) else if (trim(this%net(iob)) .eq. trim(this%net(job))) then ! Satellite observations have correlated errors. - if (.not. isUncorrObType(this%net(job))) then + if (.not. isUncorrObType(this%net(job),nest)) then if (.not. this%oErrScaleLength(job) > 0 .and. & .not. this%oErrScaleLength(job) < 0) then write(LIS_logunit,*) & @@ -2302,7 +2302,7 @@ subroutine calc_obsAnalysis(this,sigmaBSqr,nobs,invDataDensities,nest,& else if (trim(this%net(iob)) .eq. & trim(this%net(job))) then ! Satellite data have horizontal error correlations - if (.not. isUncorrObType(this%net(job))) then + if (.not. isUncorrObType(this%net(job),nest)) then weight = weight + & obsErrCov(this%sigmaOSqr(job), & this%oErrScaleLength(job), & @@ -4284,23 +4284,37 @@ end subroutine USAF_backQC !--------------------------------------------------------------------------- ! Checks if observation network is recognized as a gauge. - logical function USAF_is_gauge(net) - implicit none - character(len=32), intent(in) :: net - logical :: answer - answer = .false. - if (trim(net) .eq. "AMIL") answer = .true. - if (trim(net) .eq. "CANA") answer = .true. - if (trim(net) .eq. "FAA") answer = .true. - if (trim(net) .eq. "HADS") answer = .true. - if (trim(net) .eq. "ICAO") answer = .true. - if (trim(net) .eq. "NWSLI") answer = .true. - if (trim(net) .eq. "WMO") answer = .true. - if (trim(net) .eq. "MOBL") answer = .true. - if (trim(net) .eq. "SUPERGAGE") answer = .true. - ! Handle reformatted CDMS data that are missing the network type. - if (trim(net) .eq. "CDMS") answer = .true. - USAF_is_gauge = answer + logical function USAF_is_gauge(net, n) result(answer) + + ! Imports + use AGRMET_forcingMod, only: agrmet_struc + + ! Defaults + implicit none + + ! Arguments + character(len=32), intent(in) :: net + integer, intent(in) :: n + + ! Locals + integer :: j + + answer = .false. ! First guess + + ! Two special cases + if (trim(net) .eq. "SUPERGAGE" .or. & + trim(net) .eq. "CDMS") then + answer = .true. + return + end if + + ! General case: Check list from LIS config file + do j = 1, agrmet_struc(n)%num_gage_networks + if (trim(net) == trim(agrmet_struc(n)%gage_networks(j))) then + answer = .true. + exit + end if + end do end function USAF_is_gauge !--------------------------------------------------------------------------- @@ -4309,9 +4323,10 @@ end function USAF_is_gauge ! Bratseth routines that need to know which reports in a collection ! have correlated errors. When analyzing screen-level variables with ! surface stations, all observations should have uncorrelated errors. - logical function is_stn(net) + logical function is_stn(net, n) implicit none character(len=32), intent(in) :: net + integer, intent(in) :: n logical :: answer answer = .true. is_stn = answer diff --git a/lis/metforcing/usaf/USAF_getpcpobs.F90 b/lis/metforcing/usaf/USAF_getpcpobs.F90 index cf702b306..b62785950 100644 --- a/lis/metforcing/usaf/USAF_getpcpobs.F90 +++ b/lis/metforcing/usaf/USAF_getpcpobs.F90 @@ -82,7 +82,7 @@ subroutine USAF_getpcpobs(n, j6hr, month, use_twelve, pcp_src, & ! Read appropriate preobs file(s), intercompare with older presav2 ! files, and create new presav2 file for current date/time. - call USAF_read_preobs(preobsdir, & + call USAF_read_preobs(n, preobsdir, & trim(agrmet_struc(n)%analysisdir), & agrmet_struc(n)%use_timestamp, yr, mo, da, hr, & use_expanded_station_ids, alert_number) diff --git a/lis/metforcing/usaf/readcrd_agrmet.F90 b/lis/metforcing/usaf/readcrd_agrmet.F90 index ebac8311a..46ad68683 100644 --- a/lis/metforcing/usaf/readcrd_agrmet.F90 +++ b/lis/metforcing/usaf/readcrd_agrmet.F90 @@ -31,6 +31,7 @@ ! 28 Aug 2018 Added IMERG...........................Eric Kemp/NASA/SSAI ! 21 Feb 2020 added support for 10-km GALWEM........Eric Kemp/NASA/SSAI ! 05 Mar 2020 added support for new GFS filename version...Eric Kemp/NASA/SSAI +! 28 May 2024 added list of gauge networks to use..........Eric Kemp/NASA/SSAI ! ! !INTERFACE: subroutine readcrd_agrmet() @@ -53,7 +54,7 @@ subroutine readcrd_agrmet() ! the LIS configuration file. ! !EOP - integer:: n,rc + integer:: n,rc,j character(len=10) :: cdate character(len=255) :: message(20) ! EMK real :: tmp_max_dist ! EMK @@ -1205,6 +1206,49 @@ subroutine readcrd_agrmet() end do end if + ! EMK Get list of gage networks to use + call ESMF_ConfigFindLabel(LIS_config, & + "AGRMET number of gauge networks to use:", rc=rc) + call LIS_verify(rc, & + "[ERR] AGRMET number of gauge networks to use: not specified in config file") + do n=1, LIS_rc%nnest + call ESMF_ConfigGetAttribute(LIS_config, & + agrmet_struc(n)%num_gage_networks, rc=rc) + call LIS_verify(rc, & + "[ERR] AGRMET number of gauge networks to use: not specified in config file") + if (agrmet_struc(n)%num_gage_networks < 0) then + write(LIS_logunit,*) & + '[ERR] AGRMET number of gauge networks to use: must be nonnegative!' + write(LIS_logunit,*) & + '[ERR] Found ', agrmet_struc(n)%num_gage_networks + write(LIS_logunit, *) & + '[ERR] LIS will end!' + call LIS_verify(1, & + '[ERR] AGRMET number of gauge networks to use: must be nonnegative!') + end if + allocate(agrmet_struc(n)%gage_networks(agrmet_struc(n)%num_gage_networks)) + end do + call ESMF_ConfigFindLabel(LIS_config, & + 'AGRMET gauge networks to use::', rc=rc) + call LIS_verify(rc, & + "[ERR] AGRMET gauge networks to use: not specified in config file") + do n=1, LIS_rc%nnest + call ESMF_ConfigNextLine(LIS_config, rc=rc) + call LIS_verify(rc, & + '[ERR] AGRMET gauge networks to use: problem reading next line') + do j = 1, agrmet_struc(n)%num_gage_networks + call ESMF_ConfigGetAttribute(LIS_config, & + agrmet_struc(n)%gage_networks(j), rc=rc) + call LIS_verify(rc, & + '[ERR] AGRMET gauge networks to use: problem reading entry') + end do + write(LIS_logunit,*) & + '[INFO] Will use following gauge networks for domain ', n + do j = 1, agrmet_struc(n)%num_gage_networks + write(LIS_logunit,*) trim(agrmet_struc(n)%gage_networks(j)) + end do + end do + do n=1,LIS_rc%nnest agrmet_struc(n)%radProcessInterval = 1 agrmet_struc(n)%radProcessAlarmTime = 0.0 From 93de48f604cb000a4934dae112024a04b57c0b50 Mon Sep 17 00:00:00 2001 From: Eric Kemp Date: Fri, 31 May 2024 08:44:12 -0400 Subject: [PATCH 3/6] Removed unnecessary TRIM function calls. --- lis/metforcing/usaf/USAF_PreobsReaderMod.F90 | 4 ++-- lis/metforcing/usaf/USAF_bratsethMod.F90 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lis/metforcing/usaf/USAF_PreobsReaderMod.F90 b/lis/metforcing/usaf/USAF_PreobsReaderMod.F90 index fb5fc386e..dbf390367 100644 --- a/lis/metforcing/usaf/USAF_PreobsReaderMod.F90 +++ b/lis/metforcing/usaf/USAF_PreobsReaderMod.F90 @@ -352,9 +352,9 @@ subroutine USAF_read_preobs(n, preobsdir, presavdir, & ! redundant alerts. if (.not. USAF_is_gauge(network_tmp, n)) then do j = 1, MAX_NEW_NETWORKS - if (trim(new_networks(j)) == trim(network_tmp)) then + if (new_networks(j) == network_tmp) then exit ! Out of immediate do loop - else if (trim(new_networks(j)) == "NULL") then + else if (new_networks(j) == "NULL") then new_networks(j) = network_tmp write(LIS_logunit,*) & '[WARN] Found unrecognized network ', & diff --git a/lis/metforcing/usaf/USAF_bratsethMod.F90 b/lis/metforcing/usaf/USAF_bratsethMod.F90 index f5c91950e..df156d23b 100644 --- a/lis/metforcing/usaf/USAF_bratsethMod.F90 +++ b/lis/metforcing/usaf/USAF_bratsethMod.F90 @@ -4310,7 +4310,7 @@ logical function USAF_is_gauge(net, n) result(answer) ! General case: Check list from LIS config file do j = 1, agrmet_struc(n)%num_gage_networks - if (trim(net) == trim(agrmet_struc(n)%gage_networks(j))) then + if (net == agrmet_struc(n)%gage_networks(j)) then answer = .true. exit end if From 4897a4a4000e4445ce0d17e7f4819cf604c5b076 Mon Sep 17 00:00:00 2001 From: Eric Kemp Date: Thu, 11 Jul 2024 11:25:46 -0400 Subject: [PATCH 4/6] Added documentation. Tweaked error messages. --- lis/configs/lis.config.adoc | 10 ++++++++++ lis/metforcing/usaf/readcrd_agrmet.F90 | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lis/configs/lis.config.adoc b/lis/configs/lis.config.adoc index 39cb41f6c..48ee610f7 100644 --- a/lis/configs/lis.config.adoc +++ b/lis/configs/lis.config.adoc @@ -5463,6 +5463,12 @@ Acceptable values are: |"`cloud optical depth`" | use cloud optical depth |==== +`AGRMET number of gauge networks to use:` specifies nonnegative number +of gauge networks to use, to be identified in separate config entry. + +`AGRMET gauge networks to use::` specifies list of names of gauge +networks to be used. (One line of names per domain.) + .Example _lis.config_ entry .... AGRMET forcing directory: ./FORCING/ @@ -5535,6 +5541,10 @@ AGRMET CMORPH dy: AGRMET use GFS precip: 1 AGRMET use GALWEM precip: 0 AGRMET radiation derived from: 'cloud types' +AGRMET number of gauge networks to use: 6 +AGRMET gauge networks to use:: +AMIL CANA FAA ICAO WMO HADS NWSLI +:: .... diff --git a/lis/metforcing/usaf/readcrd_agrmet.F90 b/lis/metforcing/usaf/readcrd_agrmet.F90 index 46ad68683..6f7fc7f47 100644 --- a/lis/metforcing/usaf/readcrd_agrmet.F90 +++ b/lis/metforcing/usaf/readcrd_agrmet.F90 @@ -1231,16 +1231,16 @@ subroutine readcrd_agrmet() call ESMF_ConfigFindLabel(LIS_config, & 'AGRMET gauge networks to use::', rc=rc) call LIS_verify(rc, & - "[ERR] AGRMET gauge networks to use: not specified in config file") + "[ERR] AGRMET gauge networks to use:: not specified in config file") do n=1, LIS_rc%nnest call ESMF_ConfigNextLine(LIS_config, rc=rc) call LIS_verify(rc, & - '[ERR] AGRMET gauge networks to use: problem reading next line') + '[ERR] AGRMET gauge networks to use:: problem reading next line') do j = 1, agrmet_struc(n)%num_gage_networks call ESMF_ConfigGetAttribute(LIS_config, & agrmet_struc(n)%gage_networks(j), rc=rc) call LIS_verify(rc, & - '[ERR] AGRMET gauge networks to use: problem reading entry') + '[ERR] AGRMET gauge networks to use:: problem reading entry') end do write(LIS_logunit,*) & '[INFO] Will use following gauge networks for domain ', n From 1a3989b15e8618b86ac1d903e5afe85cea7af895 Mon Sep 17 00:00:00 2001 From: Eric Kemp Date: Thu, 11 Jul 2024 12:13:45 -0400 Subject: [PATCH 5/6] Fixed example. --- lis/configs/lis.config.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lis/configs/lis.config.adoc b/lis/configs/lis.config.adoc index 48ee610f7..275a6154b 100644 --- a/lis/configs/lis.config.adoc +++ b/lis/configs/lis.config.adoc @@ -5541,7 +5541,7 @@ AGRMET CMORPH dy: AGRMET use GFS precip: 1 AGRMET use GALWEM precip: 0 AGRMET radiation derived from: 'cloud types' -AGRMET number of gauge networks to use: 6 +AGRMET number of gauge networks to use: 7 AGRMET gauge networks to use:: AMIL CANA FAA ICAO WMO HADS NWSLI :: From 67bb59690d6c016bb698915bcbb91e81ebc03626 Mon Sep 17 00:00:00 2001 From: "James V. Geiger" Date: Thu, 11 Jul 2024 15:33:57 -0400 Subject: [PATCH 6/6] Make nest index available to call to USAF_is_gauge function --- lis/metforcing/usaf/AGRMET_getpcpobs.F90 | 4 ++-- lis/metforcing/usaf/AGRMET_storeobs.F90 | 5 +++-- lis/metforcing/usaf/AGRMET_storeobs_offhour.F90 | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lis/metforcing/usaf/AGRMET_getpcpobs.F90 b/lis/metforcing/usaf/AGRMET_getpcpobs.F90 index 80427b01d..7d93588a0 100644 --- a/lis/metforcing/usaf/AGRMET_getpcpobs.F90 +++ b/lis/metforcing/usaf/AGRMET_getpcpobs.F90 @@ -360,7 +360,7 @@ subroutine AGRMET_getpcpobs(n, j6hr, month, prcpwe, & write(LIS_logunit,*)'- CALLING STOREOBS TO PROCESS RAIN GAUGE DATA', j3hr write(LIS_logunit,*)' ' - call AGRMET_storeobs(nsize, nsize3, agrmet_struc(n)%max_pcpobs, & + call AGRMET_storeobs(n, nsize, nsize3, agrmet_struc(n)%max_pcpobs, & obs, obs3, ilat, ilon, & mscprc, sixprc, twfprc, network, plat_id, cdms_flag, bsn, & duration, j3hr, stncnt, alert_number, filename) @@ -370,7 +370,7 @@ subroutine AGRMET_getpcpobs(n, j6hr, month, prcpwe, & write(LIS_logunit,*)'- CALLING STOREOBS_OFFHOUR TO PROCESS 3HOUR RAIN GAUGE DATA', j3hr write(LIS_logunit,*)' ' - call AGRMET_storeobs_offhour(nsize, agrmet_struc(n)%max_pcpobs, & + call AGRMET_storeobs_offhour(n, nsize, agrmet_struc(n)%max_pcpobs, & obs3, ilat, ilon, & mscprc, sixprc, twfprc, network, plat_id, cdms_flag, bsn, & duration, nsize3, alert_number, filename) diff --git a/lis/metforcing/usaf/AGRMET_storeobs.F90 b/lis/metforcing/usaf/AGRMET_storeobs.F90 index 9eb050c7b..a05c3aa45 100644 --- a/lis/metforcing/usaf/AGRMET_storeobs.F90 +++ b/lis/metforcing/usaf/AGRMET_storeobs.F90 @@ -26,7 +26,7 @@ ! new unknown network is encountered..........Eric Kemp/NASA ! ! !INTERFACE: -subroutine AGRMET_storeobs(nsize, nsize3, isize, obs, obs3, ilat, ilon, & +subroutine AGRMET_storeobs(n, nsize, nsize3, isize, obs, obs3, ilat, ilon, & mscprc, sixprc, twfprc, network, plat_id, cdms_flag, bsn, & duration, julhr, stncnt, alert_number, filename) @@ -37,6 +37,7 @@ subroutine AGRMET_storeobs(nsize, nsize3, isize, obs, obs3, ilat, ilon, & implicit none + integer, intent(in) :: n integer, intent(in) :: isize character*10, intent(in) :: network(isize) character*10, intent(in) :: plat_id(isize) @@ -253,7 +254,7 @@ subroutine AGRMET_storeobs(nsize, nsize3, isize, obs, obs3, ilat, ilon, & ! EMK 20240523...Skip report if network is not recognized. Issue an ! alert. Keep track of unknown networks to avoid redundant alerts. - if (.not. USAF_is_gauge(network(irecord))) then + if (.not. USAF_is_gauge(network(irecord),n)) then do i = 1, MAX_NEW_NETWORKS if (new_networks(i) == network(irecord)) then cycle RECORD diff --git a/lis/metforcing/usaf/AGRMET_storeobs_offhour.F90 b/lis/metforcing/usaf/AGRMET_storeobs_offhour.F90 index 13e7047c4..9851a4d82 100644 --- a/lis/metforcing/usaf/AGRMET_storeobs_offhour.F90 +++ b/lis/metforcing/usaf/AGRMET_storeobs_offhour.F90 @@ -20,7 +20,7 @@ ! new unknown network is encountered..........Eric Kemp/NASA ! ! !INTERFACE: -subroutine AGRMET_storeobs_offhour(nsize, isize, obs, ilat, ilon, & +subroutine AGRMET_storeobs_offhour(n, nsize, isize, obs, ilat, ilon, & mscprc, sixprc, twfprc, network, plat_id, cdms_flag, bsn, & duration, stncnt, alert_number, filename) @@ -31,6 +31,7 @@ subroutine AGRMET_storeobs_offhour(nsize, isize, obs, ilat, ilon, & implicit none + integer, intent(in) :: n integer, intent(in) :: isize character*10, intent(in) :: network(isize) character*10, intent(in) :: plat_id(isize) @@ -215,7 +216,7 @@ subroutine AGRMET_storeobs_offhour(nsize, isize, obs, ilat, ilon, & ! EMK 20240523...Skip report if network is not recognized. Issue an ! alert. Keep track of unknown networks to avoid redundant alerts. - if (.not. USAF_is_gauge(network(irecord))) then + if (.not. USAF_is_gauge(network(irecord),n)) then do i = 1, MAX_NEW_NETWORKS if (new_networks(i) == network(irecord)) then cycle RECORD