Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Added new chunking parameter to help speed up I/O
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Oct 8, 2021
1 parent 4e2cc70 commit c293240
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/netcdf/netcdf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ module subroutine netcdf_initialize_output(self, param)
real(SP) :: sfill
logical :: fileExists
character(len=STRMAX) :: errmsg
integer(I4B) :: storage, ndims, i
integer(I4B), parameter :: chunk = 2048

dfill = ieee_value(dfill, IEEE_QUIET_NAN)
sfill = ieee_value(sfill, IEEE_QUIET_NAN)
Expand Down Expand Up @@ -184,7 +186,7 @@ module subroutine netcdf_initialize_output(self, param)
! Set fill mode to NaN for all variables
call check( nf90_inquire(self%ncid, nVariables=nvar) )
do varid = 1, nvar
call check( nf90_inquire_variable(self%ncid, varid, xtype=vartype) )
call check( nf90_inquire_variable(self%ncid, varid, xtype=vartype, ndims=ndims) )
select case(vartype)
case(NF90_INT)
call check( nf90_def_var_fill(self%ncid, varid, 0, NF90_FILL_INT) )
Expand All @@ -195,6 +197,13 @@ module subroutine netcdf_initialize_output(self, param)
case(NF90_CHAR)
call check( nf90_def_var_fill(self%ncid, varid, 0, 0) )
end select

select case(vartype)
case(NF90_CHAR)
call check( nf90_def_var_chunking(self%ncid, varid, NF90_CHUNKED, [NAMELEN, chunk]) )
case default
call check( nf90_def_var_chunking(self%ncid, varid, NF90_CHUNKED, [(chunk, i = 1, ndims)]) )
end select
end do

! Take the file out of define mode
Expand Down

0 comments on commit c293240

Please sign in to comment.