limits on netcdf sizes
limits on netcdf sizes
Hi.
I'm running into a netcdf problem trying to define a history file for a high resolution run with many tracer variables. The code works fine at (a) lower resolution or (b) fewer tracer variables.
Here's the error message:
0 1 00:00:00 9.967519E-04 2.013537E+04 2.013537E+04 7.714335E+15
DEF_HIS - creating history file: fwd_data/ocean_his_0001.nc
NETCDF_ENDDEF - unable to end definition mode for file:
fwd_data/ocean_his_0001.nc
call from: def_his.F
I'm using netcdf 3.6.3 (64-bit).
My question is: Does netcdf4 have different limits on file sizes, or are the limits the same?
Thanks.
Chris
I'm running into a netcdf problem trying to define a history file for a high resolution run with many tracer variables. The code works fine at (a) lower resolution or (b) fewer tracer variables.
Here's the error message:
0 1 00:00:00 9.967519E-04 2.013537E+04 2.013537E+04 7.714335E+15
DEF_HIS - creating history file: fwd_data/ocean_his_0001.nc
NETCDF_ENDDEF - unable to end definition mode for file:
fwd_data/ocean_his_0001.nc
call from: def_his.F
I'm using netcdf 3.6.3 (64-bit).
My question is: Does netcdf4 have different limits on file sizes, or are the limits the same?
Thanks.
Chris
- m.hadfield
- Posts: 521
- Joined: Tue Jul 01, 2003 4:12 am
- Location: NIWA
Re: limits on netcdf sizes
The size limitations on the netCDF classic format are described here
http://www.unidata.ucar.edu/software/ne ... imitations
I think that the relevant one in your case is that "the offset to the beginning of [the last variable in the file] must be less than about 2 GiB". I've never run into this limitation, but I guess you could for a large grid with lots of tracers.
The netCDF-4 HDF5-based format has no practical limits on the size of a variable
http://www.unidata.ucar.edu/software/ne ... 0Support10
however there can still be limits on file size from your file system, user quotas, etc.
If you link ROMS with a netCDF-4 library, it will still create classic-format files by default. To get the new HDF5-based format, you need to define the preprocessor macro NETCDF4.
http://www.unidata.ucar.edu/software/ne ... imitations
I think that the relevant one in your case is that "the offset to the beginning of [the last variable in the file] must be less than about 2 GiB". I've never run into this limitation, but I guess you could for a large grid with lots of tracers.
The netCDF-4 HDF5-based format has no practical limits on the size of a variable
http://www.unidata.ucar.edu/software/ne ... 0Support10
however there can still be limits on file size from your file system, user quotas, etc.
If you link ROMS with a netCDF-4 library, it will still create classic-format files by default. To get the new HDF5-based format, you need to define the preprocessor macro NETCDF4.
Re: limits on netcdf sizes
No, Mark, it is much simpler that that: you do not have to go to netCDF 4, although you can.
Version 3.6.3 -- the latest and final version of 3rd generation of netCDF is perfectly capable
to by-pass the 2GByte limitation.
All you have to do is to change
into
when creating netCDF file.
This matter was already discussed o this forum. See
viewtopic.php?f=3&t=287&p=673
Version 3.6.3 -- the latest and final version of 3rd generation of netCDF is perfectly capable
to by-pass the 2GByte limitation.
All you have to do is to change
Code: Select all
ierr=nf_create(ncname, nf_clobber, ncid)
Code: Select all
ierr=nf_create(ncname, nf_64bit_offset, ncid)
This matter was already discussed o this forum. See
viewtopic.php?f=3&t=287&p=673
Re: limits on netcdf sizes
Thanks to both responses. I now have it writing successfully using netcdf-3.6.3.
- arango
- Site Admin
- Posts: 1367
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: limits on netcdf sizes
Changing the NetCDF file creation mode flag is very trivial. In line 133 of mod_netcdf.F you will see:
It will be easy to change that to:
It is that simple I designed a NetCDF umbrella in ROMS to facilitate parallel I/O and global changes like this. Perhaps, we should add this change to the code.
Code: Select all
!
! Netcdf file creation mode flag.
!
#ifdef NETCDF4
integer :: CMODE = nf90_netcdf4 ! NetCDF-4/HDF5 format file
#else
integer :: CMODE = nf90_clobber ! NetCDF classic format file
#endif
Code: Select all
!! integer :: CMODE = nf90_clobber ! NetCDF classic format file
integer :: CMODE = nf_64bit_offset ! NetCDF classic with 64-bit offset
- m.hadfield
- Posts: 521
- Joined: Tue Jul 01, 2003 4:12 am
- Location: NIWA
Re: limits on netcdf sizes
It would be nice to be able to do it with an entry (called NC_CMODE?) in the input file.arango wrote:Changing the NetCDF file creation mode flag is very trivial...
- arango
- Site Admin
- Posts: 1367
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: limits on netcdf sizes
Okey, It is a good suggestion. I will consider in the future. There is also the issue of the
We need to do all the possible combinations.
Code: Select all
CMODE=OR(nf90_noclobber,nf90_64bit_offset)
Re: limits on netcdf sizes
Hernan,
According to netCDF manual nf90_64bit_offset is additive to the primary netCDF
flag, so it makes sense to use
when you want to create file with nf_clobber status (i.e., overwrite whatever file
may already exist) AND with 64bit offset at the same time.
Similarly, it makes sense to write
if you want noclobber AND 64bit at the same time.
In fact, the reason why
works and has the same meaning as nf_clobber+nf_64bit_offset is simply because
netcdf.inc defines parameter nf_clobber=0. This is true for any netCDF version,
starting from very old and all the way to newest 4.1.1 beta.
In netcdf.inc it is also defined nf_64bit_offset = 512, while nf_noclobber = 4 and
most other relevant parameters are kind of powers of 2. So I presume that it is just
setting bits in binary representation of the argument, and then decoding it inside
netCDF library.
According to netCDF manual nf90_64bit_offset is additive to the primary netCDF
flag, so it makes sense to use
Code: Select all
ierr=nf_create(ncname, nf_clobber+nf_64bit_offset, ncid)
may already exist) AND with 64bit offset at the same time.
Similarly, it makes sense to write
Code: Select all
ierr=nf_create(ncname, nf_noclobber+nf_64bit_offset, ncid)
In fact, the reason why
Code: Select all
ierr=nf_create(ncname, nf_64bit_offset, ncid)
netcdf.inc defines parameter nf_clobber=0. This is true for any netCDF version,
starting from very old and all the way to newest 4.1.1 beta.
In netcdf.inc it is also defined nf_64bit_offset = 512, while nf_noclobber = 4 and
most other relevant parameters are kind of powers of 2. So I presume that it is just
setting bits in binary representation of the argument, and then decoding it inside
netCDF library.