Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support reading corrected precipitation from aggregated daily netcdf files #718

Merged
merged 5 commits into from
Feb 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3207,7 +3207,7 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, &

logical :: minimize_shift, use_prec_corr, use_Predictor, tmp_init

logical :: daily_met_files
logical :: daily_met_files, daily_precipcorr_files

integer :: nv_id, ierr, icount(3), istart(3), lonid, latid

Expand Down Expand Up @@ -3696,9 +3696,9 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, &
if ( (use_prec_corr) .and. (GEOSgcm_defs(GEOSgcm_var,1)(1:4)=='PREC') ) then

call get_GEOS_corr_prec_filename(fname_full,file_exists,date_time_tmp, &
prec_path_tmp, met_tag_tmp, GEOSgcm_defs(GEOSgcm_var,:), precip_corr_file_ext )
prec_path_tmp, met_tag_tmp, GEOSgcm_defs(GEOSgcm_var,:), precip_corr_file_ext,daily_precipcorr_files )

single_time_in_file = .true. ! corr precip files are always hourly (incl. MERRA-2)
single_time_in_file = .not. daily_precipcorr_files ! corr precip files are always hourly (incl. MERRA-2)

else

Expand Down Expand Up @@ -5622,26 +5622,27 @@ subroutine GEOS_closefile(fid)
! ****************************************************************

subroutine get_GEOS_corr_prec_filename(fname_full,file_exists, date_time, met_path, met_tag, &
GEOSgcm_defs, file_ext )
GEOSgcm_defs, file_ext,daily_files )

implicit none
character(*), intent(inout) :: fname_full
logical,intent(out) :: file_exists
logical,intent(out) :: daily_files
type(date_time_type), intent(in) :: date_time
character(*), intent(in) :: met_path
character(*), intent(in) :: met_tag
character( 40), dimension(5), intent(in) :: GEOSgcm_defs
character(*), intent(in) :: file_ext

! local variables

character(100) :: fname
character(100) :: fname, fname_tmp
character(200) :: fdir
character(300) :: fname_full_tmp1, fname_full_tmp2
character(300) :: fname_full_tmp1, fname_full_tmp2, fname_full_tmp3
character( 4) :: YYYY, HHMM
character( 2) :: MM, DD

integer :: tmpind, tmpindend
integer :: tmpind, tmpindend,is

character(len=*), parameter :: Iam = 'get_GEOS_corr_prec_filename'

Expand Down Expand Up @@ -5678,7 +5679,7 @@ subroutine get_GEOS_corr_prec_filename(fname_full,file_exists, date_time, met_pa
! -----------------------------------------------------------------------

file_exists = .false. ! initialize

daily_files = .false.

! first try: look for file in year/month dir
! (LDAS standard for corrected G5DAS precip)
Expand All @@ -5691,8 +5692,20 @@ subroutine get_GEOS_corr_prec_filename(fname_full,file_exists, date_time, met_pa

fname_full_tmp1 = trim(fname_full) ! remember for error log below

! second try: look for daily file in year/month dir
is = index(fname,'z.nc')
gmao-rreichle marked this conversation as resolved.
Show resolved Hide resolved
fname_tmp = fname(1:is-6)//'.'//trim(file_ext)
fname_full = trim(fdir) // 'M' // MM // '/' // trim(fname_tmp)

! second try: *without* "/Mmm" (month) dir
inquire(file=fname_full, exist=file_exists)

if (file_exists) then
daily_files = .true.
return
endif ! done
fname_full_tmp2 = trim(fname_full) ! remember for error log below

! third try: *without* "/Mmm" (month) dir

! THIS TRY IS PROBABLY OBSOLETE BUT COULD EASILY BE TWEAKED TO LOOK
! IN year/month/day DIRECTORY (WHICH POSSIBLY APPLIES TO CORRECTED
Expand All @@ -5705,7 +5718,7 @@ subroutine get_GEOS_corr_prec_filename(fname_full,file_exists, date_time, met_pa

if (file_exists) return ! done

fname_full_tmp2 = trim(fname_full) ! remember for error log below
fname_full_tmp3 = trim(fname_full) ! remember for error log below


! last try: for GEOS FP with generic file names, try product counter '.V02.' in year/month dir
Expand Down
Loading