@@ -3211,6 +3211,8 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, &
32113211 character ( 3 ) :: met_file_ext
32123212 character ( 3 ) :: precip_corr_file_ext
32133213
3214+ character ( 8 ) :: S2S3_init_YYYYMMDD
3215+
32143216 integer :: N_GEOSgcm_vars, N_lon_tmp, N_lat_tmp
32153217
32163218 real :: this_lon, this_lat
@@ -3231,7 +3233,7 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, &
32313233 logical :: daily_met_files, daily_precipcorr_files
32323234
32333235 logical :: is_S2S3_fcst
3234-
3236+
32353237 integer :: nv_id, ierr, icount(3 ), istart(3 ), lonid, latid
32363238
32373239 character (len=* ), parameter :: Iam = ' get_GEOS'
@@ -3710,6 +3712,8 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, &
37103712 precip_corr_file_ext = ' nc4'
37113713
37123714 is_S2S3_fcst = .false.
3715+
3716+ S2S3_init_YYYYMMDD = ' xxxxxxxx' ! character(8)
37133717
37143718 if (met_tag(4 :8 )==' merra' ) then ! MERRA
37153719
@@ -3825,27 +3829,29 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, &
38253829 met_path_bkwd, prec_path_bkwd, met_tag_bkwd, use_prec_corr )
38263830
38273831
3828- elseif (met_tag(1 :8 )==' GEOSS2S3' ) then ! GEOS S2S v3
3832+ elseif (met_tag(1 :8 )==' GEOSS2S3' ) then ! GEOS S2S v3
38293833
38303834 N_GEOSgcm_vars = N_S2S3_vars
38313835
3832- PAR_available = .false. ! S2S3 does not have PAR
3836+ PAR_available = .false. ! S2S3 does not have PAR
38333837
3834- S2S3_file_specs = .true.
3838+ S2S3_file_specs = .true.
38353839
3836- single_time_in_file = .false. ! FCST: monthly files, AODAS: daily files
3840+ single_time_in_file = .false. ! FCST: monthly files, AODAS: daily files
38373841
38383842 if (met_tag(9 :12 )==' FCST' ) then
38393843
3840- is_S2S3_fcst = .true.
3844+ is_S2S3_fcst = .true.
38413845
3842- GEOSgcm_defs = S2S3FCST_defs
3846+ GEOSgcm_defs = S2S3FCST_defs
3847+
3848+ S2S3_init_YYYYMMDD = met_tag(21 :28 ) ! S2S3 FCST init YYYYMMDD; character(8)
38433849
38443850 elseif (met_tag(9 :13 )==' AODAS' ) then
38453851
3846- daily_met_files = .true.
3852+ daily_met_files = .true.
38473853
3848- GEOSgcm_defs = S2S3AODAS_defs
3854+ GEOSgcm_defs = S2S3AODAS_defs
38493855
38503856 else
38513857
@@ -3912,7 +3918,7 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, &
39123918
39133919 if (trim (GEOSgcm_defs(GEOSgcm_var,1 ))==" dummy" ) cycle ! skip "dummy" variable (e.g., no PAR for S2S3)
39143920
3915- ! open GEOS file (G5DAS or MERRA or MERRA-2)
3921+ ! open GEOS file (G5DAS or MERRA or MERRA-2 or ... )
39163922 !
39173923 ! Initial "tavg1_2d_*_Nx" files may not be available. In this case,
39183924 ! use first available file. For G5DAS file specs, only "PS" is affected
@@ -3927,6 +3933,25 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, &
39273933 ! the file at date_time_fwd).
39283934
39293935 do j= 1 ,2
3936+
3937+ if (is_S2S3_fcst .and. j== 1 ) then
3938+
3939+ ! special S2S3 FCST case: must skip j==1 at S2S3 FCST initialization time because (monthly) file
3940+ ! exists but does not contain data for "date_time_bkwd"
3941+
3942+ write (YYYYMMDD(1 :4 ),' (i4.4)' ) date_time_tmp% year
3943+ write (YYYYMMDD(5 :6 ),' (i2.2)' ) date_time_tmp% month
3944+ write (YYYYMMDD(7 :8 ),' (i2.2)' ) date_time_tmp% day
3945+
3946+ date_time_tmp% hour = 0
3947+ date_time_tmp% min = 0
3948+ date_time_tmp% sec = 0
3949+
3950+ call augment_date_time( - force_dtstep, date_time_tmp ) ! S2S3 fcst is initialized at S2S3_init_YYYYMMDD minus 3 hours
3951+
3952+ if datetime_eq_refdatetime( date_time_tmp, date_time_inst ) cycle ! skip to j==2, i.e., try "date_time_fwd"
3953+
3954+ end if
39303955
39313956 ! determine time stamp on file and corresponding met_path, prec_path, & met_tag
39323957
@@ -3950,6 +3975,7 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, &
39503975 met_path_tmp = met_path_inst
39513976 prec_path_tmp = prec_path_inst
39523977 met_tag_tmp = met_tag_inst
3978+
39533979 else
39543980
39553981 call ldas_abort(LDAS_GENERIC_ERROR, Iam, ' unknown GEOSgcm_defs(2)' )
@@ -3979,7 +4005,7 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, &
39794005 end if
39804006
39814007
3982- if ( file_exists .and. ( .not. is_S2S3_fcst) ) then ! S2S3 FCST has monthly files
4008+ if ( file_exists ) then
39834009
39844010 exit ! exit j loop after successfully finding file
39854011
@@ -3996,7 +4022,7 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, &
39964022 ' read from some file for backward compatibility with ' // &
39974023 ' MERRA forcing.'
39984024
3999- write (logunit,* ) ' try again with different file...'
4025+ write (logunit,* ) ' try again with different file (or time) ...'
40004026
40014027 else
40024028
@@ -5635,8 +5661,8 @@ subroutine get_GEOS_forcing_filename(fname_full,file_exists, date_time, daily_fi
56355661 character ( 16 ) :: time_stamp
56365662 character ( 4 ) :: YYYY, HHMM, day_dir
56375663 character ( 2 ) :: MM, DD
5638- character ( 8 ) :: S2S3_init_YYYYMMDD ! S2S3 initial date, e.g. "20160101"
5639- character ( 4 ) :: S2S3_ens_num ! S2S3 ensemble member, e.g. "ens1"
5664+ character ( 8 ) :: S2S3_init_YYYYMMDD ! S2S3 fcst initialization YYYYMMDD (fcst start time is YYYYMMDD minus 3 hours)
5665+ character ( 4 ) :: S2S3_ens_num ! S2S3 fcst ensemble member, e.g. "ens1"
56405666
56415667 integer :: tmpind, tmpindend
56425668
@@ -5705,7 +5731,7 @@ subroutine get_GEOS_forcing_filename(fname_full,file_exists, date_time, daily_fi
57055731 ! GEOSS2S3AODAS
57065732
57075733 S2S3_ens_num = trim (met_tag(15 :18 ))
5708- S2S3_init_YYYYMMDD = trim ( met_tag(21 :28 ))
5734+ S2S3_init_YYYYMMDD = met_tag(21 :28 ) ! character(8 )
57095735
57105736 fname = S2S3_init_YYYYMMDD // ' /' // S2S3_ens_num // ' /GEOSS2S3.' // YYYY // MM // ' .nc4'
57115737
0 commit comments