From 4f09d1f2c0abfa0c1ad499aed8d55695bdce1f06 Mon Sep 17 00:00:00 2001 From: apcraig Date: Fri, 9 Feb 2024 11:51:45 -0700 Subject: [PATCH] Update the restart read to use default 'cdf1' format. Update the documentation. Remove the deflate attribute written to history files. Update some code comments. --- .../io/io_netcdf/ice_history_write.F90 | 6 ------ .../infrastructure/io/io_pio2/ice_history_write.F90 | 12 +++--------- .../infrastructure/io/io_pio2/ice_restart.F90 | 7 ++++++- doc/source/user_guide/ug_case_settings.rst | 8 +++++--- doc/source/user_guide/ug_implementation.rst | 4 +++- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90 b/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90 index 8ed167f6a..c03bc233a 100644 --- a/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90 @@ -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 !----------------------------------------------------------------- diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 index f83db8a5b..daebe1f2e 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 !----------------------------------------------------------------- diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 index b487c243d..fdb9330d2 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 @@ -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) diff --git a/doc/source/user_guide/ug_case_settings.rst b/doc/source/user_guide/ug_case_settings.rst index 14130b23c..b8bde525d 100644 --- a/doc/source/user_guide/ug_case_settings.rst +++ b/doc/source/user_guide/ug_case_settings.rst @@ -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", "" @@ -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", "" diff --git a/doc/source/user_guide/ug_implementation.rst b/doc/source/user_guide/ug_implementation.rst index 440899b88..7f19132d2 100644 --- a/doc/source/user_guide/ug_implementation.rst +++ b/doc/source/user_guide/ug_implementation.rst @@ -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.