当前位置: 首页>>代码示例>>C++>>正文


C++ NC_check_id函数代码示例

本文整理汇总了C++中NC_check_id函数的典型用法代码示例。如果您正苦于以下问题:C++ NC_check_id函数的具体用法?C++ NC_check_id怎么用?C++ NC_check_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NC_check_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: nc_get_vara

/**@{*/
int
nc_get_vara(int ncid, int varid, const size_t *startp,
	    const size_t *countp, void *ip)
{
   NC* ncp = NULL;
   nc_type xtype = NC_NAT;
   int stat = NC_check_id(ncid, &ncp);
   if(stat != NC_NOERR) return stat;
   stat = nc_inq_vartype(ncid, varid, &xtype);
   if(stat != NC_NOERR) return stat;
   return NC_get_vara(ncid, varid, startp, countp, ip, xtype);
}
开发者ID:BJangeofan,项目名称:netcdf-c,代码行数:13,代码来源:dvarget.c

示例2: NC5_inq

static int
NC5_inq(int ncid,
	int *ndimsp,
	int *nvarsp,
	int *nattsp,
	int *unlimp)
{
    NC* nc;
    int status = NC_check_id(ncid, &nc);
    if(status != NC_NOERR) return status;
    return ncmpi_inq(nc->int_ncid,ndimsp,nvarsp,nattsp,unlimp);
}
开发者ID:haibo031031,项目名称:netcdf-c,代码行数:12,代码来源:nc5dispatch.c

示例3: nc_get_vars_string

int
nc_get_vars_string(int ncid, int varid,
		   const size_t *startp, const size_t *countp,
		   const ptrdiff_t * stridep,
		   char* *ip)
{
   NC* ncp;
   int stat = NC_check_id(ncid, &ncp);
   if(stat != NC_NOERR) return stat;
   return NC_get_vars(ncid, varid, startp, countp, stridep,
		      (void *)ip, NC_STRING);
}
开发者ID:BJangeofan,项目名称:netcdf-c,代码行数:12,代码来源:dvarget.c

示例4: nc_get_varm_uint

int
nc_get_varm_uint(int ncid, int varid,
		 const size_t *startp, const size_t *countp,
		 const ptrdiff_t *stridep, const ptrdiff_t *imapp,
		 unsigned int *ip)
{
   NC *ncp;
   int stat = NC_check_id(ncid, &ncp);
   if(stat != NC_NOERR) return stat;
   return NC_get_varm(ncid, varid, startp, countp,
		      stridep, imapp, (void *)ip, T_uint);
}
开发者ID:BJangeofan,项目名称:netcdf-c,代码行数:12,代码来源:dvarget.c

示例5: nc_put_vars

/**@{*/
int
nc_put_vars (int ncid, int varid, const size_t *startp,
	     const size_t *countp, const ptrdiff_t *stridep,
	     const void *op)
{
   NC *ncp;
   int stat = NC_NOERR;

   if ((stat = NC_check_id(ncid, &ncp)))
       return stat;
   return ncp->dispatch->put_vars(ncid, varid, startp, countp,
				  stridep, op, NC_NAT);
}
开发者ID:BJangeofan,项目名称:netcdf-c,代码行数:14,代码来源:dvarput.c

示例6: nvdims

static size_t
nvdims(int ncid, int varid)
{
	NC *ncp;
	if(NC_check_id(ncid, &ncp) != NC_NOERR)
		return 0;
	{
		const NC_var *const varp = NC_lookupvar(ncp, varid);
		if(varp == NULL)
			return 0;
		return varp->ndims;
	}
}
开发者ID:stcorp,项目名称:harp,代码行数:13,代码来源:v2i.c

示例7: nc_get_varm

/** \{ */
int
nc_get_varm(int ncid, int varid, const size_t * startp,
	    const size_t * countp, const ptrdiff_t * stridep,
	    const ptrdiff_t * imapp, void *ip)
{
   NC* ncp;
   int stat = NC_NOERR;

   if ((stat = NC_check_id(ncid, &ncp)))
       return stat;
   return ncp->dispatch->get_varm(ncid, varid, startp, countp,
				  stridep, imapp, ip, NC_NAT);
}
开发者ID:bishtgautam,项目名称:sbetr,代码行数:14,代码来源:dvarget.c

示例8: returns

/**
@ingroup variables
Define a new variable.

This function adds a new variable to an open netCDF dataset or group.
It returns (as an argument) a variable ID, given the netCDF ID,
the variable name, the variable type, the number of dimensions, and a
list of the dimension IDs.

@param ncid NetCDF or group ID, from a previous call to nc_open(),
nc_create(), nc_def_grp(), or associated inquiry functions such as
nc_inq_ncid().

@param name Variable \ref object_name.

@param xtype \ref data_type of the variable.

@param ndims Number of dimensions for the variable. For example, 2
specifies a matrix, 1 specifies a vector, and 0 means the variable is
a scalar with no dimensions. Must not be negative or greater than the
predefined constant ::NC_MAX_VAR_DIMS. In netCDF-4/HDF5 files, may not
exceed the HDF5 maximum number of dimensions (32).

@param dimidsp Vector of ndims dimension IDs corresponding to the
variable dimensions. For classic model netCDF files, if the ID of the
unlimited dimension is included, it must be first. This argument is
ignored if ndims is 0. For expanded model netCDF4/HDF5 files, there
may be any number of unlimited dimensions, and they may be used in any
element of the dimids array.

@param varidp Pointer to location for the returned variable ID.

@returns ::NC_NOERR No error.
@returns ::NC_EBADID Bad ncid.
@returns ::NC_ENOTINDEFINE Not in define mode.
@returns ::NC_ESTRICTNC3 Attempting netcdf-4 operation on strict nc3 netcdf-4 file.
@returns ::NC_EMAXVARS NC_MAX_VARS exceeded [Not enforced after 4.5.0]
@returns ::NC_EBADTYPE Bad type.
@returns ::NC_EINVAL Invalid input.
@returns ::NC_ENAMEINUSE Name already in use.
@returns ::NC_EPERM Attempt to create object in read-only file.

@section nc_def_var_example Example

Here is an example using nc_def_var to create a variable named rh of
type double with three dimensions, time, lat, and lon in a new netCDF
dataset named foo.nc:

@code
     #include <netcdf.h>
        ...
     int  status;
     int  ncid;
     int  lat_dim, lon_dim, time_dim;
     int  rh_id;
     int  rh_dimids[3];
        ...
     status = nc_create("foo.nc", NC_NOCLOBBER, &ncid);
     if (status != NC_NOERR) handle_error(status);
        ...

     status = nc_def_dim(ncid, "lat", 5L, &lat_dim);
     if (status != NC_NOERR) handle_error(status);
     status = nc_def_dim(ncid, "lon", 10L, &lon_dim);
     if (status != NC_NOERR) handle_error(status);
     status = nc_def_dim(ncid, "time", NC_UNLIMITED, &time_dim);
     if (status != NC_NOERR) handle_error(status);
        ...

     rh_dimids[0] = time_dim;
     rh_dimids[1] = lat_dim;
     rh_dimids[2] = lon_dim;
     status = nc_def_var (ncid, "rh", NC_DOUBLE, 3, rh_dimids, &rh_id);
     if (status != NC_NOERR) handle_error(status);
@endcode
@author Glenn Davis, Ed Hartnett, Dennis Heimbigner
 */
int
nc_def_var(int ncid, const char *name, nc_type xtype,
	   int ndims,  const int *dimidsp, int *varidp)
{
   NC* ncp;
   int stat = NC_NOERR;

   if ((stat = NC_check_id(ncid, &ncp)))
      return stat;
   TRACE(nc_def_var);
   return ncp->dispatch->def_var(ncid, name, xtype, ndims,
				 dimidsp, varidp);
}
开发者ID:wkliao,项目名称:netcdf-c,代码行数:90,代码来源:dvar.c

示例9: nc_def_compound

/**  \ingroup user_types
Get information about one of the fields of a compound type. 

\param ncid \ref ncid

\param xtype The typeid for this compound type, as returned by
nc_def_compound(), or nc_inq_var().

\param fieldid A zero-based index number specifying a field in the
compound type.

\param name Returned \ref object_name of the field. \ref
ignored_if_null.

\param offsetp A pointer which will get the offset of the field. \ref
ignored_if_null.

\param field_typeidp A pointer which will get the typeid of the
field. \ref ignored_if_null.

\param ndimsp A pointer which will get the number of dimensions of the
field. \ref ignored_if_null.

\param dim_sizesp A pointer which will get the dimension sizes of the
field. \ref ignored_if_null.

\returns ::NC_NOERR No error.
\returns ::NC_EBADID Bad \ref ncid.
\returns ::NC_EBADTYPE Bad type id.
\returns ::NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
\returns ::NC_EHDFERR An error was reported by the HDF5 layer.
 */
int
nc_inq_compound_field(int ncid, nc_type xtype, int fieldid, 
		      char *name, size_t *offsetp, 
		      nc_type *field_typeidp, int *ndimsp, 
		      int *dim_sizesp)
{
   NC* ncp;
   int stat = NC_check_id(ncid,&ncp);
   if(stat != NC_NOERR) return stat;
   return ncp->dispatch->inq_compound_field(ncid, xtype, fieldid,
					    name, offsetp, field_typeidp,
					    ndimsp, dim_sizesp);
}
开发者ID:BJangeofan,项目名称:netcdf-c,代码行数:45,代码来源:dcompound.c

示例10: NCCR_abort

int
NCCR_abort(int ncid)
{
    int ncstat;
    NC* nc;

    LOG((1, "nc_abort: ncid 0x%x", ncid));

    ncstat = NC_check_id(ncid, (NC**)&nc); 
    if(ncstat != NC_NOERR) return ncstat;

    /* Turn into close */
    return NCCR_close(ncid);
}
开发者ID:ArielleBassanelli,项目名称:gempak,代码行数:14,代码来源:nccrdispatch.c

示例11: NC3_inq_var

int
NC3_inq_var(int ncid,
	int varid,
	char *name,
	nc_type *typep,
	int *ndimsp,
	int *dimids,
	int *nattsp)
{
	int status;
	NC *nc;
	NC3_INFO* ncp;
	NC_var *varp;
	size_t ii;

	status = NC_check_id(ncid, &nc); 
	if(status != NC_NOERR)
		return status;
	ncp = NC3_DATA(nc);

	varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
	if(varp == NULL)
		return NC_ENOTVAR;

	if(name != NULL)
	{
		(void) strncpy(name, varp->name->cp, varp->name->nchars);
		name[varp->name->nchars] = 0;
	}

	if(typep != 0)
		*typep = varp->type;
	if(ndimsp != 0)
	{
		*ndimsp = (int) varp->ndims;
	}
	if(dimids != 0)
	{
		for(ii = 0; ii < varp->ndims; ii++)
		{
			dimids[ii] = varp->dimids[ii];
		}
	}
	if(nattsp != 0)
	{
		*nattsp = (int) varp->attrs.nelems;
	}

	return NC_NOERR;
}
开发者ID:SiggyF,项目名称:netcdf-c,代码行数:50,代码来源:var.c

示例12: NC3_def_var_fill

int
NC3_def_var_fill(int ncid,
	int varid,
	int no_fill,
	const void *fill_value)
{
	int status;
	NC *nc;
	NC3_INFO* ncp;
	NC_var *varp;

	status = NC_check_id(ncid, &nc);
	if(status != NC_NOERR)
		return status;
	ncp = NC3_DATA(nc);

	if(NC_readonly(ncp))
	{
		return NC_EPERM;
	}

	if(!NC_indef(ncp))
	{
		return NC_ENOTINDEFINE;
	}

	varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
	if(varp == NULL)
		return NC_ENOTVAR;

	if (no_fill)
		varp->no_fill = 1;
	else
		varp->no_fill = 0;

	/* Are we setting a fill value? */
	if (fill_value != NULL && !varp->no_fill) {

		/* If there's a _FillValue attribute, delete it. */
		status = NC3_del_att(ncid, varid, _FillValue);
		if (status != NC_NOERR && status != NC_ENOTATT)
			return status;

		/* Create/overwrite attribute _FillValue */
		status = NC3_put_att(ncid, varid, _FillValue, varp->type, 1, fill_value, varp->type);
		if (status != NC_NOERR) return status;
	}

	return NC_NOERR;
}
开发者ID:Kitware,项目名称:VTK,代码行数:50,代码来源:var.c

示例13: NC_get_varm

/** \ingroup variables
\internal
Called by externally visible nc_get_varm_xxx routines
 */
static int
NC_get_varm(int ncid, int varid, const size_t *start,
	    const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t* map,
	    void *value, nc_type memtype)
{
   NC* ncp;
   int stat = NC_check_id(ncid, &ncp);

   if(stat != NC_NOERR) return stat;
#ifdef USE_NETCDF4
   if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT;
#endif
   return ncp->dispatch->get_varm(ncid,varid,start,edges,stride,map,value,memtype);
}
开发者ID:bishtgautam,项目名称:sbetr,代码行数:18,代码来源:dvarget.c

示例14: nc_inq_natts

int 
nc_inq_natts(int ncid, int *nattsp)
{
	int status;
	NC *ncp;

	status = NC_check_id(ncid, &ncp); 
	if(status != NC_NOERR)
		return status;

	if(nattsp != NULL)
		*nattsp = (int) ncp->attrs.nelems;

	return NC_NOERR;
}
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:15,代码来源:nc.c

示例15: NC5_close

static int
NC5_close(int ncid)
{
    NC* nc;
    NC5_INFO* nc5;
    int status = NC_check_id(ncid, &nc);
    if(status != NC_NOERR) goto done;

    status = ncmpi_close(nc->int_ncid);

done:
    nc5 = NC5_DATA(nc);
    if(nc5 != NULL) free(nc5); /* reclaim allocated space */
    return status;
}
开发者ID:syntheticpp,项目名称:netcdf-c,代码行数:15,代码来源:nc5dispatch.c


注:本文中的NC_check_id函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。