Skip to content

Commit

Permalink
Add an option to the ldt.config to specify the ouput name
Browse files Browse the repository at this point in the history
  • Loading branch information
yyoon4 committed Dec 12, 2019
1 parent 51aeb47 commit c6e37b3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
9 changes: 7 additions & 2 deletions ldt/LDTSI/LDTSI_netcdfMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,19 @@ subroutine LDTSI_write_netcdf(date10)
real :: dlat, dlon
real :: swlat, swlon
real :: nelat, nelon
character*20 :: output_prefix

! Only the master process handles the file output
if (LDT_masterproc) then

nc = LDT_rc%lnc(1)
nr = LDT_rc%lnr(1)

! Copy ldt.config files to local variables
output_prefix = trim(ldtsi_settings%output_prefix)

! FIXME: Set this in ldt.config
outfilename = "ldtsi_"//date10//".nc"
outfilename = trim(output_prefix)//"_"//date10//".nc"

write(LDT_logunit,*)'[INFO] Creating NETCDF file ',trim(outfilename)

Expand Down Expand Up @@ -463,6 +467,7 @@ subroutine LDTSI_read_netcdf(date10,ierr)
use netcdf
#endif
use LDTSI_arraysMod, only: LDTSI_arrays
use LDT_ldtsiMod, only: ldtsi_settings

! Defaults
implicit none
Expand All @@ -487,7 +492,7 @@ subroutine LDTSI_read_netcdf(date10,ierr)
nr = LDT_rc%lnr(1)

! See if file exists
infilename = "ldtsi_"//date10//".nc"
infilename = trim(ldtsi_settings%output_prefix)//"_"//date10//".nc"
inquire(file=trim(infilename), exist=file_exists)
if (.not. file_exists) return

Expand Down
14 changes: 13 additions & 1 deletion ldt/LDTSI/LDT_ldtsiMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ module LDT_ldtsiMod
character*20 :: data_category
character*20 :: data_res
character*20 :: area_of_data

! Output file name (prefix)
character*20 :: output_prefix

end type ldtsi_t
type(ldtsi_t), public :: ldtsi_settings
Expand Down Expand Up @@ -466,7 +469,16 @@ subroutine LDT_ldtsiInit()
ldtsi_settings%area_of_data, &
rc=rc)
call LDT_verify(rc, trim(cfg_entry)//" not specified")


! Get output file name (prefix)
cfg_entry = "USAFSI output filename (prefix):"
call ESMF_ConfigFindLabel(LDT_config, trim(cfg_entry), rc=rc)
call LDT_verify(rc, trim(cfg_entry)//" not specified")
call ESMF_ConfigGetAttribute(LDT_config, &
ldtsi_settings%output_prefix, &
rc=rc)
call LDT_verify(rc, trim(cfg_entry)//" not specified")

end subroutine LDT_ldtsiInit

! This calls the actual LDTSI driver
Expand Down
4 changes: 4 additions & 0 deletions ldt/LDTSI/ldt.config.sample
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,8 @@ USAFSI LIS GRIB2 data category: C
USAFSI LIS GRIB2 data resolution: C0P09DEG
USAFSI LIS GRIB2 area of data: GLOBAL

# Define USAFSI outputfile name prefix (e.g., usafsi)
# Output file name will be "prefix_+USAFSI valid date(yyyymmddhh)+.nc"
# e.g., usafsi_2018121112.nc
USAFSI output filename (prefix): "usafsi"

0 comments on commit c6e37b3

Please sign in to comment.