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

fix history chunking and comments / formatting #116

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down
15 changes: 10 additions & 5 deletions cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading