@@ -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 ) :: tmpst r8 0
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) tmpst r8 0
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 (tmpst r8 0 )
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 (tmpst r8 0 )
8284+ fname_list(ii) = YYYYMMdir // trim (tmpstr200 )
82508285
82518286 else
82528287
0 commit comments