Skip to content

Commit

Permalink
Add NO_HDF5 CPP
Browse files Browse the repository at this point in the history
Add NO_HDF5 to compy port
  • Loading branch information
apcraig committed May 17, 2024
1 parent af2bdec commit 6a654f0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
23 changes: 21 additions & 2 deletions cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,25 @@ subroutine ice_write_hist (ns)
iflag = nf90_clobber
elseif (history_format == 'cdf2') then
#ifdef NO_CDF2
call abort_ice(subname//' ERROR: history_format cdf2 not available '//trim(history_format), &
call abort_ice(subname//' ERROR: history_format cdf2 not available ', &
file=__FILE__, line=__LINE__)
#else
iflag = ior(nf90_clobber,nf90_64bit_offset)
#endif
elseif (history_format == 'cdf5') then
#ifdef NO_CDF5
call abort_ice(subname//' ERROR: history_format cdf5 not available '//trim(history_format), &
call abort_ice(subname//' ERROR: history_format cdf5 not available ', &
file=__FILE__, line=__LINE__)
#else
iflag = ior(nf90_clobber,nf90_64bit_data)
#endif
elseif (history_format == 'hdf5') then
#ifdef NO_HDF5
call abort_ice(subname//' ERROR: history_format hdf5 not available ', &
file=__FILE__, line=__LINE__)
#else
iflag = ior(nf90_clobber,nf90_netcdf4)
#endif
else
call abort_ice(subname//' ERROR: history_format not allowed for '//trim(history_format), &
file=__FILE__, line=__LINE__)
Expand Down Expand Up @@ -1202,6 +1207,12 @@ subroutine ice_hist_field_def(ncid, hfield, lprecision, dimids, ns)
status = nf90_def_var(ncid, hfield%vname, lprecision, dimids, varid)
call ice_check_nc(status, subname//' ERROR: defining var '//trim(hfield%vname),file=__FILE__,line=__LINE__)

#ifdef NO_HDF5
if (history_format=='hdf5') then
call abort_ice(subname//' ERROR: history_format hdf5 not available ', &
file=__FILE__, line=__LINE__)
endif
#else
if (history_format=='hdf5' .and. size(dimids)>1) then
if (dimids(1)==imtid .and. dimids(2)==jmtid) then
chunks(1)=history_chunksize(1)
Expand All @@ -1218,6 +1229,7 @@ subroutine ice_hist_field_def(ncid, hfield, lprecision, dimids, ns)
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
#endif

! add attributes
status = nf90_put_att(ncid,varid,'units', hfield%vunit)
Expand Down Expand Up @@ -1345,6 +1357,12 @@ subroutine ice_hist_coord_def(ncid, coord, lprecision, dimids, varid)
status = nf90_def_var(ncid, coord%short_name, lprecision, dimids, varid)
call ice_check_nc(status, subname//' ERROR: defining coord '//coord%short_name,file=__FILE__,line=__LINE__)

#ifdef NO_HDF5
if (history_format=='hdf5') then
call abort_ice(subname//' ERROR: history_format hdf5 not available ', &
file=__FILE__, line=__LINE__)
endif
#else
if (history_format=='hdf5' .and. size(dimids)>1) then
if (dimids(1)==imtid .and. dimids(2)==jmtid) then
chunks(1)=history_chunksize(1)
Expand All @@ -1361,6 +1379,7 @@ subroutine ice_hist_coord_def(ncid, coord, lprecision, dimids, varid)
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(coord%short_name), file=__FILE__, line=__LINE__)
endif
#endif

status = nf90_put_att(ncid,varid,'long_name',trim(coord%long_name))
call ice_check_nc(status, subname// ' ERROR: defining long_name for '//coord%short_name, &
Expand Down
16 changes: 14 additions & 2 deletions cicecore/cicedyn/infrastructure/io/io_netcdf/ice_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,25 @@ subroutine init_restart_write(filename_spec)
iflag = nf90_clobber
elseif (restart_format == 'cdf2') then
#ifdef NO_CDF2
call abort_ice(subname//' ERROR: restart_format cdf2 not available '//trim(restart_format), &
call abort_ice(subname//' ERROR: restart_format cdf2 not available ', &
file=__FILE__, line=__LINE__)
#else
iflag = ior(nf90_clobber,nf90_64bit_offset)
#endif
elseif (restart_format == 'cdf5') then
#ifdef NO_CDF5
call abort_ice(subname//' ERROR: restart_format cdf5 not available '//trim(restart_format), &
call abort_ice(subname//' ERROR: restart_format cdf5 not available ', &
file=__FILE__, line=__LINE__)
#else
iflag = ior(nf90_clobber,nf90_64bit_data)
#endif
elseif (restart_format == 'hdf5') then
#ifdef NO_HDF5
call abort_ice(subname//' ERROR: restart_format hdf5 not available ', &
file=__FILE__, line=__LINE__)
#else
iflag = ior(nf90_clobber,nf90_netcdf4)
#endif
else
call abort_ice(subname//' ERROR: restart_format not allowed for '//trim(restart_format), &
file=__FILE__, line=__LINE__)
Expand Down Expand Up @@ -904,6 +909,12 @@ subroutine define_rest_field(ncid, vname, dims)
status = nf90_def_var(ncid,trim(vname),nf90_double,dims,varid)
call ice_check_nc(status, subname//' ERROR: def var '//trim(vname), file=__FILE__, line=__LINE__)

#ifdef NO_HDF5
if (restart_format=='hdf5') then
call abort_ice(subname//' ERROR: restart_format hdf5 not available ', &
file=__FILE__, line=__LINE__)
endif
#else
if (restart_format=='hdf5' .and. size(dims)>1) then
if (dims(1)==dimid_ni .and. dims(2)==dimid_nj) then
chunks(1)=restart_chunksize(1)
Expand All @@ -920,6 +931,7 @@ subroutine define_rest_field(ncid, vname, dims)
status=nf90_def_var_deflate(ncid, varid, shuffle=0, deflate=1, deflate_level=restart_deflate)
call ice_check_nc(status, subname//' ERROR deflating var '//trim(vname), file=__FILE__, line=__LINE__)
endif
#endif

#else
call abort_ice(subname//' ERROR: USE_NETCDF cpp not defined', &
Expand Down
2 changes: 1 addition & 1 deletion configuration/scripts/machines/Macros.compy_intel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#==============================================================================

CPP := fpp
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}
CPPDEFS := -DFORTRANUNDERSCORE -DNO_HDF5 ${ICE_CPPDEFS}
CFLAGS := -c -O2 -fp-model precise -xHost

FIXEDFLAGS := -132
Expand Down

0 comments on commit 6a654f0

Please sign in to comment.