From d19969598ede1dd0e6a3922b4d6302362d1b99b1 Mon Sep 17 00:00:00 2001 From: Anton Steketee Date: Thu, 1 Feb 2024 12:20:20 +1100 Subject: [PATCH] fix history chunking and comments / formatting --- .../io/io_netcdf/ice_history_write.F90 | 8 ++++---- .../io/io_pio2/ice_history_write.F90 | 15 ++++++++++----- 2 files changed, 14 insertions(+), 9 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 4827a8f8f..793a34859 100644 --- a/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90 @@ -1168,8 +1168,8 @@ end subroutine ice_write_hist !======================================================================= ! Defines a (time-dependent) history var in the history file - ! coordinates have short_name, long_name and units, coordsiantes and cell_measures attributes, - ! and are compressed and chunked for 'hd5' + ! variables have short_name, long_name and units, coordiantes and cell_measures attributes, + ! and are compressed and chunked for 'hdf5' subroutine ice_hist_field_def(ncid, hfield, lprecision, dimids, ns) @@ -1203,7 +1203,7 @@ subroutine ice_hist_field_def(ncid, hfield, lprecision, dimids, ns) endif if (history_format=='hdf5' .and. history_deflate/=0) then - status=nf90_def_var_deflate(ncid, varid, shuffle=0, deflate=1, deflate_level=history_deflate) + status = nf90_def_var_deflate(ncid, varid, shuffle=0, deflate=1, deflate_level=history_deflate) call ice_check_nc(status, subname//' ERROR deflating var '//trim(hfield%vname), file=__FILE__, line=__LINE__) endif @@ -1319,7 +1319,7 @@ end subroutine ice_write_hist_fill ! Defines a coordinate var in the history file ! coordinates have short_name, long_name and units attributes, - ! and are compressed for 'hd5' when more than one dimensional + ! and are compressed for 'hdf5' when more than one dimensional subroutine ice_hist_coord_def(ncid, coord, lprecision, dimids, varid) 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 1c9650b57..3907812eb 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 @@ -1255,6 +1255,9 @@ end subroutine ice_write_hist !======================================================================= ! Defines a coordinate var in the history file + ! coordinates have short_name, long_name and units attributes, + ! and are compressed for 'hdf5' when more than one dimensional + subroutine ice_hist_coord_def(File, coord,lprecision, dimids,varid) use pio, only: file_desc_t, var_desc_t, pio_def_var, pio_put_att @@ -1287,7 +1290,7 @@ subroutine ice_hist_coord_def(File, coord,lprecision, dimids,varid) endif if (history_format=='hdf5' .and. size(dimids)>1) then - if (dimids(1)==imtid .and. dimids(2)==jmtid) then + if (dimids(1)==imtid .and. dimids(2)==jmtid) then chunks(1)=history_chunksize(1) chunks(2)=history_chunksize(2) do i = 3, size(dimids) @@ -1309,6 +1312,9 @@ end subroutine ice_hist_coord_def !======================================================================= ! Defines a (time-dependent) history var in the history file + ! variables have short_name, long_name and units, coordiantes and cell_measures attributes, + ! and are compressed and chunked for 'hdf5' + subroutine ice_hist_field_def(File, hfield,lprecision, dimids, ns) use pio, only: file_desc_t , var_desc_t, pio_def_var, pio_put_att @@ -1318,7 +1324,7 @@ subroutine ice_hist_field_def(File, hfield,lprecision, dimids, ns) use netcdf, only: NF90_CHUNKED use ice_history_shared, only: history_deflate, history_chunksize, history_format #endif - use ice_history_shared, only: ice_hist_field, history_precision, hist_avg + use ice_history_shared, only: ice_hist_field, history_precision, hist_avg use ice_calendar, only: histfreq, histfreq_n, write_ic type(file_desc_t), intent(in) :: File @@ -1346,12 +1352,11 @@ subroutine ice_hist_field_def(File, hfield,lprecision, dimids, ns) if (dimids(1)==imtid .and. dimids(2)==jmtid) then chunks(1)=history_chunksize(1) chunks(2)=history_chunksize(2) - do i = 1, size(dimids) + do i = 3, size(dimids) chunks(i) = 0 enddo status = pio_def_var_chunking(File, varid, NF90_CHUNKED, chunks) - call ice_pio_check(status, & - subname//' ERROR: chunking var '//hfield%vname,file=__FILE__,line=__LINE__) + call ice_pio_check(status, subname//' ERROR: chunking var '//hfield%vname,file=__FILE__,line=__LINE__) endif endif #endif