NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi, I am using netCDF-fortran-4.1.1 with netCDF-4.3.2. I get an error 'Bad chunk sizes' when the 3D data size is more than a certain number. I am unable to understand the cause of this error. My OS is CentOS 6.6. The errors are the same even if is use netCDF (v 4.1.1) supplied by the CentOS community. i am attaching a minimal example. Please let me know if there are any errors from my side. Thanks, Samrat. -- Samrat Rao Research Associate Engineering Mechanics Unit Jawaharlal Centre for Advanced Scientific Research Bangalore - 560064, India
program nc_test use netcdf implicit none integer, parameter :: & r8 = selected_real_kind(12), & imax = 770, & jmax = 1682, & kmax = 1682 integer :: & ncid, x_dimid, y_dimid, z_dimid, fld_id, & deflate_level, dimids(3), chunksizes(3), indices(6), & ierr real(r8), allocatable :: & fld(:,:,:) allocate( fld(kmax,jmax,imax),stat=ierr ) call random_number( fld ) call nc_check( nf90_create('nc_test_large.nc',nf90_netcdf4,ncid) ) call nc_check( nf90_def_dim(ncid,'i',imax,x_dimid) ) call nc_check( nf90_def_dim(ncid,'j',jmax,y_dimid) ) call nc_check( nf90_def_dim(ncid,'k',kmax,z_dimid) ) dimids = [z_dimid,y_dimid,x_dimid] chunksizes(1) = kmax; chunksizes(2) = jmax; chunksizes(3) = imax deflate_level = 1 indices = [1,imax,1,jmax,1,kmax] call nc_check( nf90_def_var(ncid,'fld',nf90_double,dimids, & fld_id,chunksizes=chunksizes, & shuffle=.true.,deflate_level=deflate_level) ) call nc_check( nf90_put_att(ncid,fld_id,"U velocity",indices) ) call nc_check( nf90_put_var(ncid,fld_id,fld) ) call nc_check( nf90_close(ncid) ) deallocate( fld ) !================================================== !------------------------------ contains !------------------------------ !================================================== subroutine nc_check( stat ) !---------------------------------------- ! DESCRIPTION: ! Routine to check if netCDF calls work !---------------------------------------- implicit none !------------------------------ integer, intent(in) :: & stat ! Status !------------------------------ if( stat /= nf90_noerr ) then write(*,*)'nc_check: ',trim( nf90_strerror(stat) ) call abort end if return end subroutine nc_check !================================================== end program nc_test
netcdfgroup
archives: