Skip to content

Commit

Permalink
Update the restart read to use default 'cdf1' format.
Browse files Browse the repository at this point in the history
Update the documentation.

Remove the deflate attribute written to history files.

Update some code comments.
  • Loading branch information
apcraig committed Feb 9, 2024
1 parent e946aae commit 4f09d1f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -648,12 +648,6 @@ subroutine ice_write_hist (ns)
call ice_check_nc(status, subname// ' ERROR: global attribute io_flavor', &
file=__FILE__, line=__LINE__)

if (history_format == 'hdf5') then
status = nf90_put_att(ncid,nf90_global,'deflate',history_deflate)
call ice_check_nc(status, subname//' ERROR: defining attribte deflate', &
file=__FILE__,line=__LINE__)
endif

!-----------------------------------------------------------------
! end define mode
!-----------------------------------------------------------------
Expand Down
12 changes: 3 additions & 9 deletions cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module ice_history_write
use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted
use icepack_intfc, only: icepack_query_parameters
use ice_calendar, only: write_ic, histfreq
use ice_pio, only: ice_pio_check
use ice_pio

implicit none
private
Expand Down Expand Up @@ -75,7 +75,6 @@ subroutine ice_write_hist (ns)
use ice_arrays_column, only: hin_max, floe_rad_c
use ice_restart_shared, only: runid
use pio
use ice_pio

integer (kind=int_kind), intent(in) :: ns

Expand Down Expand Up @@ -253,7 +252,7 @@ subroutine ice_write_hist (ns)
endif

time_coord = coord_attributes('time', 'time', trim(cal_units))
call ice_hist_coord_def(File, time_coord, pio_double, (/timid/), varid) !why is pio_double this not lprecision ?
call ice_hist_coord_def(File, time_coord, pio_double, (/timid/), varid)
call ice_pio_check(pio_put_att(File,varid,'calendar',cal_att), &
subname//' ERROR: defining att calendar: '//cal_att,file=__FILE__,line=__LINE__)
if (hist_avg(ns) .and. .not. write_ic) then
Expand All @@ -268,7 +267,7 @@ subroutine ice_write_hist (ns)
dimid2(1) = boundid
dimid2(2) = timid

call ice_hist_coord_def(File, time_coord, pio_double, dimid2, varid) !why is pio_double this not lprecision ?
call ice_hist_coord_def(File, time_coord, pio_double, dimid2, varid)
call ice_pio_check(pio_put_att(File,varid,'calendar',cal_att), &
subname//' ERROR: defining att calendar: '//cal_att,file=__FILE__,line=__LINE__)
endif
Expand Down Expand Up @@ -660,11 +659,6 @@ subroutine ice_write_hist (ns)
subname//' ERROR: defining att io_flavor',file=__FILE__,line=__LINE__)
#endif

if (history_format == 'hdf5') then
call ice_pio_check(pio_put_att(File,pio_global,'deflate',history_deflate), &
subname//' ERROR: defining att deflate',file=__FILE__,line=__LINE__)
endif

!-----------------------------------------------------------------
! end define mode
!-----------------------------------------------------------------
Expand Down
7 changes: 6 additions & 1 deletion cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,13 @@ subroutine init_restart_read(ice_ic)
end if

File%fh=-1
! tcraig, including fformat here causes some problems when restart_format=hdf5
! and reading non hdf5 files with spack built PIO. Excluding the fformat
! argument here defaults the PIO format to cdf1 which then reads
! any netcdf format file fine.
call ice_pio_init(mode='read', filename=trim(filename), File=File, &
fformat=trim(restart_format), rearr=trim(restart_rearranger), &
! fformat=trim(restart_format), rearr=trim(restart_rearranger), &
rearr=trim(restart_rearranger), &
iotasks=restart_iotasks, root=restart_root, stride=restart_stride, &
debug=first_call)

Expand Down
8 changes: 5 additions & 3 deletions doc/source/user_guide/ug_case_settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ setup_nml
"``history_deflate``", "integer", "compression level (0 to 9) for history output (hdf5 only)", "0"
"``history_dir``", "string", "path to history output directory", "'./'"
"``history_file``", "string", "output file for history", "'iceh'"
"``history_format``", "``cdf1``", "write history files with netcdf cdf1 (netcdf3-classic) format", "``cdf1``"
"``history_format``", "``binary``", "write history files with binary format", "``cdf1``"
"", "``cdf1``", "write history files with netcdf cdf1 (netcdf3-classic) format", ""
"", "``cdf2``", "write history files with netcdf cdf2 (netcdf3-64bit-offset) format", ""
"", "``cdf5``", "write history files with netcdf cdf5 (netcdf3-64bit-data) format", ""
"", "``default``", "write history files in default format", ""
Expand Down Expand Up @@ -250,10 +251,11 @@ setup_nml
"``restart_dir``", "string", "path to restart directory", "'./'"
"``restart_ext``", "logical", "read/write halo cells in restart files", "``.false.``"
"``restart_file``", "string", "output file prefix for restart dump", "'iced'"
"``restart_format``", "``cdf1``", "write restart files with netcdf cdf1 (netcdf3-classic) format", "``cdf1``"
"``restart_format``", "``binary``", "write restart files with binary format", "``cdf1``"
"", "``cdf1``", "write restart files with netcdf cdf1 (netcdf3-classic) format", ""
"", "``cdf2``", "write restart files with netcdf cdf2 (netcdf3-64bit-offset) format", ""
"", "``cdf5``", "write restart files with netcdf cdf5 (netcdf3-64bit-data) format", ""
"", "``default``", "write history files in default format", ""
"", "``default``", "write restart files in default format", ""
"", "``hdf5``", "write restart files with netcdf hdf5 (netcdf4) format", ""
"", "``pio_pnetcdf``", "write restart files with pnetcdf in PIO, deprecated", ""
"", "``pio_netcdf``", "write restart files with netcdf in PIO, deprecated", ""
Expand Down
4 changes: 3 additions & 1 deletion doc/source/user_guide/ug_implementation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,9 @@ in **cice.settings** to ``binary``, ``netcdf``, ``pio1``, or ``pio2``.

At run-time, more detailed IO settings are available. ``restart_format`` and
``history_format`` namelist options specify the method and format further. Valid options
are listed in :ref:`formats`. Note that with ``ICE_IOTYPE = binary``, the format name
are listed in :ref:`formats`. These format specify the format of new files created
by CICE. Existing files can be read in any format as long as it's consistent
with ``ICE_IOTYPE`` defined. Note that with ``ICE_IOTYPE = binary``, the format name
is actually ignored. The CICE netCDF output contains a global metadata attribute, ``io_flavor``,
that indicates the format chosen for the file. ``ncdump -k filename.nc`` also
provides information about the specific netCDF file format.
Expand Down

0 comments on commit 4f09d1f

Please sign in to comment.