NetCDF  4.9.2
dv2i.c File Reference

The V2 API Functions. More...

#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include "netcdf.h"
#include <math.h>
Include dependency graph for dv2i.c:

Go to the source code of this file.

Macros

#define A_DECL(name, type, ndims, rhs)    const type *const name = ((const type *)(rhs))
 
#define A_FREE(name)
 Free a variable. More...
 
#define A_INIT(lhs, type, ndims, rhs)
 Init a variable. More...
 
#define NDIMS_DECL
 NDIMS declaration. More...
 

Typedefs

typedef signed char schar
 Signed character type. More...
 

Functions

static int dimsizes (int ncid, int varid, size_t *sizes)
 Retrieves the dimension sizes of a variable with a specified variable id in an open netCDF file. More...
 
void nc_advise (const char *routine_name, int err, const char *fmt,...)
 Show an error message and exit (based on ncopts). More...
 
int nc_get_rec (int ncid, size_t recnum, void **datap)
 Read one record's worth of data, except don't read from variables for which the address of the data to be read is null. More...
 
int nc_inq_rec (int ncid, size_t *nrecvarsp, int *recvarids, size_t *recsizes)
 Retrieves the number of record variables, the record variable ids, and the record size of each record variable. More...
 
int nc_put_rec (int ncid, size_t recnum, void *const *datap)
 Write one record's worth of data, except don't write to variables for which the address of the data to be written is NULL. More...
 
int ncabort (int ncid)
 Abort defining a file. More...
 
int ncattcopy (int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out)
 Copy an attribute. More...
 
int ncattdel (int ncid, int varid, const char *name)
 Delete an attribute. More...
 
int ncattget (int ncid, int varid, const char *name, void *value)
 Read an attribute. More...
 
int ncattinq (int ncid, int varid, const char *name, nc_type *datatype, int *len)
 Learn about an attribute. More...
 
int ncattname (int ncid, int varid, int attnum, char *name)
 Learn attribute name from its number. More...
 
int ncattput (int ncid, int varid, const char *name, nc_type datatype, int len, const void *value)
 Write an attribute. More...
 
int ncattrename (int ncid, int varid, const char *name, const char *newname)
 Rename an attribute. More...
 
int ncclose (int ncid)
 Close a file. More...
 
int nccreate (const char *path, int cmode)
 Create a netCDF file. More...
 
int ncdimdef (int ncid, const char *name, long length)
 Define a dimension. More...
 
int ncdimid (int ncid, const char *name)
 Find dimension ID from name. More...
 
int ncdiminq (int ncid, int dimid, char *name, long *length)
 Learn about a dimension. More...
 
int ncdimrename (int ncid, int dimid, const char *name)
 Rename a dimension. More...
 
int ncendef (int ncid)
 End define mode for file. More...
 
int ncinquire (int ncid, int *ndims, int *nvars, int *natts, int *recdim)
 Learn about a file. More...
 
int ncopen (const char *path, int mode)
 Open a netCDF file. More...
 
int ncrecget (int ncid, long recnum, void **datap)
 Read one record's worth of data, except don't read from variables for which the address of the data to be read is null. More...
 
int ncrecinq (int ncid, int *nrecvars, int *recvarids, long *recsizes)
 Learn record variables and the lengths of the record dimension. More...
 
int ncrecput (int ncid, long recnum, void *const *datap)
 Write one record's worth of data, except don't write to variables for which the address of the data to be written is NULL. More...
 
static int ncrecsize (int ncid, int varid, size_t *recsizep)
 Computes record size (in bytes) of the record variable with a specified variable id. More...
 
int ncredef (int ncid)
 Put file in define mode. More...
 
int ncsetfill (int ncid, int fillmode)
 Set the fill mode. More...
 
int ncsync (int ncid)
 Sync a file. More...
 
int ncvardef (int ncid, const char *name, nc_type datatype, int ndims, const int *dim)
 Define a variable. More...
 
int ncvarget (int ncid, int varid, const long *start, const long *count, void *value)
 Read some data. More...
 
int ncvarget1 (int ncid, int varid, const long *index, void *value)
 Read 1 data value. More...
 
int ncvargetg (int ncid, int varid, const long *start, const long *count, const long *stride, const long *map, void *value)
 Read mapped data. More...
 
int ncvargets (int ncid, int varid, const long *start, const long *count, const long *stride, void *value)
 Read strided data. More...
 
int ncvarid (int ncid, const char *name)
 Learn a variable ID from the name. More...
 
int ncvarinq (int ncid, int varid, char *name, nc_type *datatype, int *ndims, int *dim, int *natts)
 Learn about a variable. More...
 
int ncvarput (int ncid, int varid, const long *start, const long *count, const void *value)
 Write some data. More...
 
int ncvarput1 (int ncid, int varid, const long *index, const void *value)
 Write 1 data value. More...
 
int ncvarputg (int ncid, int varid, const long *start, const long *count, const long *stride, const long *map, const void *value)
 Write mapped data. More...
 
int ncvarputs (int ncid, int varid, const long *start, const long *count, const long *stride, const void *value)
 Write strided data. More...
 
int ncvarrename (int ncid, int varid, const char *name)
 Rename a variable. More...
 
static int numrecvars (int ncid, int *nrecvarsp, int *recvarids)
 Computes number of record variables in an open netCDF file, and an array of the record variable ids, if the array parameter is non-null. More...
 

Variables

MSC_EXTRA int ncerr = NC_NOERR
 V2 API error code. More...
 
MSC_EXTRA int ncopts = (NC_FATAL | NC_VERBOSE)
 The subroutines in error.c emit no messages unless NC_VERBOSE bit is on. More...
 

Detailed Description

The V2 API Functions.

Copyright 2018, University Corporation for Atmospheric Research See COPYRIGHT file for copying and redistribution conditions.

Definition in file dv2i.c.

Macro Definition Documentation

◆ A_FREE

#define A_FREE (   name)

Free a variable.

Definition at line 51 of file dv2i.c.

◆ A_INIT

#define A_INIT (   lhs,
  type,
  ndims,
  rhs 
)

Init a variable.

Definition at line 53 of file dv2i.c.

◆ NDIMS_DECL

#define NDIMS_DECL

NDIMS declaration.

Definition at line 45 of file dv2i.c.

Typedef Documentation

◆ schar

typedef signed char schar

Signed character type.

Definition at line 121 of file dv2i.c.

Function Documentation

◆ dimsizes()

static int dimsizes ( int  ncid,
int  varid,
size_t *  sizes 
)
static

Retrieves the dimension sizes of a variable with a specified variable id in an open netCDF file.


Parameters
ncidFile ID.
varidVariable ID.
sizesPointer that gets sizes.
Returns
NC_NOERR No error.
-1 on error.
Author
Russ Rew

Definition at line 240 of file dv2i.c.

◆ ncrecsize()

static int ncrecsize ( int  ncid,
int  varid,
size_t *  recsizep 
)
static

Computes record size (in bytes) of the record variable with a specified variable id.

Returns size as 0 if not a record variable.

Parameters
ncidFile ID.
varidVariable ID.
recsizepPointer that gets record size.
Returns
size, or 0 if not a record variable

Definition at line 188 of file dv2i.c.

◆ numrecvars()

static int numrecvars ( int  ncid,
int *  nrecvarsp,
int *  recvarids 
)
static

Computes number of record variables in an open netCDF file, and an array of the record variable ids, if the array parameter is non-null.

Parameters
ncidFile ID.
nrecvarspPointer that gets number of record variables.
recvaridsPointer that gets array of record variable IDs.
Returns
NC_NOERR No error.
-1 on error.
Author
Russ Rew

Definition at line 136 of file dv2i.c.

Variable Documentation

◆ ncerr

MSC_EXTRA int ncerr = NC_NOERR

V2 API error code.

Definition at line 37 of file dv2i.c.

◆ ncopts

MSC_EXTRA int ncopts = (NC_FATAL | NC_VERBOSE)

The subroutines in error.c emit no messages unless NC_VERBOSE bit is on.

They call exit() when NC_FATAL bit is on.

Definition at line 35 of file dv2i.c.