• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ NC_check_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: nc_inq_unlimdim

int 
nc_inq_unlimdim(int ncid, int *xtendimp)
{
	int status;
	NC *ncp;

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

	if(xtendimp != NULL)
		*xtendimp = find_NC_Udim(&ncp->dims, NULL);

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


示例17: nc_def_var_fill

/**
 * @ingroup variables
 *
 * Set the fill value for a variable.
 *
 * @note For netCDF classic, 64-bit offset, and CDF5 formats, it is
 * allowed (but not good practice) to set the fill value after data
 * have been written to the variable. In this case, unless the
 * variable has been completely specified (without gaps in the data),
 * any existing filled values will not be recognized as fill values by
 * applications reading the data. Best practice is to set the fill
 * value after the variable has been defined, but before any data have
 * been written to that varibale. In NetCDF-4 files, this is enforced
 * by the HDF5 library. For netCDF-4 files, an error is returned if
 * the user attempts to set the fill value after writing data to the
 * variable.

 * @param ncid NetCDF ID, from a previous call to nc_open or
 * nc_create.
 * @param varid Variable ID.
 * @param no_fill Set to NC_NOFILL to turn off fill mode for this
 * variable. Set to NC_FILL (the default) to turn on fill mode for the
 * variable.
 * @param fill_value the fill value to be used for this variable. Must
 * be the same type as the variable. This must point to enough free
 * memory to hold one element of the data type of the variable. (For
 * example, an NC_INT will require 4 bytes for it's fill value, which
 * is also an NC_INT.)
 *
 * @returns ::NC_NOERR No error.
 * @returns ::NC_EBADID Bad ID.
 * @returns ::NC_ENOTINDEFINE Not in define mode.  This is returned
 * for netCDF classic, 64-bit offset, or 64-bit data files, or for
 * netCDF-4 files, when they were created with NC_STRICT_NC3 flag. See
 * @ref nc_create.
 * @returns ::NC_EPERM Attempt to create object in read-only file.
 * @returns ::NC_ELATEDEF (NetCDF-4 only). Returned when user attempts
 * to set fill value after data are written.
 * @returns ::NC_EGLOBAL Attempt to set fill value on NC_GLOBAL.
 *
 * @section nc_def_var_fill_example Example
 *
 * In this example from libsrc4/tst_vars.c, a variable is defined, and
 * the fill mode turned off. Then nc_inq_fill() is used to check that
 * the setting is correct. Then some data are written to the
 * variable. Since the data that are written do not cover the full
 * extent of the variable, the missing values will just be random. If
 * fill value mode was turned on, the missing values would get the
 * fill value.
 *
 @code
#define DIM7_LEN 2
#define DIM7_NAME "dim_7_from_Indiana"
#define VAR7_NAME "var_7_from_Idaho"
#define NDIMS 1
      int dimids[NDIMS];
      size_t index[NDIMS];
      int varid;
      int no_fill;
      unsigned short ushort_data = 42, ushort_data_in, fill_value_in;

      if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
      if (nc_def_dim(ncid, DIM7_NAME, DIM7_LEN, &dimids[0])) ERR;
      if (nc_def_var(ncid, VAR7_NAME, NC_USHORT, NDIMS, dimids,
		     &varid)) ERR;
      if (nc_def_var_fill(ncid, varid, 1, NULL)) ERR;

      if (nc_inq_var_fill(ncid, varid, &no_fill, &fill_value_in)) ERR;
      if (!no_fill) ERR;

      index[0] = 1;
      if (nc_put_var1_ushort(ncid, varid, index, &ushort_data)) ERR;

      index[0] = 0;
      if (nc_get_var1_ushort(ncid, varid, index, &ushort_data_in)) ERR;

      if (nc_close(ncid)) ERR;
 @endcode
 * @author Glenn Davis, Ed Hartnett, Dennis Heimbigner
*/
int
nc_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value)
{
    NC* ncp;
    int stat = NC_check_id(ncid,&ncp);
    if(stat != NC_NOERR) return stat;

    /* Dennis Heimbigner: Using NC_GLOBAL is illegal, as this API has no
     * provision for specifying the type of the fillvalue, it must of necessity
     * be using the type of the variable to interpret the bytes of the
     * fill_value argument.
     */
    if (varid == NC_GLOBAL) return NC_EGLOBAL;

    return ncp->dispatch->def_var_fill(ncid,varid,no_fill,fill_value);
}
开发者ID:wkliao,项目名称:netcdf-c,代码行数:96,代码来源:dvar.c


示例18: nc_enddef

int
nc_enddef(int ncid)
{
	int status;
	NC *ncp;

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

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

	/* return(NC_endef(ncp, 0, 4096, 0, 4096)); */
	return (NC_endef(ncp, 0, 1, 0, 1));
}
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:16,代码来源:nc.c


示例19: nc_inq_format

int
nc_inq_format(int ncid, int *formatp)
{
	int status;
	NC *ncp;

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

	/* only need to check for netCDF-3 variants, since this is never called for netCDF-4 
	   files */
	*formatp = fIsSet(ncp->flags, NC_64BIT_OFFSET) ? NC_FORMAT_64BIT 
	    : NC_FORMAT_CLASSIC; 
	return NC_NOERR;
}
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:16,代码来源:nc.c


示例20: nc_get_att

/*!
\ingroup attributes
Get an attribute of any type.

The nc_get_att() functions works for any type of attribute, and must
be used to get attributes of user-defined type. We recommend that they
type safe versions of this function be used where possible.

\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 varid Variable ID of the attribute's variable, or ::NC_GLOBAL
for a global attribute.

\param name Attribute \ref object_name.

\param value Pointer to location for returned attribute value(s). All
elements of the vector of attribute values are returned, so you must
allocate enough space to hold them. Before using the value as a C
string, make sure it is null-terminated. Call nc_inq_attlen() first to
find out the length of the attribute.

\note See documentation for nc_get_att_string() regarding a special case where memory must be explicitly released.

*/
int
nc_get_att(int ncid, int varid, const char *name, void *value)
{
   NC* ncp;
   int stat = NC_NOERR;
   nc_type xtype;

   if ((stat = NC_check_id(ncid, &ncp)))
      return stat;

   /* Need to get the type */
   if ((stat = nc_inq_atttype(ncid, varid, name, &xtype)))
      return stat;

   return ncp->dispatch->get_att(ncid, varid, name, value, xtype);
}
开发者ID:bishtgautam,项目名称:sbetr,代码行数:42,代码来源:dattget.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NCols函数代码示例发布时间:2022-05-30
下一篇:
C++ NC_函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap