limits on netcdf sizes

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
cae
Posts: 36
Joined: Mon Jun 30, 2003 5:29 pm
Location: UC Santa Cruz

limits on netcdf sizes

#1 Unread post by cae »

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

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: limits on netcdf sizes

#2 Unread post by m.hadfield »

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.

User avatar
shchepet
Posts: 188
Joined: Fri Nov 14, 2003 4:57 pm

Re: limits on netcdf sizes

#3 Unread post by shchepet »

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

Code: Select all

ierr=nf_create(ncname, nf_clobber, ncid)
into

Code: Select all

ierr=nf_create(ncname, nf_64bit_offset, ncid)
when creating netCDF file.

This matter was already discussed o this forum. See
viewtopic.php?f=3&t=287&p=673

cae
Posts: 36
Joined: Mon Jun 30, 2003 5:29 pm
Location: UC Santa Cruz

Re: limits on netcdf sizes

#4 Unread post by cae »

Thanks to both responses. I now have it writing successfully using netcdf-3.6.3.

User avatar
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: limits on netcdf sizes

#5 Unread post by arango »

Changing the NetCDF file creation mode flag is very trivial. In line 133 of mod_netcdf.F you will see:

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
It will be easy to change that to:

Code: Select all

!!    integer :: CMODE = nf90_clobber      ! NetCDF classic format file
      integer :: CMODE = nf_64bit_offset   ! NetCDF classic with 64-bit offset
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.

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: limits on netcdf sizes

#6 Unread post by m.hadfield »

arango wrote:Changing the NetCDF file creation mode flag is very trivial...
It would be nice to be able to do it with an entry (called NC_CMODE?) in the input file.

User avatar
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: limits on netcdf sizes

#7 Unread post by arango »

Okey, It is a good suggestion. I will consider in the future. There is also the issue of the

Code: Select all

    CMODE=OR(nf90_noclobber,nf90_64bit_offset)
We need to do all the possible combinations.

User avatar
shchepet
Posts: 188
Joined: Fri Nov 14, 2003 4:57 pm

Re: limits on netcdf sizes

#8 Unread post by shchepet »

Hernan,

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)
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

Code: Select all

   ierr=nf_create(ncname, nf_noclobber+nf_64bit_offset, ncid)
if you want noclobber AND 64bit at the same time.


In fact, the reason why

Code: Select all

   ierr=nf_create(ncname, nf_64bit_offset, ncid)
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.

Post Reply