Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Next: , Previous: nc__create, Up: Datasets


2.7 Create a NetCDF Dataset With Performance Options: nc_create_par

This function is a variant of nc_create, nc_create_par allows users to open a file on a MPI/IO or MPI/Posix parallel file system.

The parallel parameters are not written to the data file, they are only used for so long as the file remains open after an nc_create_par.

This function creates a new netCDF dataset, returning a netCDF ID that can subsequently be used to refer to the netCDF dataset in other netCDF function calls. The new netCDF dataset opened for write access and placed in define mode, ready for you to add dimensions, variables, and attributes.

This function is only available for netCDF-4 files. The creation mode flag must include NC_NETCDF4.

When a netCDF-4 file is created for parallel access, collective operations are the default. To use independent access on a variable, See nc_var_par_access.

Usage

     int nc_create_par(const char *path, int cmode, MPI_Comm comm,
                       MPI_Info info, int ncidp);
path
The file name of the new netCDF dataset.
cmode
Either the NC_MPIIO or NC_MPIPOSIX flags must be present. The NC_NETCDF4 flag is also required.

Setting NC_NOCLOBBER means you do not want to clobber (overwrite) an existing dataset; an error (NC_EEXIST) is returned if the specified dataset already exists.

The NC_SHARE flag is ignored.

comm
The MPI_Comm object returned by the MPI layer.
info
The MPI_Info object returned by the MPI layer, if MPI/IO is being used, or 0 if MPI/Posix is being used.
ncidp
Pointer to location where returned netCDF ID is to be stored.

Return Codes

NC_NOERR
No error.
NC_ENOTNC4
Parallel access with netcdf-4 files only.
NC_EPARINIT
Could not initialize parallel access at the HDF5 layer.
NC_EFILEMETA
HDF5 layer cannot handle create or root group open.
NC_EEXIST
Specifying a dataset name of a file that exists and also specifying NC_NOCLOBBER.
NC_EINVAL
Bad value for the creation mode.
NC_EHDFERR
Unexpected error from the HDF5 layer.

Examples

     #include <netcdf.h>
        ...
     int status;
     int ncid;
        ...
     *chunksize = 1024;
     status = nc__create("foo.nc", NC_NOCLOBBER, initialsz, chunksize, &ncid);
     if (status != NC_NOERR) handle_error(status);
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690