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

cam6_3_140: Separate history tapes into hXi and hXa #903

Merged
merged 31 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8d0754e
separate accumulated and instantaneous fields
Sep 22, 2023
6191558
fix issue with multiple grids with the same attribute(s)
Oct 2, 2023
96ea502
fix bug in lat lon coords, append file type to user-supplied filespec
Oct 4, 2023
cad3879
fix restarts
Oct 12, 2023
7349d16
another restart bug; update sct tests to reference new filename
Oct 12, 2023
0183095
fix for sct tests and fix for restart tests that have only one type o…
Oct 12, 2023
1fac980
code cleanup
Oct 13, 2023
387f459
Merge remote-tracking branch 'ESCOMP/cam_development' into history-split
Oct 13, 2023
8aa7437
change implementation to static array
Oct 16, 2023
57fc39c
add units and calendar to time_bounds variable
Oct 17, 2023
8df5b6b
fix for dims with bnds; make field indexing consistent
Oct 19, 2023
2320d0e
make field indexing consistent; remove satfile file loop
Oct 19, 2023
e274239
add parameters for split file indices
Oct 19, 2023
f3c8a30
better logging
Oct 19, 2023
e05302c
remove unnecessary loop
Oct 19, 2023
157639d
fix indices
Oct 19, 2023
356af85
add parameters for sat, restart, and init file indices
Oct 20, 2023
cd4cece
clean up File indexing logic
Oct 20, 2023
ed5dbe2
address reviewer comments
Nov 1, 2023
5149a48
remove unused variable
Nov 1, 2023
9da2590
fix looping range
Nov 1, 2023
3e63b60
merge to head of cam_development
Nov 1, 2023
7a0e528
logic to add file type flag to right part of hfilename_spec, updates …
Nov 8, 2023
f955d7f
change time_op value to "point" for instantaneous fields
Nov 8, 2023
d37e8c4
always create instantaneous file; write time-dependent fields to inst…
Nov 29, 2023
13dd76d
address reviewer comments
Nov 29, 2023
39ca247
calculate midpoint date and datesec for accumulated file
Dec 5, 2023
bee5eb4
Merge remote-tracking branch 'ESCOMP/cam_development' into history-split
Dec 5, 2023
de6c33a
fix sct tests
Dec 5, 2023
b32b71e
initial changelog
Dec 5, 2023
6c59437
updated changelog
Dec 7, 2023
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
4 changes: 2 additions & 2 deletions cime_config/SystemTests/sct.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _case_two_setup(self):
append_to_user_nl_files(caseroot = self._get_caseroot(), component = "cam", contents = "MFILT = 1,7,1,1,1,1")
append_to_user_nl_files(caseroot = self._get_caseroot(), component = "cam", contents = "nhtfrq = 1,1,1,1,1,1")
append_to_user_nl_files(caseroot = self._get_caseroot(), component = "cam", contents = "fincl2='T','Q','TDIFF','QDIFF','LANDFRAC'")
append_to_user_nl_files(caseroot = self._get_caseroot(), component = "cam", contents = "iopfile = '../"+case_name+".cam.h1."+RUN_STARTDATE+"-00000.nc'")
append_to_user_nl_files(caseroot = self._get_caseroot(), component = "cam", contents = "iopfile = '../"+case_name+".cam.h1i."+RUN_STARTDATE+"-00000.nc'")
append_to_user_nl_files(caseroot = self._get_caseroot(), component = "cam", contents = "inithist = 'YEARLY'")
append_to_user_nl_files(caseroot = self._get_caseroot(), component = "cam", contents = "scm_cambfb_mode = .true.")
append_to_user_nl_files(caseroot = self._get_caseroot(), component = "cam", contents = "scm_use_obs_uv = .true.")
Expand All @@ -65,7 +65,7 @@ def _component_compare_test(self, suffix1, suffix2,
success_change=False,
ignore_fieldlist_diffs=False):
with self._test_status:
stat,netcdf_filename,err=run_cmd('ls ./run/case2run/*h1*8400.nc ')
stat,netcdf_filename,err=run_cmd('ls ./run/case2run/*h1i*8400.nc ')
stat,DIFFs,err=run_cmd('ncdump -ff -p 9,17 -v QDIFF,TDIFF '+netcdf_filename+' | egrep //\.\*DIFF | sed s/^\ \*// | sed s/^0,/0.0,/ | sed s/^0\;/0.0\;/ | sed s/\[,\;\].\*// | uniq')
array_of_DIFFs=DIFFs.split("\n")
answer=max([abs(float(x)) for x in array_of_DIFFs])
Expand Down
275 changes: 275 additions & 0 deletions doc/ChangeLog

Large diffs are not rendered by default.

2,521 changes: 1,374 additions & 1,147 deletions src/control/cam_history.F90

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/control/cam_history_support.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module cam_history_support
use cam_logfile, only: iulog
use spmd_utils, only: masterproc
use cam_grid_support, only: cam_grid_patch_t, cam_grid_header_info_t
use cam_grid_support, only: max_hcoordname_len
use cam_grid_support, only: max_hcoordname_len, maxsplitfiles
use cam_pio_utils, only: cam_pio_handle_error

implicit none
Expand Down Expand Up @@ -197,7 +197,7 @@ module cam_history_support
! PIO ids
!

type(file_desc_t) :: File ! PIO file id
type(file_desc_t) :: Files(maxsplitfiles) ! PIO file ids

type(var_desc_t) :: mdtid ! var id for timestep
type(var_desc_t) :: ndbaseid ! var id for base day
Expand All @@ -220,7 +220,7 @@ module cam_history_support
#endif
type(var_desc_t) :: nstephid ! var id for current timestep
type(var_desc_t) :: timeid ! var id for time
type(var_desc_t) :: tbndid ! var id for time_bnds
type(var_desc_t) :: tbndid ! var id for time_bounds
type(var_desc_t) :: date_writtenid ! var id for date time sample written
type(var_desc_t) :: time_writtenid ! var id for time time sample written
type(var_desc_t) :: f107id ! var id for f107
Expand Down
11 changes: 10 additions & 1 deletion src/control/filenames.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ end function get_dir
!===============================================================================

character(len=cl) function interpret_filename_spec( filename_spec, number, prev, case, &
yr_spec, mon_spec, day_spec, sec_spec )
yr_spec, mon_spec, day_spec, sec_spec, flag_spec )

! Create a filename from a filename specifier. The
! filename specifyer includes codes for setting things such as the
Expand Down Expand Up @@ -77,12 +77,14 @@ end function get_dir
integer , intent(in), optional :: mon_spec ! Simulation month
integer , intent(in), optional :: day_spec ! Simulation day
integer , intent(in), optional :: sec_spec ! Seconds into current simulation day
character(len=*), intent(in), optional :: flag_spec ! flag for accumulated or instantaneous

! Local variables
integer :: year ! Simulation year
integer :: month ! Simulation month
integer :: day ! Simulation day
integer :: ncsec ! Seconds into current simulation day
character(len=1) :: flag
character(len=cl) :: string ! Temporary character string
character(len=cl) :: format ! Format character string
integer :: i, n ! Loop variables
Expand Down Expand Up @@ -116,6 +118,11 @@ end function get_dir
call get_curr_date(year, month, day, ncsec)
end if
end if
if (present(flag_spec)) then
flag = flag_spec
else
flag = ''
end if
!
! Go through each character in the filename specifyer and interpret if special string
!
Expand Down Expand Up @@ -170,6 +177,8 @@ end function get_dir
write(string,'(i2.2)') day
case( 's' ) ! second
write(string,'(i5.5)') ncsec
case( 'f' ) ! flag
write(string,'(a)') flag
case( '%' ) ! percent character
string = "%"
case default
Expand Down
60 changes: 30 additions & 30 deletions src/control/sat_hist.F90
Original file line number Diff line number Diff line change
Expand Up @@ -466,53 +466,53 @@ subroutine sat_hist_write( tape , nflds, nfils)
call get_indices( obs_lats, obs_lons, ncols, nocols, has_dyn_flds, col_ndxs, chk_ndxs, &
fdyn_ndxs, ldyn_ndxs, phs_owners, dyn_owners, mlats, mlons, phs_dists )

if ( .not. pio_file_is_open(tape%File) ) then
if ( .not. pio_file_is_open(tape%Files(1)) ) then
call endrun('sat file not open')
endif


ierr = pio_inq_dimid(tape%File,'ncol',coldim )
ierr = pio_inq_dimid(tape%Files(1),'ncol',coldim )

ierr = pio_inq_varid(tape%File, 'lat', out_latid )
ierr = pio_inq_varid(tape%File, 'lon', out_lonid )
ierr = pio_inq_varid(tape%File, 'distance', out_dstid )
ierr = pio_inq_varid(tape%Files(1), 'lat', out_latid )
ierr = pio_inq_varid(tape%Files(1), 'lon', out_lonid )
ierr = pio_inq_varid(tape%Files(1), 'distance', out_dstid )

call write_record_coord( tape, mlats(:), mlons(:), phs_dists(:), ncols, nfils )

! dump columns of 2D fields
if (has_phys_srf_flds) then
call dump_columns( tape%File, tape%hlist, nflds, nocols, 1, nfils, &
call dump_columns( tape%Files(1), tape%hlist, nflds, nocols, 1, nfils, &
col_ndxs, chk_ndxs, phs_owners, phys_decomp )
endif
if (has_dyn_srf_flds) then
call dump_columns( tape%File, tape%hlist, nflds, nocols, 1, nfils, &
call dump_columns( tape%Files(1), tape%hlist, nflds, nocols, 1, nfils, &
fdyn_ndxs, ldyn_ndxs, dyn_owners, dyn_decomp )
endif

! dump columns of 3D fields defined on mid pres levels
if (has_phys_lev_flds) then
call dump_columns( tape%File, tape%hlist, nflds, nocols, pver, nfils, &
call dump_columns( tape%Files(1), tape%hlist, nflds, nocols, pver, nfils, &
col_ndxs, chk_ndxs, phs_owners, phys_decomp )
endif
if (has_dyn_lev_flds) then
call dump_columns( tape%File, tape%hlist, nflds, nocols, pver, nfils, &
call dump_columns( tape%Files(1), tape%hlist, nflds, nocols, pver, nfils, &
fdyn_ndxs, ldyn_ndxs, dyn_owners, dyn_decomp )
endif

! dump columns of 3D fields defined on interface pres levels
if (has_phys_ilev_flds) then
call dump_columns( tape%File, tape%hlist, nflds, nocols, pverp, nfils, &
call dump_columns( tape%Files(1), tape%hlist, nflds, nocols, pverp, nfils, &
col_ndxs, chk_ndxs, phs_owners, phys_decomp )
endif
if (has_dyn_ilev_flds) then
call dump_columns( tape%File, tape%hlist, nflds, nocols, pverp, nfils, &
call dump_columns( tape%Files(1), tape%hlist, nflds, nocols, pverp, nfils, &
fdyn_ndxs, ldyn_ndxs, dyn_owners, dyn_decomp )
endif

deallocate( col_ndxs, chk_ndxs, fdyn_ndxs, ldyn_ndxs, phs_owners, dyn_owners )
deallocate( mlons, mlats, phs_dists )
deallocate( obs_lons, obs_lats )
call pio_syncfile(tape%File)
call pio_syncfile(tape%Files(1))

nfils = nfils + nocols

Expand Down Expand Up @@ -763,19 +763,19 @@ subroutine write_record_coord( tape, mod_lats, mod_lons, mod_dists, ncols, nfils
allocate( rtmp(ncols * sathist_nclosest) )

itmp(:) = ncdate
ierr = pio_put_var(tape%File, tape%dateid,(/nfils/), (/ncols * sathist_nclosest/),itmp)
ierr = pio_put_var(tape%Files(1), tape%dateid,(/nfils/), (/ncols * sathist_nclosest/),itmp)
itmp(:) = ncsec
ierr = pio_put_var(tape%File, tape%datesecid,(/nfils/),(/ncols * sathist_nclosest/),itmp)
ierr = pio_put_var(tape%Files(1), tape%datesecid,(/nfils/),(/ncols * sathist_nclosest/),itmp)
rtmp(:) = time
ierr = pio_put_var(tape%File, tape%timeid, (/nfils/),(/ncols * sathist_nclosest/),rtmp)
ierr = pio_put_var(tape%Files(1), tape%timeid, (/nfils/),(/ncols * sathist_nclosest/),rtmp)

deallocate(itmp)
deallocate(rtmp)

! output model column coordinates
ierr = pio_put_var(tape%File, out_latid, (/nfils/),(/ncols * sathist_nclosest/), mod_lats)
ierr = pio_put_var(tape%File, out_lonid, (/nfils/),(/ncols * sathist_nclosest/), mod_lons)
ierr = pio_put_var(tape%File, out_dstid, (/nfils/),(/ncols * sathist_nclosest/), mod_dists / 1000._r8)
ierr = pio_put_var(tape%Files(1), out_latid, (/nfils/),(/ncols * sathist_nclosest/), mod_lats)
ierr = pio_put_var(tape%Files(1), out_lonid, (/nfils/),(/ncols * sathist_nclosest/), mod_lons)
ierr = pio_put_var(tape%Files(1), out_dstid, (/nfils/),(/ncols * sathist_nclosest/), mod_dists / 1000._r8)

! output instrument location
allocate( out_lats(ncols * sathist_nclosest) )
Expand All @@ -786,40 +786,40 @@ subroutine write_record_coord( tape, mod_lats, mod_lons, mod_dists, ncols, nfils
out_lons(((i-1)*sathist_nclosest)+1 : (i*sathist_nclosest)) = obs_lons(i)
enddo

ierr = pio_put_var(tape%File, out_instr_lat_vid, (/nfils/),(/ncols * sathist_nclosest/), out_lats)
ierr = pio_put_var(tape%File, out_instr_lon_vid, (/nfils/),(/ncols * sathist_nclosest/), out_lons)
ierr = pio_put_var(tape%Files(1), out_instr_lat_vid, (/nfils/),(/ncols * sathist_nclosest/), out_lats)
ierr = pio_put_var(tape%Files(1), out_instr_lon_vid, (/nfils/),(/ncols * sathist_nclosest/), out_lons)

deallocate(out_lats)
deallocate(out_lons)


ierr = copy_data( infile, date_vid, tape%File, out_obs_date_vid, in_start_col, nfils, ncols )
ierr = copy_data( infile, time_vid, tape%File, out_obs_time_vid, in_start_col, nfils, ncols )
ierr = copy_data( infile, date_vid, tape%Files(1), out_obs_date_vid, in_start_col, nfils, ncols )
ierr = copy_data( infile, time_vid, tape%Files(1), out_obs_time_vid, in_start_col, nfils, ncols )

! output observation identifiers
if (instr_vid>0) then
ierr = copy_data( infile, instr_vid, tape%File, out_instrid, in_start_col, nfils, ncols )
ierr = copy_data( infile, instr_vid, tape%Files(1), out_instrid, in_start_col, nfils, ncols )
endif
if (orbit_vid>0) then
ierr = copy_data( infile, orbit_vid, tape%File, out_orbid, in_start_col, nfils, ncols )
ierr = copy_data( infile, orbit_vid, tape%Files(1), out_orbid, in_start_col, nfils, ncols )
endif
if (prof_vid>0) then
ierr = copy_data( infile, prof_vid, tape%File, out_profid, in_start_col, nfils, ncols )
ierr = copy_data( infile, prof_vid, tape%Files(1), out_profid, in_start_col, nfils, ncols )
endif
if (zenith_vid>0) then
ierr = copy_data( infile, zenith_vid, tape%File, out_zenithid, in_start_col, nfils, ncols )
ierr = copy_data( infile, zenith_vid, tape%Files(1), out_zenithid, in_start_col, nfils, ncols )
endif
if (in_julian_vid>0) then
ierr = copy_data( infile, in_julian_vid, tape%File, out_julian_vid, in_start_col, nfils, ncols )
ierr = copy_data( infile, in_julian_vid, tape%Files(1), out_julian_vid, in_start_col, nfils, ncols )
endif
if (in_occ_type_vid>0) then
ierr = copy_data( infile, in_occ_type_vid, tape%File, out_occ_type_vid, in_start_col, nfils, ncols )
ierr = copy_data( infile, in_occ_type_vid, tape%Files(1), out_occ_type_vid, in_start_col, nfils, ncols )
endif
if (in_localtime_vid>0) then
ierr = copy_data( infile, in_localtime_vid, tape%File, out_localtime_vid, in_start_col, nfils, ncols )
ierr = copy_data( infile, in_localtime_vid, tape%Files(1), out_localtime_vid, in_start_col, nfils, ncols )
endif
if (in_doy_vid>0) then
ierr = copy_data( infile, in_doy_vid, tape%File, out_doy_vid, in_start_col, nfils, ncols )
ierr = copy_data( infile, in_doy_vid, tape%Files(1), out_doy_vid, in_start_col, nfils, ncols )
endif

call t_stopf ('sat_hist::write_record_coord')
Expand Down
Loading