mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-12 15:45:21 +08:00
added nc_inq_path in dispatch tables
This commit is contained in:
parent
bd980e869f
commit
a0e1b037e5
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1993-2009 University Corporation for Atmospheric Research/Unidata
|
||||
* Copyright 1993-2010 University Corporation for Atmospheric Research/Unidata
|
||||
*
|
||||
* Portions of this software were developed by the Unidata Program at the
|
||||
* University Corporation for Atmospheric Research.
|
||||
@ -37,7 +37,8 @@
|
||||
|
||||
#include <stddef.h> /* size_t, ptrdiff_t */
|
||||
#include <errno.h> /* netcdf functions sometimes return system errors */
|
||||
/* These defs added by netCDF configure because parallel HDF5 is not present. */
|
||||
|
||||
/* The nc_type type is just an int. */
|
||||
typedef int nc_type;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
@ -381,10 +382,16 @@ nc__open(const char *path, int mode,
|
||||
EXTERNL int
|
||||
nc_open(const char *path, int mode, int *ncidp);
|
||||
|
||||
/* Learn the path used to open/create the file. */
|
||||
EXTERNL int
|
||||
nc_inq_path(int ncid, size_t *pathlen, char *path);
|
||||
|
||||
/* Use these with nc_var_par_access(). */
|
||||
#define NC_INDEPENDENT 0
|
||||
#define NC_COLLECTIVE 1
|
||||
|
||||
/* Set parallel access for a variable to independent (the default) or
|
||||
* collective. */
|
||||
EXTERNL int
|
||||
nc_var_par_access(int ncid, int varid, int par_access);
|
||||
|
||||
@ -1622,10 +1629,10 @@ nc__open_mp(const char *path, int mode, int basepe,
|
||||
size_t *chunksizehintp, int *ncidp);
|
||||
|
||||
EXTERNL int
|
||||
nc_delete(const char * path);
|
||||
nc_delete(const char *path);
|
||||
|
||||
EXTERNL int
|
||||
nc_delete_mp(const char * path, int basepe);
|
||||
nc_delete_mp(const char *path, int basepe);
|
||||
|
||||
EXTERNL int
|
||||
nc_set_base_pe(int ncid, int pe);
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
Copyright 2010 University Corporation for Atmospheric
|
||||
Research/Unidata. See COPYRIGHT file for more info.
|
||||
Copyright 2010 University Corporation for Atmospheric
|
||||
Research/Unidata. See COPYRIGHT file for more info.
|
||||
|
||||
This file defines the file create and open functions.
|
||||
This file defines the file create and open functions.
|
||||
|
||||
"$Id: nc4.c,v 1.1 2010/06/01 15:46:50 ed Exp $"
|
||||
"$Id: nc4.c,v 1.1 2010/06/01 15:46:50 ed Exp $"
|
||||
*/
|
||||
|
||||
#include "ncdispatch.h"
|
||||
@ -13,207 +13,217 @@ static int nc_initialized = 0;
|
||||
|
||||
static int
|
||||
NC_check_file_type(const char *path, int use_parallel, void* mpi_info,
|
||||
int *cdf, int* hdf)
|
||||
int *cdf, int* hdf)
|
||||
{
|
||||
char magic[MAGIC_NUMBER_LEN];
|
||||
char magic[MAGIC_NUMBER_LEN];
|
||||
|
||||
*hdf = 0; *cdf = 0;
|
||||
*hdf = 0; *cdf = 0;
|
||||
|
||||
/* Get the 4-byte magic from the beginning of the file. Don't use posix
|
||||
/* Get the 4-byte magic from the beginning of the file. Don't use posix
|
||||
* for parallel, use the MPI functions instead. */
|
||||
#ifdef USE_PARALLEL_MPIO
|
||||
if (use_parallel) {
|
||||
MPI_File fh;
|
||||
MPI_Status status;
|
||||
int retval;
|
||||
MPI_Comm comm = 0;
|
||||
MPI_Info info = 0;
|
||||
if(mpi_info != NULL) {
|
||||
comm = ((NC_MPI_INFO*)mpi_info)->comm;
|
||||
info = ((NC_MPI_INFO*)mpi_info)->info;
|
||||
}
|
||||
if((retval = MPI_File_open(comm, (char *)path, MPI_MODE_RDONLY,info, &fh)) != MPI_SUCCESS)
|
||||
return NC_EPARINIT;
|
||||
if((retval = MPI_File_read(fh, magic, MAGIC_NUMBER_LEN, MPI_CHAR,&status)) != MPI_SUCCESS)
|
||||
return NC_EPARINIT;
|
||||
if((retval = MPI_File_close(&fh)) != MPI_SUCCESS)
|
||||
return NC_EPARINIT;
|
||||
} else
|
||||
if (use_parallel) {
|
||||
MPI_File fh;
|
||||
MPI_Status status;
|
||||
int retval;
|
||||
MPI_Comm comm = 0;
|
||||
MPI_Info info = 0;
|
||||
if(mpi_info != NULL) {
|
||||
comm = ((NC_MPI_INFO*)mpi_info)->comm;
|
||||
info = ((NC_MPI_INFO*)mpi_info)->info;
|
||||
}
|
||||
if((retval = MPI_File_open(comm, (char *)path, MPI_MODE_RDONLY,info, &fh)) != MPI_SUCCESS)
|
||||
return NC_EPARINIT;
|
||||
if((retval = MPI_File_read(fh, magic, MAGIC_NUMBER_LEN, MPI_CHAR,&status)) != MPI_SUCCESS)
|
||||
return NC_EPARINIT;
|
||||
if((retval = MPI_File_close(&fh)) != MPI_SUCCESS)
|
||||
return NC_EPARINIT;
|
||||
} else
|
||||
#endif /* USE_PARALLEL */
|
||||
{
|
||||
FILE *fp;
|
||||
int i;
|
||||
fp = fopen(path, "r");
|
||||
if(fp == NULL)
|
||||
return errno;
|
||||
i = fread(magic, MAGIC_NUMBER_LEN, 1, fp);
|
||||
if(i != 1)
|
||||
return errno;
|
||||
fclose(fp);
|
||||
}
|
||||
{
|
||||
FILE *fp;
|
||||
int i;
|
||||
fp = fopen(path, "r");
|
||||
if(fp == NULL)
|
||||
return errno;
|
||||
i = fread(magic, MAGIC_NUMBER_LEN, 1, fp);
|
||||
if(i != 1)
|
||||
return errno;
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
/* Ignore the first byte for HDF */
|
||||
if(magic[1] == 'H' && magic[2] == 'D' && magic[3] == 'F')
|
||||
*hdf = 5;
|
||||
else if(magic[0] == '\016' && magic[1] == '\003'
|
||||
&& magic[2] == '\023' && magic[3] == '\001')
|
||||
*hdf = 4;
|
||||
else if(magic[0] == 'C' && magic[1] == 'D' && magic[2] == 'F') {
|
||||
if(magic[3] == '\001') *cdf = 1;
|
||||
else if(magic[3] == '\002') *cdf = 2;
|
||||
}
|
||||
/* Ignore the first byte for HDF */
|
||||
if(magic[1] == 'H' && magic[2] == 'D' && magic[3] == 'F')
|
||||
*hdf = 5;
|
||||
else if(magic[0] == '\016' && magic[1] == '\003'
|
||||
&& magic[2] == '\023' && magic[3] == '\001')
|
||||
*hdf = 4;
|
||||
else if(magic[0] == 'C' && magic[1] == 'D' && magic[2] == 'F') {
|
||||
if(magic[3] == '\001') *cdf = 1;
|
||||
else if(magic[3] == '\002') *cdf = 2;
|
||||
}
|
||||
|
||||
return NC_NOERR;
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_create(const char * path, int cmode, int *ncid_ptr)
|
||||
nc_create(const char *path, int cmode, int *ncidp)
|
||||
{
|
||||
return nc__create_mp(path, cmode, 0, 0, NULL, ncid_ptr);
|
||||
return NC_create(path, cmode, 0, 0, NULL, 0, NULL, ncidp);
|
||||
}
|
||||
|
||||
int
|
||||
nc__create(const char * path, int cmode, size_t initialsz,
|
||||
size_t *chunksizehintp, int *ncid_ptr)
|
||||
nc__create(const char *path, int cmode, size_t initialsz,
|
||||
size_t *chunksizehintp, int *ncidp)
|
||||
{
|
||||
return nc__create_mp(path, cmode, initialsz, 0,
|
||||
chunksizehintp, ncid_ptr);
|
||||
return NC_create(path, cmode, initialsz, 0,
|
||||
chunksizehintp, 0, NULL, ncidp);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
nc__create_mp(const char * path, int cmode, size_t initialsz, int basepe, size_t *chunksizehintp, int *ncidp)
|
||||
nc__create_mp(const char *path, int cmode, size_t initialsz,
|
||||
int basepe, size_t *chunksizehintp, int *ncidp)
|
||||
{
|
||||
return NC_create(path,cmode,initialsz,basepe,chunksizehintp,0,NULL,ncidp);
|
||||
return NC_create(path, cmode, initialsz, basepe,
|
||||
chunksizehintp, 0, NULL, ncidp);
|
||||
}
|
||||
|
||||
/*
|
||||
For create, we have the following pieces of information
|
||||
to use to determine the dispatch table.
|
||||
1. table specified by override
|
||||
2. path
|
||||
3. cmode
|
||||
For create, we have the following pieces of information
|
||||
to use to determine the dispatch table.
|
||||
1. table specified by override
|
||||
2. path
|
||||
3. cmode
|
||||
*/
|
||||
int
|
||||
NC_create(const char *path, int cmode,
|
||||
size_t initialsz, int basepe, size_t *chunksizehintp,
|
||||
int useparallel, void* mpi_info,
|
||||
int *ncidp)
|
||||
NC_create(const char *path, int cmode, size_t initialsz,
|
||||
int basepe, size_t *chunksizehintp, int useparallel,
|
||||
void* mpi_info, int *ncidp)
|
||||
{
|
||||
int stat = NC_NOERR;
|
||||
NC* ncp = NULL;
|
||||
NC_Dispatch* dispatcher = NULL;
|
||||
/* Need three pieces of information for now */
|
||||
int model = 0; /* 3 vs 4 dispatch table */
|
||||
int dap = 0; /* dap vs !dap */
|
||||
int xcmode = 0; /* for implied cmode flags */
|
||||
extern int default_create_format;
|
||||
int stat = NC_NOERR;
|
||||
NC* ncp = NULL;
|
||||
NC_Dispatch* dispatcher = NULL;
|
||||
/* Need three pieces of information for now */
|
||||
int model = 0; /* 3 vs 4 dispatch table */
|
||||
int dap = 0; /* dap vs !dap */
|
||||
int xcmode = 0; /* for implied cmode flags */
|
||||
extern int default_create_format;
|
||||
|
||||
if(!nc_initialized)
|
||||
{stat = NC_initialize(); if(stat) return stat; nc_initialized = 1;}
|
||||
/* Initialize the dispatch table. The function pointers in the
|
||||
* dispatch table will depend on how netCDF was built
|
||||
* (with/without netCDF-4, DAP). */
|
||||
if(!nc_initialized)
|
||||
{
|
||||
if ((stat = NC_initialize()))
|
||||
return stat;
|
||||
nc_initialized = 1;
|
||||
}
|
||||
|
||||
if((dap = NC_testurl(path))) model = NC_urlmodel(path);
|
||||
if((dap = NC_testurl(path))) model = NC_urlmodel(path);
|
||||
|
||||
/* Look to the incoming cmode for hints */
|
||||
if(model == 0) {
|
||||
if(cmode & NC_NETCDF4 || cmode & NC_CLASSIC_MODEL) model = 4;
|
||||
}
|
||||
/* Look to the incoming cmode for hints */
|
||||
if(model == 0) {
|
||||
if(cmode & NC_NETCDF4 || cmode & NC_CLASSIC_MODEL) model = 4;
|
||||
}
|
||||
|
||||
if(model == 0) {
|
||||
/* Check default format */
|
||||
int format = default_create_format;
|
||||
switch (format) {
|
||||
if(model == 0) {
|
||||
/* Check default format */
|
||||
int format = default_create_format;
|
||||
switch (format) {
|
||||
#ifdef USE_NETCDF4
|
||||
case NC_FORMAT_NETCDF4:
|
||||
case NC_FORMAT_NETCDF4:
|
||||
xcmode |= NC_NETCDF4;
|
||||
model = 4;
|
||||
break;
|
||||
case NC_FORMAT_NETCDF4_CLASSIC:
|
||||
case NC_FORMAT_NETCDF4_CLASSIC:
|
||||
xcmode |= NC_CLASSIC_MODEL;
|
||||
model = 4;
|
||||
break;
|
||||
#endif
|
||||
case NC_FORMAT_64BIT:
|
||||
case NC_FORMAT_64BIT:
|
||||
xcmode |= NC_64BIT_OFFSET;
|
||||
/* fall thru */
|
||||
case NC_FORMAT_CLASSIC:
|
||||
default:
|
||||
case NC_FORMAT_CLASSIC:
|
||||
default:
|
||||
|
||||
model = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Force flag consistentcy */
|
||||
if(model == 4)
|
||||
cmode |= NC_NETCDF4;
|
||||
else if(model == 3) {
|
||||
cmode &= ~(NC_NETCDF4 | NC_CLASSIC_MODEL); /* must be netcdf-3 */
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Force flag consistentcy */
|
||||
if(model == 4)
|
||||
cmode |= NC_NETCDF4;
|
||||
else if(model == 3) {
|
||||
cmode &= ~(NC_NETCDF4 | NC_CLASSIC_MODEL); /* must be netcdf-3 */
|
||||
}
|
||||
|
||||
/* Add inferred flags */
|
||||
cmode |= xcmode;
|
||||
/* Add inferred flags */
|
||||
cmode |= xcmode;
|
||||
|
||||
#ifdef USE_NETCDF4
|
||||
if((cmode & NC_MPIIO && cmode & NC_MPIPOSIX))
|
||||
return NC_EINVAL;
|
||||
if((cmode & NC_MPIIO && cmode & NC_MPIPOSIX))
|
||||
return NC_EINVAL;
|
||||
#endif
|
||||
|
||||
dispatcher = NC_get_dispatch_override();
|
||||
if(dispatcher != NULL) goto havetable;
|
||||
dispatcher = NC_get_dispatch_override();
|
||||
if(dispatcher != NULL) goto havetable;
|
||||
|
||||
/* Figure out what dispatcher to use */
|
||||
dispatcher = NC3_dispatch_table; /* default */
|
||||
/* Figure out what dispatcher to use */
|
||||
dispatcher = NC3_dispatch_table; /* default */
|
||||
#ifdef USE_DAP
|
||||
if(dap) dispatcher = NCD3_dispatch_table; /* default */
|
||||
if(dap) dispatcher = NCD3_dispatch_table; /* default */
|
||||
#endif
|
||||
|
||||
#ifdef USE_NETCDF4
|
||||
if(model == 4) {
|
||||
dispatcher = NC4_dispatch_table;
|
||||
if(model == 4) {
|
||||
dispatcher = NC4_dispatch_table;
|
||||
#ifdef USE_DAP
|
||||
if(dap) dispatcher = NCD4_dispatch_table;
|
||||
if(dap) dispatcher = NCD4_dispatch_table;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
havetable:
|
||||
stat = dispatcher->create(path,cmode,initialsz,basepe,chunksizehintp,
|
||||
useparallel,mpi_info,dispatcher,&ncp);
|
||||
if(stat == NC_NOERR) {
|
||||
ncp->dispatch = dispatcher;
|
||||
if(ncidp) *ncidp = ncp->ext_ncid;
|
||||
}
|
||||
return stat;
|
||||
havetable:
|
||||
stat = dispatcher->create(path,cmode,initialsz,basepe,chunksizehintp,
|
||||
useparallel,mpi_info,dispatcher,&ncp);
|
||||
if(stat == NC_NOERR) {
|
||||
ncp->dispatch = dispatcher;
|
||||
if(ncidp) *ncidp = ncp->ext_ncid;
|
||||
}
|
||||
return stat;
|
||||
}
|
||||
|
||||
int
|
||||
nc_open(const char *path, int mode, int *ncidp)
|
||||
{
|
||||
return nc__open_mp(path,mode,0,NULL,ncidp);
|
||||
return NC_open(path, mode, 0, NULL, 0, NULL, ncidp);
|
||||
}
|
||||
|
||||
int
|
||||
nc__open(const char * path, int cmode,
|
||||
size_t *chunksizehintp, int *ncid_ptr)
|
||||
nc__open(const char *path, int cmode,
|
||||
size_t *chunksizehintp, int *ncidp)
|
||||
{
|
||||
return nc__open_mp(path, cmode, 0, chunksizehintp, ncid_ptr);
|
||||
return NC_open(path, cmode, 0, chunksizehintp, 0,
|
||||
NULL, ncidp);
|
||||
}
|
||||
|
||||
int
|
||||
nc__open_mp(const char * path, int cmode, int basepe, size_t *chunksizehintp, int *ncidp)
|
||||
|
||||
nc__open_mp(const char *path, int cmode, int basepe,
|
||||
size_t *chunksizehintp, int *ncidp)
|
||||
{
|
||||
return NC_open(path,cmode,basepe,chunksizehintp,0,NULL,ncidp);
|
||||
return NC_open(path, cmode, basepe, chunksizehintp,
|
||||
0, NULL, ncidp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
For create, we have the following pieces of information
|
||||
to use to determine the dispatch table.
|
||||
1. table specified by override
|
||||
2. path
|
||||
3. cmode
|
||||
4. the contents of the file (if it exists);
|
||||
basically checking its magic number
|
||||
For create, we have the following pieces of information
|
||||
to use to determine the dispatch table.
|
||||
1. table specified by override
|
||||
2. path
|
||||
3. cmode
|
||||
4. the contents of the file (if it exists);
|
||||
basically checking its magic number
|
||||
*/
|
||||
|
||||
int
|
||||
@ -222,198 +232,213 @@ NC_open(const char *path, int cmode,
|
||||
int useparallel, void* mpi_info,
|
||||
int *ncidp)
|
||||
{
|
||||
int stat = NC_NOERR;
|
||||
NC* ncp = NULL;
|
||||
NC_Dispatch* dispatcher = NULL;
|
||||
/* Need two pieces of information for now */
|
||||
int model = 0; /* 3 vs 4 dispatch table */
|
||||
int dap = 0; /* dap vs !dap */
|
||||
int cdfversion = 0;
|
||||
int hdfversion = 0;
|
||||
extern int default_create_format;
|
||||
int stat = NC_NOERR;
|
||||
NC* ncp = NULL;
|
||||
NC_Dispatch* dispatcher = NULL;
|
||||
/* Need two pieces of information for now */
|
||||
int model = 0; /* 3 vs 4 dispatch table */
|
||||
int dap = 0; /* dap vs !dap */
|
||||
int cdfversion = 0;
|
||||
int hdfversion = 0;
|
||||
extern int default_create_format;
|
||||
|
||||
if(!nc_initialized)
|
||||
{stat = NC_initialize(); if(stat) return stat; nc_initialized = 1;}
|
||||
if(!nc_initialized)
|
||||
{stat = NC_initialize(); if(stat) return stat; nc_initialized = 1;}
|
||||
|
||||
if((dap = NC_testurl(path)))
|
||||
model = NC_urlmodel(path);
|
||||
if((dap = NC_testurl(path)))
|
||||
model = NC_urlmodel(path);
|
||||
|
||||
if(dap == 0) {
|
||||
/* Look at the file if it exists */
|
||||
stat = NC_check_file_type(path,useparallel,mpi_info,&cdfversion,&hdfversion);
|
||||
if(stat == NC_NOERR) {
|
||||
if(hdfversion != 0) {
|
||||
model = 4;
|
||||
} else if(cdfversion != 0) {
|
||||
model = 3;
|
||||
}
|
||||
}
|
||||
/* else ignore the file */
|
||||
}
|
||||
if(dap == 0) {
|
||||
/* Look at the file if it exists */
|
||||
stat = NC_check_file_type(path,useparallel,mpi_info,&cdfversion,&hdfversion);
|
||||
if(stat == NC_NOERR) {
|
||||
if(hdfversion != 0) {
|
||||
model = 4;
|
||||
} else if(cdfversion != 0) {
|
||||
model = 3;
|
||||
}
|
||||
}
|
||||
/* else ignore the file */
|
||||
}
|
||||
|
||||
/* Look to the incoming cmode for hints */
|
||||
if(model == 0) {
|
||||
if(cmode & NC_NETCDF4 || cmode & NC_CLASSIC_MODEL) model = 4;
|
||||
}
|
||||
/* Look to the incoming cmode for hints */
|
||||
if(model == 0) {
|
||||
if(cmode & NC_NETCDF4 || cmode & NC_CLASSIC_MODEL) model = 4;
|
||||
}
|
||||
|
||||
if(model == 0) model = 3; /* final default */
|
||||
if(model == 0) model = 3; /* final default */
|
||||
|
||||
/* Force flag consistentcy */
|
||||
if(model == 4)
|
||||
cmode |= NC_NETCDF4;
|
||||
else if(model == 3) {
|
||||
cmode &= ~(NC_NETCDF4 | NC_CLASSIC_MODEL); /* must be netcdf-3 */
|
||||
if(cdfversion == 2) cmode |= NC_64BIT_OFFSET;
|
||||
}
|
||||
/* Force flag consistentcy */
|
||||
if(model == 4)
|
||||
cmode |= NC_NETCDF4;
|
||||
else if(model == 3) {
|
||||
cmode &= ~(NC_NETCDF4 | NC_CLASSIC_MODEL); /* must be netcdf-3 */
|
||||
if(cdfversion == 2) cmode |= NC_64BIT_OFFSET;
|
||||
}
|
||||
|
||||
if((cmode & NC_MPIIO && cmode & NC_MPIPOSIX))
|
||||
return NC_EINVAL;
|
||||
if((cmode & NC_MPIIO && cmode & NC_MPIPOSIX))
|
||||
return NC_EINVAL;
|
||||
|
||||
/* override overrides any other table choice */
|
||||
dispatcher = NC_get_dispatch_override();
|
||||
if(dispatcher != NULL) goto havetable;
|
||||
/* override overrides any other table choice */
|
||||
dispatcher = NC_get_dispatch_override();
|
||||
if(dispatcher != NULL) goto havetable;
|
||||
|
||||
/* Figure out what dispatcher to use */
|
||||
dispatcher = NC3_dispatch_table; /* default */
|
||||
/* Figure out what dispatcher to use */
|
||||
dispatcher = NC3_dispatch_table; /* default */
|
||||
#ifdef USE_DAP
|
||||
if(dap) dispatcher = NCD3_dispatch_table; /* default */
|
||||
if(dap) dispatcher = NCD3_dispatch_table; /* default */
|
||||
#endif
|
||||
|
||||
#ifdef USE_NETCDF4
|
||||
if(model == 4) {
|
||||
dispatcher = NC4_dispatch_table;
|
||||
if(model == 4) {
|
||||
dispatcher = NC4_dispatch_table;
|
||||
#ifdef USE_DAP
|
||||
if(dap) dispatcher = NCD4_dispatch_table;
|
||||
if(dap) dispatcher = NCD4_dispatch_table;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
havetable:
|
||||
stat = dispatcher->open(path,cmode,basepe,chunksizehintp,useparallel,mpi_info,dispatcher,&ncp);
|
||||
if(stat == NC_NOERR) {
|
||||
ncp->dispatch = dispatcher;
|
||||
if(ncidp) *ncidp = ncp->ext_ncid;
|
||||
}
|
||||
return stat;
|
||||
havetable:
|
||||
stat = dispatcher->open(path, cmode, basepe, chunksizehintp,
|
||||
useparallel, mpi_info, dispatcher, &ncp);
|
||||
if(stat == NC_NOERR) {
|
||||
ncp->dispatch = dispatcher;
|
||||
if(ncidp) *ncidp = ncp->ext_ncid;
|
||||
}
|
||||
return stat;
|
||||
}
|
||||
|
||||
/* This function returns the file pathname (or the opendap URL) which
|
||||
* was used to open/create the ncid's file. */
|
||||
int
|
||||
nc_inq_path(int ncid, size_t *pathlen, char *path)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat;
|
||||
|
||||
if ((stat = NC_check_id(ncid, &ncp)))
|
||||
return stat;
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_redef(int ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->redef(ncid);
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->redef(ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->_enddef(ncid,h_minfree,v_align,v_minfree,r_align);
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->_enddef(ncid,h_minfree,v_align,v_minfree,r_align);
|
||||
}
|
||||
|
||||
int
|
||||
nc_enddef(int ncid)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR) return status;
|
||||
return ncp->dispatch->_enddef(ncid,0,1,0,1);
|
||||
int status;
|
||||
NC *ncp;
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR) return status;
|
||||
return ncp->dispatch->_enddef(ncid,0,1,0,1);
|
||||
}
|
||||
|
||||
int
|
||||
nc_sync(int ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->sync(ncid);
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->sync(ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_abort(int ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->abort(ncid);
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->abort(ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_close(int ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->close(ncid);
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->close(ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_set_fill(int ncid, int fillmode, int *old_modep)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->set_fill(ncid,fillmode,old_modep);
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->set_fill(ncid,fillmode,old_modep);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_base_pe(int ncid, int *pe)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_base_pe(ncid,pe);
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_base_pe(ncid,pe);
|
||||
}
|
||||
|
||||
int
|
||||
nc_set_base_pe(int ncid, int pe)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->set_base_pe(ncid,pe);
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->set_base_pe(ncid,pe);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nc_inq_format(int ncid, int *formatp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_format(ncid,formatp);
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_format(ncid,formatp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq(ncid,ndimsp,nvarsp,nattsp,unlimdimidp);
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq(ncid,ndimsp,nvarsp,nattsp,unlimdimidp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size)
|
||||
{
|
||||
NC* ncp;
|
||||
/* For compatibility, we need to allow inq about
|
||||
atomic types, even if ncid is ill-defined */
|
||||
if(xtype <= ATOMICTYPEMAX) {
|
||||
if(xtype <= NC_NAT) return NC_EBADTYPE;
|
||||
if(name) strncpy(name,NC_atomictypename(xtype),NC_MAX_NAME);
|
||||
if(size) *size = NC_atomictypelen(xtype);
|
||||
return NC_NOERR;
|
||||
} else {
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return NC_EBADTYPE; /* compatibility */
|
||||
return ncp->dispatch->inq_type(ncid,xtype,name,size);
|
||||
}
|
||||
NC* ncp;
|
||||
/* For compatibility, we need to allow inq about
|
||||
atomic types, even if ncid is ill-defined */
|
||||
if(xtype <= ATOMICTYPEMAX) {
|
||||
if(xtype <= NC_NAT) return NC_EBADTYPE;
|
||||
if(name) strncpy(name,NC_atomictypename(xtype),NC_MAX_NAME);
|
||||
if(size) *size = NC_atomictypelen(xtype);
|
||||
return NC_NOERR;
|
||||
} else {
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return NC_EBADTYPE; /* compatibility */
|
||||
return ncp->dispatch->inq_type(ncid,xtype,name,size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -199,28 +199,29 @@ int (*set_base_pe)(int,int);
|
||||
int (*inq_format)(int,int*);
|
||||
|
||||
int (*inq)(int,int*,int*,int*,int*);
|
||||
int (*inq_type)(int,nc_type,char*,size_t*);
|
||||
int (*inq_path)(int, size_t *, char*);
|
||||
int (*inq_type)(int, nc_type, char*, size_t*);
|
||||
|
||||
int (*def_dim)(int,const char*,size_t,int*);
|
||||
int (*inq_dimid)(int,const char*,int*);
|
||||
int (*inq_dim)(int,int,char*,size_t*);
|
||||
int (*inq_unlimdim)(int ncid, int *unlimdimidp);
|
||||
int (*rename_dim)(int,int,const char*);
|
||||
int (*def_dim)(int, const char*, size_t, int*);
|
||||
int (*inq_dimid)(int, const char*, int*);
|
||||
int (*inq_dim)(int, int, char*, size_t*);
|
||||
int (*inq_unlimdim)(int ncid, int *unlimdimidp);
|
||||
int (*rename_dim)(int, int, const char*);
|
||||
|
||||
int (*inq_att)(int,int,const char*,nc_type*,size_t*);
|
||||
int (*inq_attid)(int,int,const char*,int*);
|
||||
int (*inq_attname)(int,int,int,char*);
|
||||
int (*rename_att)(int,int,const char*,const char*);
|
||||
int (*del_att)(int,int,const char*);
|
||||
int (*get_att)(int,int,const char*,void*,nc_type);
|
||||
int (*put_att)(int,int,const char*,nc_type,size_t,const void*,nc_type);
|
||||
int (*inq_att)(int, int, const char*, nc_type*, size_t*);
|
||||
int (*inq_attid)(int, int, const char*, int*);
|
||||
int (*inq_attname)(int, int, int, char*);
|
||||
int (*rename_att)(int, int, const char*, const char*);
|
||||
int (*del_att)(int, int, const char*);
|
||||
int (*get_att)(int, int, const char*, void*, nc_type);
|
||||
int (*put_att)(int, int, const char*, nc_type, size_t, const void*, nc_type);
|
||||
|
||||
int (*def_var)(int,const char*,nc_type,int,const int*,int*);
|
||||
int (*inq_varid)(int,const char*,int*);
|
||||
int (*rename_var)(int,int,const char*);
|
||||
int (*def_var)(int, const char*, nc_type, int, const int*, int*);
|
||||
int (*inq_varid)(int, const char*, int*);
|
||||
int (*rename_var)(int, int, const char*);
|
||||
|
||||
int (*get_vara)(int,int,const size_t*,const size_t*,void*,nc_type);
|
||||
int (*put_vara)(int,int,const size_t*,const size_t*,const void*,nc_type);
|
||||
int (*get_vara)(int, int, const size_t*, const size_t*, void*, nc_type);
|
||||
int (*put_vara)(int, int, const size_t*, const size_t*, const void*, nc_type);
|
||||
|
||||
int (*inq_var_all)(int ncid, int varid, char *name, nc_type *xtypep,
|
||||
int *ndimsp, int *dimidsp, int *nattsp,
|
||||
@ -234,41 +235,41 @@ int (*inq_var_all)(int ncid, int varid, char *name, nc_type *xtypep,
|
||||
*/
|
||||
#ifdef USE_NETCDF4
|
||||
int (*show_metadata)(int);
|
||||
int (*inq_unlimdims)(int,int*,int*);
|
||||
int (*var_par_access)(int,int,int);
|
||||
int (*inq_ncid)(int,const char*,int*);
|
||||
int (*inq_grps)(int,int*,int*);
|
||||
int (*inq_grpname)(int,char*);
|
||||
int (*inq_grpname_full)(int,size_t*,char*);
|
||||
int (*inq_grp_parent)(int,int*);
|
||||
int (*inq_grp_full_ncid)(int,const char*,int*);
|
||||
int (*inq_varids)(int,int* nvars,int*);
|
||||
int (*inq_dimids)(int,int* ndims,int*,int);
|
||||
int (*inq_typeids)(int,int* ntypes,int*);
|
||||
int (*inq_type_equal)(int,nc_type,int,nc_type,int*);
|
||||
int (*def_grp)(int,const char*,int*);
|
||||
int (*inq_user_type)(int,nc_type,char*,size_t*,nc_type*,size_t*,int*);
|
||||
int (*inq_typeid)(int,const char*,nc_type*);
|
||||
int (*inq_unlimdims)(int, int*, int*);
|
||||
int (*var_par_access)(int, int, int);
|
||||
int (*inq_ncid)(int, const char*, int*);
|
||||
int (*inq_grps)(int, int*, int*);
|
||||
int (*inq_grpname)(int, char*);
|
||||
int (*inq_grpname_full)(int, size_t*, char*);
|
||||
int (*inq_grp_parent)(int, int*);
|
||||
int (*inq_grp_full_ncid)(int, const char*, int*);
|
||||
int (*inq_varids)(int, int* nvars, int*);
|
||||
int (*inq_dimids)(int, int* ndims, int*, int);
|
||||
int (*inq_typeids)(int, int* ntypes, int*);
|
||||
int (*inq_type_equal)(int, nc_type, int, nc_type, int*);
|
||||
int (*def_grp)(int, const char*, int*);
|
||||
int (*inq_user_type)(int, nc_type, char*, size_t*, nc_type*, size_t*, int*);
|
||||
int (*inq_typeid)(int, const char*, nc_type*);
|
||||
|
||||
int (*def_compound)(int,size_t,const char*,nc_type*);
|
||||
int (*insert_compound)(int,nc_type,const char*,size_t,nc_type);
|
||||
int (*insert_array_compound)(int,nc_type,const char*,size_t,nc_type,int,const int*);
|
||||
int (*inq_compound_field)(int,nc_type,int,char*,size_t*,nc_type*,int*,int*);
|
||||
int (*inq_compound_fieldindex)(int,nc_type,const char*,int*);
|
||||
int (*def_vlen)(int,const char*,nc_type base_typeid,nc_type*);
|
||||
int (*put_vlen_element)(int,int,void*,size_t,const void*);
|
||||
int (*get_vlen_element)(int,int,const void*,size_t*,void*);
|
||||
int (*def_enum)(int,nc_type,const char*,nc_type*);
|
||||
int (*insert_enum)(int,nc_type,const char*,const void*);
|
||||
int (*inq_enum_member)(int,nc_type,int,char*,void*);
|
||||
int (*inq_enum_ident)(int,nc_type,long long,char*);
|
||||
int (*def_opaque)(int,size_t,const char*,nc_type*);
|
||||
int (*def_var_deflate)(int,int,int,int,int);
|
||||
int (*def_var_fletcher32)(int,int,int);
|
||||
int (*def_var_chunking)(int,int,int,const size_t*);
|
||||
int (*def_var_fill)(int,int,int,const void*);
|
||||
int (*def_var_endian)(int,int,int);
|
||||
int (*set_var_chunk_cache)(int,int,size_t,size_t,float);
|
||||
int (*def_compound)(int, size_t, const char*, nc_type*);
|
||||
int (*insert_compound)(int, nc_type, const char*, size_t, nc_type);
|
||||
int (*insert_array_compound)(int, nc_type, const char*, size_t, nc_type, int, const int*);
|
||||
int (*inq_compound_field)(int, nc_type, int, char*, size_t*, nc_type*, int*, int*);
|
||||
int (*inq_compound_fieldindex)(int, nc_type, const char*, int*);
|
||||
int (*def_vlen)(int, const char*, nc_type base_typeid, nc_type*);
|
||||
int (*put_vlen_element)(int, int, void*, size_t, const void*);
|
||||
int (*get_vlen_element)(int, int, const void*, size_t*, void*);
|
||||
int (*def_enum)(int, nc_type, const char*, nc_type*);
|
||||
int (*insert_enum)(int, nc_type, const char*, const void*);
|
||||
int (*inq_enum_member)(int, nc_type, int, char*, void*);
|
||||
int (*inq_enum_ident)(int, nc_type, long long, char*);
|
||||
int (*def_opaque)(int, size_t, const char*, nc_type*);
|
||||
int (*def_var_deflate)(int, int, int, int, int);
|
||||
int (*def_var_fletcher32)(int, int, int);
|
||||
int (*def_var_chunking)(int, int, int, const size_t*);
|
||||
int (*def_var_fill)(int, int, int, const void*);
|
||||
int (*def_var_endian)(int, int, int);
|
||||
int (*set_var_chunk_cache)(int, int, size_t, size_t, float);
|
||||
int (*get_var_chunk_cache)(int ncid, int varid, size_t *sizep, size_t *nelemsp, float *preemptionp);
|
||||
#endif /*USE_NETCDF4*/
|
||||
|
||||
|
@ -55,6 +55,7 @@ NULL, /*set_base_pe*/
|
||||
NULL, /*inq_format*/
|
||||
|
||||
NULL, /*inq*/
|
||||
NULL, /*inq_path*/
|
||||
NULL, /*inq_type*/
|
||||
|
||||
NULL, /*def_dim*/
|
||||
|
@ -48,6 +48,7 @@ NULL, /*set_base_pe*/
|
||||
NULL, /*inq_format*/
|
||||
|
||||
NULL, /*inq*/
|
||||
NULL, /*inq_path*/
|
||||
NULL, /*inq_type*/
|
||||
|
||||
NULL, /*def_dim*/
|
||||
|
@ -1494,6 +1494,15 @@ NC3_inq_type(int ncid, nc_type typeid, char *name, size_t *size)
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/* If you wanted to know the path, why don't you just remember it in
|
||||
* your program? */
|
||||
int
|
||||
NC3_inq_path(int ncid, size_t *pathlen, char *path)
|
||||
{
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_delete_mp(const char * path, int basepe)
|
||||
{
|
||||
|
@ -306,6 +306,8 @@ struct NC {
|
||||
*/
|
||||
ushmem_t lock[LOCKNUMREC_DIM];
|
||||
#endif
|
||||
/* Save the path name. */
|
||||
char *path;
|
||||
};
|
||||
|
||||
#define NC_readonly(ncp) \
|
||||
|
@ -94,6 +94,7 @@ NC3_set_base_pe,
|
||||
NC3_inq_format,
|
||||
|
||||
NC3_inq,
|
||||
NC3_inq_path,
|
||||
NC3_inq_type,
|
||||
|
||||
NC3_def_dim,
|
||||
|
@ -109,7 +109,10 @@ EXTERNL int
|
||||
NC3_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp);
|
||||
|
||||
EXTERNL int
|
||||
NC3_inq_type(int,nc_type,char*,size_t*);
|
||||
NC3_inq_path(int, size_t *, char *);
|
||||
|
||||
EXTERNL int
|
||||
NC3_inq_type(int, nc_type, char *, size_t *);
|
||||
|
||||
/* Begin _dim */
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
/*********************************************************************
|
||||
Copyright 2010, UCAR/Unidata See netcdf/COPYRIGHT file for
|
||||
copying and redistribution conditions.
|
||||
|
||||
$Id: nclistmgr.c,v 2.3 2010/05/26 11:11:26 ed Exp $
|
||||
*********************************************************************/
|
||||
|
||||
#include <config.h>
|
||||
@ -66,7 +64,7 @@ del_from_NCList(NC* ncp)
|
||||
numfiles--;
|
||||
}
|
||||
|
||||
NC*
|
||||
NC *
|
||||
find_in_NCList(int ext_ncid)
|
||||
{
|
||||
NC* f = NULL;
|
||||
|
@ -27,6 +27,7 @@ NC4_set_base_pe,
|
||||
NC4_inq_format,
|
||||
|
||||
NC4_inq,
|
||||
NC4_inq_path,
|
||||
NC4_inq_type,
|
||||
|
||||
NC4_def_dim,
|
||||
|
@ -1,36 +1,10 @@
|
||||
/*
|
||||
* Copyright 1993-1996 University Corporation for Atmospheric Research/Unidata
|
||||
*
|
||||
* Portions of this software were developed by the Unidata Program at the
|
||||
* University Corporation for Atmospheric Research.
|
||||
*
|
||||
* Access and use of this software shall impose the following obligations
|
||||
* and understandings on the user. The user is granted the right, without
|
||||
* any fee or cost, to use, copy, modify, alter, enhance and distribute
|
||||
* this software, and any derivative works thereof, and its supporting
|
||||
* documentation for any purpose whatsoever, provided that this entire
|
||||
* notice appears in all copies of the software, derivative works and
|
||||
* supporting documentation. Further, UCAR requests that the user credit
|
||||
* UCAR/Unidata in any publications that result from the use of this
|
||||
* software or in any product that includes this software. The names UCAR
|
||||
* and/or Unidata, however, may not be used in any advertising or publicity
|
||||
* to endorse or promote any products or commercial entity unless specific
|
||||
* written permission is obtained from UCAR/Unidata. The user also
|
||||
* understands that UCAR/Unidata is not obligated to provide the user with
|
||||
* any support, consulting, training or assistance of any kind with regard
|
||||
* to the use, operation and performance of this software nor to provide
|
||||
* the user with any updates, revisions, new versions or "bug fixes."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
|
||||
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
* WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* "$Id: nc4dispatch.h,v 1.3 2010/05/25 03:48:31 dmh Exp $" */
|
||||
/*********************************************************************
|
||||
* Copyright 2010, UCAR/Unidata. See netcdf/COPYRIGHT file for copying
|
||||
* and redistribution conditions.
|
||||
*
|
||||
* This header file contains the prototypes for the netCDF-4 versions
|
||||
* of all the netCDF functions.
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef _NC4DISPATCH_H
|
||||
#define _NC4DISPATCH_H
|
||||
@ -42,124 +16,110 @@
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* The Interface
|
||||
*/
|
||||
|
||||
/* Declaration modifiers for DLL support (MSC et al) */
|
||||
|
||||
#if defined(DLL_NETCDF) /* define when library is a DLL */
|
||||
# if defined(DLL_EXPORT) /* define when building the library */
|
||||
# define MSC_EXTRA __declspec(dllexport)
|
||||
# else
|
||||
# define MSC_EXTRA __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
#define MSC_EXTRA
|
||||
#endif /* defined(DLL_NETCDF) */
|
||||
|
||||
# define EXTERNL extern MSC_EXTRA
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_create(const char *path, int cmode,
|
||||
size_t initialsz, int basepe, size_t *chunksizehintp,
|
||||
int useparallel, void* parameters,
|
||||
NC_Dispatch*, NC**);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_open(const char *path, int mode,
|
||||
int basepe, size_t *chunksizehintp,
|
||||
int use_parallel, void* parameters,
|
||||
NC_Dispatch*, NC**);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_redef(int ncid);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4__enddef(int ncid, size_t h_minfree, size_t v_align,
|
||||
size_t v_minfree, size_t r_align);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_sync(int ncid);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_abort(int ncid);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_close(int ncid);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_set_fill(int ncid, int fillmode, int *old_modep);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_set_base_pe(int ncid, int pe);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_inq_base_pe(int ncid, int *pe);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_inq_format(int ncid, int *formatp);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_type(int,nc_type,char*,size_t*);
|
||||
extern int
|
||||
NC4_inq_path(int, size_t *, char *);
|
||||
|
||||
extern int
|
||||
NC4_inq_type(int, nc_type, char *, size_t *);
|
||||
|
||||
/* Begin _dim */
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_def_dim(int ncid, const char *name, size_t len, int *idp);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_inq_dimid(int ncid, const char *name, int *idp);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_inq_dim(int ncid, int dimid, char *name, size_t *lenp);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_inq_unlimdim(int ncid, int *unlimdimidp);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_rename_dim(int ncid, int dimid, const char *name);
|
||||
|
||||
/* End _dim */
|
||||
/* Begin _att */
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_inq_att(int ncid, int varid, const char *name,
|
||||
nc_type *xtypep, size_t *lenp);
|
||||
nc_type *xtypep, size_t *lenp);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_inq_attid(int ncid, int varid, const char *name, int *idp);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_inq_attname(int ncid, int varid, int attnum, char *name);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_rename_att(int ncid, int varid, const char *name, const char *newname);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_del_att(int ncid, int varid, const char*);
|
||||
|
||||
/* End _att */
|
||||
/* Begin {put,get}_att */
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_get_att(int ncid, int varid, const char *name, void *value, nc_type);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_put_att(int ncid, int varid, const char *name, nc_type datatype,
|
||||
size_t len, const void *value, nc_type);
|
||||
|
||||
/* End {put,get}_att */
|
||||
/* Begin _var */
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_def_var(int ncid, const char *name,
|
||||
nc_type xtype, int ndims, const int *dimidsp, int *varidp);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
|
||||
int *ndimsp, int *dimidsp, int *nattsp,
|
||||
int *shufflep, int *deflatep, int *deflate_levelp,
|
||||
@ -167,18 +127,18 @@ NC4_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
|
||||
int *no_fill, void *fill_valuep, int *endiannessp,
|
||||
int *options_maskp, int *pixels_per_blockp);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_inq_varid(int ncid, const char *name, int *varidp);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_rename_var(int ncid, int varid, const char *name);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_put_vara(int ncid, int varid,
|
||||
const size_t *start, const size_t *count,
|
||||
const void *value, nc_type);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_get_vara(int ncid, int varid,
|
||||
const size_t *start, const size_t *count,
|
||||
void *value, nc_type);
|
||||
@ -186,119 +146,122 @@ NC4_get_vara(int ncid, int varid,
|
||||
/* End _var */
|
||||
|
||||
/* netCDF4 API only */
|
||||
EXTERNL int
|
||||
NC4_var_par_access(int,int,int);
|
||||
extern int
|
||||
NC4_var_par_access(int, int, int);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_ncid(int,const char*,int*);
|
||||
extern int
|
||||
NC4_inq_ncid(int, const char *, int *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_grps(int,int*,int*);
|
||||
extern int
|
||||
NC4_inq_grps(int, int *, int *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_grpname(int,char*);
|
||||
extern int
|
||||
NC4_inq_grpname(int, char *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_grpname_full(int,size_t*,char*);
|
||||
extern int
|
||||
NC4_inq_grpname_full(int, size_t *, char *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_grp_parent(int,int*);
|
||||
extern int
|
||||
NC4_inq_grp_parent(int, int *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_grp_full_ncid(int,const char*,int*);
|
||||
extern int
|
||||
NC4_inq_grp_full_ncid(int, const char *, int *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_varids(int,int* nvars,int*);
|
||||
extern int
|
||||
NC4_inq_varids(int, int * nvars, int *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_dimids(int,int* ndims,int*,int);
|
||||
extern int
|
||||
NC4_inq_dimids(int, int * ndims, int *, int);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_typeids(int,int* ntypes,int*);
|
||||
extern int
|
||||
NC4_inq_typeids(int, int * ntypes, int *);
|
||||
|
||||
extern int
|
||||
NC4_inq_type_equal(int, nc_type, int, nc_type, int *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_type_equal(int,nc_type,int,nc_type,int*);
|
||||
extern int
|
||||
NC4_def_grp(int, const char *, int *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_def_grp(int,const char*,int*);
|
||||
extern int
|
||||
NC4_inq_user_type(int, nc_type, char *, size_t *, nc_type *,
|
||||
size_t *, int *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_user_type(int,nc_type,char*,size_t*,nc_type*,size_t*,int*);
|
||||
extern int
|
||||
NC4_def_compound(int, size_t, const char *, nc_type *);
|
||||
|
||||
extern int
|
||||
NC4_insert_compound(int, nc_type, const char *, size_t, nc_type);
|
||||
|
||||
EXTERNL int
|
||||
NC4_def_compound(int,size_t,const char*,nc_type*);
|
||||
extern int
|
||||
NC4_insert_array_compound(int, nc_type, const char *, size_t,
|
||||
nc_type, int, const int *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_insert_compound(int,nc_type,const char*,size_t,nc_type);
|
||||
extern int
|
||||
NC4_inq_typeid(int, const char *, nc_type *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_insert_array_compound(int,nc_type,const char*,size_t,nc_type,int,const int*);
|
||||
extern int
|
||||
NC4_inq_compound_field(int, nc_type, int, char *, size_t *,
|
||||
nc_type *, int *, int *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_typeid(int,const char*,nc_type*);
|
||||
extern int
|
||||
NC4_inq_compound_fieldindex(int, nc_type, const char *, int *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_compound_field(int,nc_type,int,char*,size_t*,nc_type*,int*,int*);
|
||||
extern int
|
||||
NC4_def_vlen(int, const char *, nc_type base_typeid, nc_type *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_compound_fieldindex(int,nc_type,const char*,int*);
|
||||
extern int
|
||||
NC4_put_vlen_element(int, int, void *, size_t, const void *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_def_vlen(int,const char*,nc_type base_typeid,nc_type*);
|
||||
extern int
|
||||
NC4_get_vlen_element(int, int, const void *, size_t *, void *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_put_vlen_element(int,int,void*,size_t,const void*);
|
||||
extern int
|
||||
NC4_def_enum(int, nc_type, const char *, nc_type *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_get_vlen_element(int,int,const void*,size_t*,void*);
|
||||
extern int
|
||||
NC4_insert_enum(int, nc_type, const char *, const void *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_def_enum(int,nc_type,const char*,nc_type*);
|
||||
extern int
|
||||
NC4_inq_enum_member(int, nc_type, int, char *, void *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_insert_enum(int,nc_type,const char*,const void*);
|
||||
extern int
|
||||
NC4_inq_enum_ident(int, nc_type, long long, char *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_enum_member(int,nc_type,int,char*,void*);
|
||||
extern int
|
||||
NC4_def_opaque(int, size_t, const char *, nc_type *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_enum_ident(int,nc_type,long long,char*);
|
||||
extern int
|
||||
NC4_def_var_deflate(int, int, int, int, int);
|
||||
|
||||
EXTERNL int
|
||||
NC4_def_opaque(int,size_t,const char*,nc_type*);
|
||||
extern int
|
||||
NC4_def_var_fletcher32(int, int, int);
|
||||
|
||||
EXTERNL int
|
||||
NC4_def_var_deflate(int,int,int,int,int);
|
||||
extern int
|
||||
NC4_def_var_chunking(int, int, int, const size_t *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_def_var_fletcher32(int,int,int);
|
||||
extern int
|
||||
NC4_def_var_fill(int, int, int, const void *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_def_var_chunking(int,int,int,const size_t*);
|
||||
extern int
|
||||
NC4_def_var_endian(int, int, int);
|
||||
|
||||
EXTERNL int
|
||||
NC4_def_var_fill(int,int,int,const void*);
|
||||
extern int
|
||||
NC4_set_var_chunk_cache(int, int, size_t, size_t, float);
|
||||
|
||||
EXTERNL int
|
||||
NC4_def_var_endian(int,int,int);
|
||||
extern int
|
||||
NC4_get_var_chunk_cache(int, int, size_t *, size_t *, float *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_set_var_chunk_cache(int,int,size_t,size_t,float);
|
||||
extern int
|
||||
NC4_inq_unlimdims(int, int *, int *);
|
||||
|
||||
EXTERNL int
|
||||
NC4_get_var_chunk_cache(int,int,size_t*,size_t*,float*);
|
||||
|
||||
EXTERNL int
|
||||
NC4_inq_unlimdims(int,int*,int*);
|
||||
|
||||
EXTERNL int
|
||||
extern int
|
||||
NC4_show_metadata(int);
|
||||
|
||||
extern int NC4_initialize(void);
|
||||
extern int
|
||||
NC4_initialize(void);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_NC4DISPATCH_H*/
|
||||
#endif /*_NC4DISPATCH_H */
|
||||
|
@ -2733,11 +2733,10 @@ NC4_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp)
|
||||
return ncmpi_inq(nc->int_ncid, ndimsp, nvarsp, nattsp, unlimdimidp);
|
||||
#endif /* USE_PNETCDF */
|
||||
|
||||
/* Take care of netcdf-3 files. */
|
||||
assert(h5);
|
||||
/* Netcdf-3 files are already taken care of. */
|
||||
assert(h5 && grp && nc);
|
||||
|
||||
/* Count the number of dims, vars, and global atts. */
|
||||
assert(h5 && grp && nc);
|
||||
if (ndimsp)
|
||||
{
|
||||
*ndimsp = 0;
|
||||
@ -2779,6 +2778,22 @@ NC4_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp)
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/* Learn the path used to open/create the file. */
|
||||
int
|
||||
NC4_inq_path(int ncid, size_t *pathlen, char *path)
|
||||
{
|
||||
NC_FILE_INFO_T *nc;
|
||||
NC_HDF5_FILE_INFO_T *h5;
|
||||
NC_GRP_INFO_T *grp;
|
||||
int retval;
|
||||
|
||||
/* Find file metadata. */
|
||||
if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
|
||||
return retval;
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/* This function will do the enddef stuff for a netcdf-4 file. */
|
||||
int
|
||||
nc4_enddef_netcdf4_file(NC_HDF5_FILE_INFO_T *h5)
|
||||
|
@ -15,7 +15,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/libsrc4 -I$(top_srcdir)/libsrc
|
||||
|
||||
# Our test programs and sources. (tst_h_vl2 must come after tst_vl.)
|
||||
NC4_TEST_PROGS = t_type cdm_sea_soundings tst_camrun tst_vl tst_atts \
|
||||
tst_atts2 tst_vars2
|
||||
tst_atts2 tst_vars2 tst_files
|
||||
cdm_sea_soundings_SOURCES = cdm_sea_soundings.c tests.h
|
||||
tst_camrun_SOURCES = tst_camrun.c tests.h
|
||||
|
||||
|
@ -741,7 +741,7 @@ main(int argc, char **argv)
|
||||
int data[DIM6_LEN], data_in[DIM6_LEN];
|
||||
size_t chunksize_in[NDIMS6];
|
||||
int storage_in;
|
||||
int i, d;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < DIM6_LEN; i++)
|
||||
data[i] = i;
|
||||
|
Loading…
Reference in New Issue
Block a user