Skip to content

Commit

Permalink
Merge pull request #129 from noaa-oar-arl/hourly_output
Browse files Browse the repository at this point in the history
Changing to individual time step outputs for NetCDF files.
  • Loading branch information
drnimbusrain authored Mar 23, 2024
2 parents 872ab4a + 04664f3 commit 8bef605
Show file tree
Hide file tree
Showing 3 changed files with 345 additions and 327 deletions.
4 changes: 2 additions & 2 deletions input/namelist.canopy
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
! Recommend set file_out prefix to initial 'YYYY-MM-DD-HH-MMSS_region_identifier'
file_vars = 'input/gfs.t12z.20220630.sfcf023.canopy.nc' 'input/gfs.t12z.20220701.sfcf000.canopy.nc' 'input/gfs.t12z.20220701.sfcf001.canopy.nc'
! file_vars = 'input/gfs.t12z.20220630.sfcf023.canopy.txt' 'input/gfs.t12z.20220701.sfcf000.canopy.txt' 'input/gfs.t12z.20220701.sfcf001.canopy.txt'
file_out = 'output/2022-07-01-11-0000_southeast_us'
file_out = 'output/southeast_us'

!Single Point Example
! Recommend set file_out prefix to initial 'YYYY-MM-DD-HH-MMSS_point_identifier'
! file_vars = 'input/point_file_20220630.sfcf023.txt' 'input/point_file_20220701.sfcf000.txt' 'input/point_file_20220701.sfcf001.txt'
! file_canvars = 'input/point_file_canvars_20220630.sfcf023.txt' 'input/point_file_canvars_20220701.sfcf000.txt' 'input/point_file_canvars_20220701.sfcf001.txt'
! file_out = 'output/2022-07-01-11-0000_point'
! file_out = 'output/point'
/

&USERDEFS
Expand Down
50 changes: 35 additions & 15 deletions src/canopy_app.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ program canopy_app

CHARACTER(LEN=24) :: time_next ! YYYY-MM-DD-HH:MM:SS.SSSS
CHARACTER(LEN=24) :: time_now ! YYYY-MM-DD-HH:MM:SS.SSSS
integer :: nn
CHARACTER(LEN=24) :: nn_string
CHARACTER(LEN=24) :: time_now_file

integer :: n,nn
! CHARACTER(LEN=24) :: nn_string
!-------------------------------------------------------------------------------
! Error, warning, and informational messages.
!-------------------------------------------------------------------------------
Expand Down Expand Up @@ -92,22 +94,40 @@ program canopy_app
!-------------------------------------------------------------------------------
! Write model output of canopy model calculations.
!-------------------------------------------------------------------------------
write(nn_string,*) nn-1
! call canopy_write_txt(trim(file_out(1)) // '_' // trim(time_now))
if (nn.lt.10) then
call canopy_write_txt((trim(file_out(1)) // '_t00' // ADJUSTL(nn_string)), &
time_now)
else if (nn.ge.10.and.nn.lt.100) then
call canopy_write_txt((trim(file_out(1)) // '_t0' // ADJUSTL(nn_string)), &
time_now)
else
call canopy_write_txt((trim(file_out(1)) // '_t' // ADJUSTL(nn_string)), &
time_now)
end if
! write(nn_string,*) nn-1

time_now_file=time_now
do n = 1, len(time_now_file)
if (time_now_file(n:n) == ':') then
time_now_file(n:n) = '-'
end if
end do

call canopy_write_txt((trim(file_out(1)) // '_' // trim(time_now_file)),time_now)

! if (nn.lt.10) then
! call canopy_write_txt((trim(file_out(1)) // '_t00' // ADJUSTL(nn_string)), &
! time_now)
! else if (nn.ge.10.and.nn.lt.100) then
! call canopy_write_txt((trim(file_out(1)) // '_t0' // ADJUSTL(nn_string)), &
! time_now)
! else
! call canopy_write_txt((trim(file_out(1)) // '_t' // ADJUSTL(nn_string)), &
! time_now)
! end if

#ifdef NETCDF
!only output if 2D input NCF is used
call canopy_write_ncf(trim(file_out(1)))
call canopy_write_ncf(trim(file_out(1)) // '_' // ADJUSTL(time_now_file))

! call canopy_write_ncf(trim(file_out(1)))
! if (nn.lt.10) then
! call canopy_write_ncf(trim(file_out(1)) // '_t00' // ADJUSTL(nn_string))
! else if (nn.ge.10.and.nn.lt.100) then
! call canopy_write_ncf(trim(file_out(1)) // '_t0' // ADJUSTL(nn_string))
! else
! call canopy_write_ncf(trim(file_out(1)) // '_t' // ADJUSTL(nn_string))
! end if
#endif

! Update new date and time
Expand Down
Loading

0 comments on commit 8bef605

Please sign in to comment.