@@ -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
@@ -1747,19 +1747,47 @@ subroutine read_obs_sm_ASCAT_EUMET( &
17471747 ! Are we in the required assimilation window?
17481748 !
17491749 ! e.g. Y2019/M07/M01-ASCA-ASCSMO02-NA-5.0-20190702075700.000000000Z-20190702084627-1350204.bfr
1750+ ! Y2024/M02/W_XX-EUMETSAT-Darmstadt,SOUNDING+SATELLITE,METOPC+ASCAT_C_EUMR_20240229095700_27567_eps_o_250_ssm_l2.bin
17501751 !
1751- ! 12345678901234567890123456789012345678901234567890123456789012345678901234567890
1752- ! 1 2 3 4 5 6 7
1752+ ! 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
1753+ ! 1 2 3 4 5 6 7 8 9 10 11 12
17531754
1754- str_date_time = tmpfname(36 :49 )
1755-
1755+ ! Check if tmpfname contains "ASCA-ASCSMO02" or "W_XX-EUMETSAT", error if neither
1756+
1757+ if (index (tmpfname, " ASCA-ASCSMO02" ) /= 0 ) then
1758+ str_date_time = tmpfname(36 :49 )
1759+ else if (index (tmpfname, " W_XX-EUMETSAT" ) /= 0 ) then
1760+ str_date_time = tmpfname(74 :87 )
1761+ else
1762+ err_msg = ' Unknown ASCAT observation filename format'
1763+ call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg)
1764+ end if
1765+
1766+ ! Check that str_date_time only contains numeric characters
1767+
1768+ do ii = 1 , len (str_date_time)
1769+ if (ichar (str_date_time(ii:ii)) < ichar (' 0' ) .or. ichar (str_date_time(ii:ii)) > ichar (' 9' )) then
1770+ err_msg = ' The date-time string parsed from the ASCAT observation filename contains non-numeric characters'
1771+ call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg)
1772+ end if
1773+ end do
1774+
17561775 read (str_date_time( 1 : 4 ), * ) date_time_tmp% year
17571776 read (str_date_time( 5 : 6 ), * ) date_time_tmp% month
17581777 read (str_date_time( 7 : 8 ), * ) date_time_tmp% day
17591778 read (str_date_time( 9 :10 ), * ) date_time_tmp% hour
17601779 read (str_date_time(11 :12 ), * ) date_time_tmp% min
17611780 read (str_date_time(13 :14 ), * ) date_time_tmp% sec
1781+
1782+ ! Check if date_time_tmp%year and date_time_tmp%month and date_time_tmp%day are valid
17621783
1784+ if (date_time_tmp% year < 1900 .or. date_time_tmp% year > 2100 .or. &
1785+ date_time_tmp% month < 1 .or. date_time_tmp% month > 12 .or. &
1786+ date_time_tmp% day < 1 .or. date_time_tmp% day > 31 ) then
1787+ err_msg = ' A valid date-time string has not been successfully parsed from the ASCAT observation filename'
1788+ call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg)
1789+ end if
1790+
17631791 if ( datetime_lt_refdatetime( date_time_low_fname, date_time_tmp ) .and. &
17641792 datetime_le_refdatetime( date_time_tmp, date_time_up ) ) then
17651793
@@ -6132,7 +6160,7 @@ subroutine read_obs_SMAP_FT( date_time, N_catd, this_obs_param, &
61326160 character (100 ) :: dset_name_lon, dset_name_lat
61336161 character (100 ) :: dset_name_time, dset_name_ft, dset_name_ft_qual_flag
61346162
6135- character (100 ), dimension (2 * N_halforbits_max) :: fname_list ! max 2 days of files
6163+ character (200 ), dimension (2 * N_halforbits_max) :: fname_list ! max 2 days of files
61366164
61376165 integer , dimension (7 ) :: dset_size
61386166 integer , dimension (N_fnames_max) :: N_obs_kept
@@ -6839,7 +6867,7 @@ subroutine read_obs_SMAP_halforbit_Tb( date_time, N_catd, this_obs_param, &
68396867 character (100 ) :: dset_name_time_1, dset_name_tb_1, dset_name_tb_qual_flag_1
68406868 character (100 ) :: dset_name_time_2, dset_name_tb_2, dset_name_tb_qual_flag_2
68416869
6842- character (100 ), dimension (2 * N_halforbits_max) :: fname_list ! max 2 days of files
6870+ character (200 ), dimension (2 * N_halforbits_max) :: fname_list ! max 2 days of files
68436871
68446872 integer , dimension (7 ) :: dset_size
68456873 integer , dimension (N_fnames_max) :: N_obs_kept
@@ -8167,7 +8195,7 @@ subroutine read_obs_fnames( date_time, this_obs_param, &
81678195
81688196 integer , intent (out ) :: N_fnames
81698197
8170- character (100 ), dimension (N_max), intent (out ) :: fname_list
8198+ character (200 ), dimension (N_max), intent (out ) :: fname_list
81718199
81728200 integer , optional , intent (in ) :: obs_dir_hier
81738201
@@ -8176,7 +8204,7 @@ subroutine read_obs_fnames( date_time, this_obs_param, &
81768204 character (300 ) :: fname
81778205 character (200 ) :: fpath_tmp
81788206 character ( 80 ) :: fname_tmp
8179- character ( 80 ) :: tmpst r8 0
8207+ character (200 ) :: tmpstr200
81808208
81818209 character ( 14 ) :: YYYYMMDDdir
81828210 character ( 10 ) :: YYYYMMdir
@@ -8225,7 +8253,7 @@ subroutine read_obs_fnames( date_time, this_obs_param, &
82258253
82268254 do while (istat== 0 )
82278255
8228- read (10 ,* ,iostat= istat) tmpst r8 0
8256+ read (10 , ' (A) ' ,iostat= istat) tmpstr200
82298257
82308258 if (istat== 0 ) then
82318259
@@ -8238,15 +8266,15 @@ subroutine read_obs_fnames( date_time, this_obs_param, &
82388266
82398267 ! preface file names with "Yyyyy/Mmm/Ddd" (default)
82408268
8241- fname_list(ii) = YYYYMMDDdir // trim (tmpst r8 0 )
8269+ fname_list(ii) = YYYYMMDDdir // trim (tmpstr200 )
82428270
82438271 if (present (obs_dir_hier)) then
82448272
82458273 if (obs_dir_hier == 1 ) then
82468274
82478275 ! preface file names with "Yyyyy/Mmm"
82488276
8249- fname_list(ii) = YYYYMMdir // trim (tmpst r8 0 )
8277+ fname_list(ii) = YYYYMMdir // trim (tmpstr200 )
82508278
82518279 else
82528280
0 commit comments