Skip to content

Commit

Permalink
Merge pull request NASA-LIS#1449 from emkemp/feature/newobs_format
Browse files Browse the repository at this point in the history
WIGOS related updates, new gage processing, and some bug fixes
  • Loading branch information
jvgeiger committed Dec 12, 2023
2 parents 8067758 + 2ede759 commit 2412656
Show file tree
Hide file tree
Showing 35 changed files with 4,766 additions and 433 deletions.
34 changes: 21 additions & 13 deletions ldt/USAFSI/LDT_bratsethMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
! errors. Plus, added two new QC tests based on
! Brasnett. Plus, other bug fixes.
! 02 Nov 2020 Eric Kemp Removed blacklist at request of 557WW.
! 28 Jul 2023 Eric Kemp Expanded station ID to 31 characters.
! 24 Aug 2023 Eric Kemp Expanded station ID to 32 characters.
!
! DESCRIPTION:
! Source code for snow depth analysis using the Bratseth objective analysis
Expand Down Expand Up @@ -78,7 +80,7 @@ module LDT_bratsethMod
real :: back_err_v_corr_len ! Background error vert correlation length
integer :: nobs ! Number of observations
character*10, allocatable :: networks(:) ! Network name
character*10, allocatable :: platforms(:) ! Observation station ID
character*32, allocatable :: platforms(:) ! Observation station ID
real, allocatable :: obs(:) ! Observed values
real, allocatable :: lats(:) ! Latitude of observation (deg N)
real, allocatable :: lons(:) ! Longitude of observation (deg E)
Expand Down Expand Up @@ -229,8 +231,8 @@ end function LDT_bratseth_count_good_obs
! Append a single observation into a LDT_bratseth_t object. Value of
! interpolated background value is optional (useful for adding
! "superobservations")
subroutine LDT_bratseth_append_ob(this, network, platform, ob, lat, lon, &
elev, ob_err_var, back)
subroutine LDT_bratseth_append_ob(this, network, platform, ob, &
lat, lon, elev, ob_err_var, back)

! Imports
use LDT_logmod, only : LDT_logunit
Expand All @@ -241,7 +243,7 @@ subroutine LDT_bratseth_append_ob(this, network, platform, ob, lat, lon, &
! Arguments
class(LDT_bratseth_t),intent(inout) :: this
character(len=10), intent(in) :: network
character(len=10), intent(in) :: platform
character(len=32), intent(in) :: platform
real, intent(in) :: ob
real, intent(in) :: lat
real, intent(in) :: lon
Expand Down Expand Up @@ -838,7 +840,8 @@ subroutine LDT_bratseth_run_dup_qc(this)
integer :: count_dups
real :: mean, back, newlat, newlon, newelev
real :: ob_err_var, ob_err_corr_len
character(len=10) :: network, platform
character(len=10) :: network
character(len=32) :: platform
real :: diff
integer :: i,j
logical :: reject_all
Expand Down Expand Up @@ -1239,8 +1242,8 @@ end subroutine LDT_bratseth_run_water_qc
! obs, and rejected if deviation is too high. Superobs are considered
! "close" if they are in the same LIS grid box. Based on Lespinas et al
! (2015).
subroutine LDT_bratseth_run_superstat_qc(this, n, new_name, ncols, nrows, &
silent_rejects)
subroutine LDT_bratseth_run_superstat_qc(this, n, new_name, &
ncols, nrows, silent_rejects)

! Imports
use LDT_coreMod, only: LDT_domain, LDT_rc
Expand All @@ -1253,7 +1256,7 @@ subroutine LDT_bratseth_run_superstat_qc(this, n, new_name, ncols, nrows, &
! Arguments
class(LDT_bratseth_t), intent(inout) :: this
integer, intent(in) :: n
character(len=10), intent(in) :: new_name
character(len=32), intent(in) :: new_name
integer, intent(in) :: ncols
integer, intent(in) :: nrows
logical, optional, intent(in) :: silent_rejects
Expand All @@ -1262,7 +1265,8 @@ subroutine LDT_bratseth_run_superstat_qc(this, n, new_name, ncols, nrows, &
integer :: num_good_obs
integer :: num_rejected_obs, num_merged_obs, num_superobs
logical :: silent_rejects_local
character(len=10) :: network_new, platform_new
character(len=10) :: network_new
character(len=32) :: platform_new
integer, allocatable :: actions(:)
real, allocatable :: means(:,:)
real, allocatable :: superobs(:,:), superbacks(:,:)
Expand Down Expand Up @@ -1817,7 +1821,7 @@ subroutine LDT_bratseth_resort_bad_obs(this)
integer :: iob,job
logical :: found_replacement
character*10 :: network
character*10 :: platform
character*32 :: platform
real :: ob, lat, lon, elev, ob_err_var, back
integer :: qc
character*80 :: failed_qc_test
Expand Down Expand Up @@ -2042,6 +2046,9 @@ end subroutine LDT_bratseth_run_missing_elev_qc
! See https://en.wikipedia.org/wiki/Comb_sort
subroutine LDT_bratseth_sort_obs_by_id(this)

! Imports
use LDT_logmod, only : LDT_logunit

! Defaults
implicit none

Expand All @@ -2052,6 +2059,7 @@ subroutine LDT_bratseth_sort_obs_by_id(this)
integer :: gap
integer :: switch
character*10 :: ctemp10
character*32 :: ctemp32
character*80 :: ctemp80
real :: rtemp
integer :: itemp
Expand All @@ -2078,9 +2086,9 @@ subroutine LDT_bratseth_sort_obs_by_id(this)
this%networks(i) = this%networks(j)
this%networks(j) = ctemp10

ctemp10 = this%platforms(i)
ctemp32 = this%platforms(i)
this%platforms(i) = this%platforms(j)
this%platforms(j) = ctemp10
this%platforms(j) = ctemp32

rtemp = this%obs(i)
this%obs(i) = this%obs(j)
Expand Down Expand Up @@ -2152,7 +2160,7 @@ subroutine LDT_bratseth_print_snowdepths(this,minprt)
int(this%elevs(i)), this%obs(i), trim(this%reject_reasons(i))
end if
end do ! i
7000 format (/,'[INFO] NETID = ',A5,' STATION ID = ',A9, &
7000 format (/,'[INFO] NETID = ',A5,' STATION ID = ',A32, &
' LAT = ',F6.2,' LON = ',F7.2, &
' ELEV(M) = ',I5,' DEPTH(M) = ', F7.5, &
' QC VERDICT = ',A)
Expand Down
12 changes: 11 additions & 1 deletion ldt/USAFSI/LDT_usafsiMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module LDT_usafsiMod
character*10 :: date10
character*255 :: fracdir
character*255 :: modif
integer :: sfcobsfmt ! EMK 20230727
character*255 :: sfcobs
character*255 :: ssmis
character*255 :: gmi !kyh20201118
Expand Down Expand Up @@ -139,11 +140,20 @@ subroutine LDT_usafsiInit()
call ESMF_ConfigGetAttribute(LDT_config, usafsi_settings%modif, rc=rc)
call LDT_verify(rc, trim(cfg_entry)//" not specified")

! New sfcobs format...EMK 20230728
cfg_entry = "USAFSI surface obs data format:"
call ESMF_ConfigFindLabel(LDT_config, trim(cfg_entry), rc=rc)
call LDT_verify(rc, trim(cfg_entry)//" not specified")
call ESMF_ConfigGetAttribute(LDT_config, usafsi_settings%sfcobsfmt, &
rc=rc)
call LDT_verify(rc, trim(cfg_entry)//" not specified")

! Get sfcobs
cfg_entry = "USAFSI surface obs data directory:"
call ESMF_ConfigFindLabel(LDT_config, trim(cfg_entry), rc=rc)
call LDT_verify(rc, trim(cfg_entry)//" not specified")
call ESMF_ConfigGetAttribute(LDT_config, usafsi_settings%sfcobs, rc=rc)
call ESMF_ConfigGetAttribute(LDT_config, usafsi_settings%sfcobs, &
rc=rc)
call LDT_verify(rc, trim(cfg_entry)//" not specified")

!------------------------------------------------------------------------------kyh20201118
Expand Down
Loading

0 comments on commit 2412656

Please sign in to comment.