Skip to content

Commit e000ba1

Browse files
Update ASCAT obs reader to work with original and revised file name templates #69
2 parents 930dc28 + 01c541d commit e000ba1

File tree

3 files changed

+62
-19
lines changed

3 files changed

+62
-19
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
### Changed
1717

18+
- Updated read_obs_sm_ASCAT_EUMET to work with both original and revised file name templates.
19+
1820
### Fixed
1921

2022
### Removed

GEOSlandassim_GridComp/clsm_ensupd_read_obs.F90

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,7 @@ subroutine read_obs_sm_ASCAT_EUMET( &
16671667

16681668
! --------------------
16691669

1670-
character(100), dimension(2*N_fnames_max) :: fname_list ! max 2 days of files
1670+
character(200), dimension(2*N_fnames_max) :: fname_list ! max 2 days of files
16711671

16721672
real, dimension(:), allocatable :: tmp1_obs, tmp1_lat, tmp1_lon
16731673
real*8, dimension(:), allocatable :: tmp1_jtime
@@ -1741,24 +1741,59 @@ subroutine read_obs_sm_ASCAT_EUMET( &
17411741
N_tmp = 0
17421742

17431743
do kk = 1,N_fnames
1744-
1744+
17451745
tmpfname = fname_list(kk)
1746-
1746+
17471747
! Are we in the required assimilation window?
17481748
!
1749+
! NOTE: EUMETSAT changed the file name template sometime in 2023 or 2024.
1750+
! There was no change to the file contents.
1751+
! Files from the original download (through data day ~1 Jun 2023) have
1752+
! the original file name template ("M0[X]-ASCA..."), more recently downloaded
1753+
! files have the revised template ("W_XX-EUMETSAT...").
1754+
! This reader accommodates both templates:
1755+
!
17491756
! e.g. Y2019/M07/M01-ASCA-ASCSMO02-NA-5.0-20190702075700.000000000Z-20190702084627-1350204.bfr
1757+
! Y2024/M02/W_XX-EUMETSAT-Darmstadt,SOUNDING+SATELLITE,METOPC+ASCAT_C_EUMR_20240229095700_27567_eps_o_250_ssm_l2.bin
17501758
!
1751-
! 12345678901234567890123456789012345678901234567890123456789012345678901234567890
1752-
! 1 2 3 4 5 6 7
1753-
1754-
str_date_time = tmpfname(36:49)
1755-
1759+
! 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
1760+
! 1 2 3 4 5 6 7 8 9 10 11 12
1761+
1762+
! check if tmpfname contains "ASCA-ASCSMO02" or "W_XX-EUMETSAT", error if neither
1763+
1764+
if (index(tmpfname, "ASCA-ASCSMO02") /= 0) then
1765+
str_date_time = tmpfname(36:49)
1766+
else if (index(tmpfname, "W_XX-EUMETSAT") /= 0) then
1767+
str_date_time = tmpfname(74:87)
1768+
else
1769+
err_msg = 'Unknown ASCAT observation file name format'
1770+
call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg)
1771+
end if
1772+
1773+
! check if str_date_time only contains numeric characters
1774+
1775+
do ii = 1, len(trim(str_date_time))
1776+
if (ichar(str_date_time(ii:ii)) < ichar('0') .or. ichar(str_date_time(ii:ii)) > ichar('9')) then
1777+
err_msg = 'Date-time string parsed from ASCAT sm obs file name contains non-numeric characters'
1778+
call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg)
1779+
end if
1780+
end do
1781+
17561782
read(str_date_time( 1: 4), *) date_time_tmp%year
17571783
read(str_date_time( 5: 6), *) date_time_tmp%month
17581784
read(str_date_time( 7: 8), *) date_time_tmp%day
17591785
read(str_date_time( 9:10), *) date_time_tmp%hour
17601786
read(str_date_time(11:12), *) date_time_tmp%min
17611787
read(str_date_time(13:14), *) date_time_tmp%sec
1788+
1789+
! check if year, month, and day are valid
1790+
1791+
if ( date_time_tmp%year < 2007 .or. date_time_tmp%year > 2100 .or. &
1792+
date_time_tmp%month < 1 .or. date_time_tmp%month > 12 .or. &
1793+
date_time_tmp%day < 1 .or. date_time_tmp%day > 31 ) then
1794+
err_msg = 'Could not parse valid date-time string from ASCAT obs file name'
1795+
call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg)
1796+
end if
17621797

17631798
if ( datetime_lt_refdatetime( date_time_low_fname, date_time_tmp ) .and. &
17641799
datetime_le_refdatetime( date_time_tmp, date_time_up ) ) then
@@ -6132,7 +6167,7 @@ subroutine read_obs_SMAP_FT( date_time, N_catd, this_obs_param, &
61326167
character(100) :: dset_name_lon, dset_name_lat
61336168
character(100) :: dset_name_time, dset_name_ft, dset_name_ft_qual_flag
61346169

6135-
character(100), dimension(2*N_halforbits_max) :: fname_list ! max 2 days of files
6170+
character(200), dimension(2*N_halforbits_max) :: fname_list ! max 2 days of files
61366171

61376172
integer, dimension(7) :: dset_size
61386173
integer, dimension(N_fnames_max) :: N_obs_kept
@@ -6839,7 +6874,7 @@ subroutine read_obs_SMAP_halforbit_Tb( date_time, N_catd, this_obs_param, &
68396874
character(100) :: dset_name_time_1, dset_name_tb_1, dset_name_tb_qual_flag_1
68406875
character(100) :: dset_name_time_2, dset_name_tb_2, dset_name_tb_qual_flag_2
68416876

6842-
character(100), dimension(2*N_halforbits_max) :: fname_list ! max 2 days of files
6877+
character(200), dimension(2*N_halforbits_max) :: fname_list ! max 2 days of files
68436878

68446879
integer, dimension(7) :: dset_size
68456880
integer, dimension(N_fnames_max) :: N_obs_kept
@@ -8167,7 +8202,7 @@ subroutine read_obs_fnames( date_time, this_obs_param, &
81678202

81688203
integer, intent(out) :: N_fnames
81698204

8170-
character(100), dimension(N_max), intent(out) :: fname_list
8205+
character(200), dimension(N_max), intent(out) :: fname_list
81718206

81728207
integer, optional, intent(in) :: obs_dir_hier
81738208

@@ -8176,7 +8211,7 @@ subroutine read_obs_fnames( date_time, this_obs_param, &
81768211
character(300) :: fname
81778212
character(200) :: fpath_tmp
81788213
character( 80) :: fname_tmp
8179-
character( 80) :: tmpstr80
8214+
character(200) :: tmpstr200
81808215

81818216
character( 14) :: YYYYMMDDdir
81828217
character( 10) :: YYYYMMdir
@@ -8225,7 +8260,7 @@ subroutine read_obs_fnames( date_time, this_obs_param, &
82258260

82268261
do while (istat==0)
82278262

8228-
read(10,*,iostat=istat) tmpstr80
8263+
read(10, '(A)',iostat=istat) tmpstr200
82298264

82308265
if (istat==0) then
82318266

@@ -8238,15 +8273,15 @@ subroutine read_obs_fnames( date_time, this_obs_param, &
82388273

82398274
! preface file names with "Yyyyy/Mmm/Ddd" (default)
82408275

8241-
fname_list(ii) = YYYYMMDDdir // trim(tmpstr80)
8276+
fname_list(ii) = YYYYMMDDdir // trim(tmpstr200)
82428277

82438278
if (present(obs_dir_hier)) then
82448279

82458280
if (obs_dir_hier == 1) then
82468281

82478282
! preface file names with "Yyyyy/Mmm"
82488283

8249-
fname_list(ii) = YYYYMMdir // trim(tmpstr80)
8284+
fname_list(ii) = YYYYMMdir // trim(tmpstr200)
82508285

82518286
else
82528287

GEOSldas_App/LDASsa_DEFAULT_inputs_ensupd.nml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,7 +2158,13 @@ obs_param_nml(48)%xcorr = 0.1875
21582158
obs_param_nml(48)%ycorr = 0.1875
21592159
obs_param_nml(48)%adapt = 0
21602160

2161-
! --------------------------------------------------------------------
2161+
! --------------------------------------------------------------------------------------------------------------
2162+
!
2163+
! ASCAT_MET[X]_SM soil moisture observations from EUMETSAT
2164+
!
2165+
! Leave %name blank. Provide text files that contain file names via %flistpath and %flistname.
2166+
!
2167+
! -------------------
21622168
!
21632169
! 49 = ASCAT_META_SM (ASCAT soil moisture ascending and descending orbits)
21642170
!
@@ -2182,7 +2188,7 @@ obs_param_nml(49)%nodata = -9999.
21822188
obs_param_nml(49)%varname = 'sfds'
21832189
obs_param_nml(49)%units = '%'
21842190
obs_param_nml(49)%path = '/discover/nobackup/projects/gmao/smap/SMAP_Nature/ASCAT_EUMETSAT/Metop_A/'
2185-
obs_param_nml(49)%name = 'M02-ASCA-ASCSMO02'
2191+
obs_param_nml(49)%name = ''
21862192
obs_param_nml(49)%maskpath = ''
21872193
obs_param_nml(49)%maskname = ''
21882194
obs_param_nml(49)%scalepath = ''
@@ -2221,7 +2227,7 @@ obs_param_nml(50)%nodata = -9999.
22212227
obs_param_nml(50)%varname = 'sfds'
22222228
obs_param_nml(50)%units = '%'
22232229
obs_param_nml(50)%path = '/discover/nobackup/projects/gmao/smap/SMAP_Nature/ASCAT_EUMETSAT/Metop_B/'
2224-
obs_param_nml(50)%name = 'M01-ASCA-ASCSMO02'
2230+
obs_param_nml(50)%name = ''
22252231
obs_param_nml(50)%maskpath = ''
22262232
obs_param_nml(50)%maskname = ''
22272233
obs_param_nml(50)%scalepath = ''
@@ -2260,7 +2266,7 @@ obs_param_nml(51)%nodata = -9999.
22602266
obs_param_nml(51)%varname = 'sfds'
22612267
obs_param_nml(51)%units = '%'
22622268
obs_param_nml(51)%path = '/discover/nobackup/projects/gmao/smap/SMAP_Nature/ASCAT_EUMETSAT/Metop_C/'
2263-
obs_param_nml(51)%name = 'M03-ASCA-ASCSMO02'
2269+
obs_param_nml(51)%name = ''
22642270
obs_param_nml(51)%maskpath = ''
22652271
obs_param_nml(51)%maskname = ''
22662272
obs_param_nml(51)%scalepath = ''

0 commit comments

Comments
 (0)