Loading...
Searching...
No Matches
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)
#define | A_FREE(name)
| Free a variable.
#define | A_INIT(lhs, type, ndims, rhs)
| Init a variable.
#define | NDIMS_DECL
| NDIMS declaration.

## Typedefs

typedef signed char | schar
| Signed character type.

## 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.
void | nc_advise (const char *routine_name, int err, const char *fmt,...)
| Show an error message and exit (based on ncopts).
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.
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.
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.
int | ncabort (int ncid)
| Abort defining a file.
int | ncattcopy (int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out)
| Copy an attribute.
int | ncattdel (int ncid, int varid, const char *name)
| Delete an attribute.
int | ncattget (int ncid, int varid, const char *name, void *value)
| Read an attribute.
int | ncattinq (int ncid, int varid, const char *name, nc_type *datatype, int *len)
| Learn about an attribute.
int | ncattname (int ncid, int varid, int attnum, char *name)
| Learn attribute name from its number.
int | ncattput (int ncid, int varid, const char *name, nc_type datatype, int len, const void *value)
| Write an attribute.
int | ncattrename (int ncid, int varid, const char *name, const char *newname)
| Rename an attribute.
int | ncclose (int ncid)
| Close a file.
int | nccreate (const char *path, int cmode)
| Create a netCDF file.
int | ncdimdef (int ncid, const char *name, long length)
| Define a dimension.
int | ncdimid (int ncid, const char *name)
| Find dimension ID from name.
int | ncdiminq (int ncid, int dimid, char *name, long *length)
| Learn about a dimension.
int | ncdimrename (int ncid, int dimid, const char *name)
| Rename a dimension.
int | ncendef (int ncid)
| End define mode for file.
int | ncinquire (int ncid, int *ndims, int *nvars, int *natts, int *recdim)
| Learn about a file.
int | ncopen (const char *path, int mode)
| Open a netCDF file.
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.
int | ncrecinq (int ncid, int *nrecvars, int *recvarids, long *recsizes)
| Learn record variables and the lengths of the record dimension.
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.
static int | ncrecsize (int ncid, int varid, size_t *recsizep)
| Computes record size (in bytes) of the record variable with a specified variable id.
int | ncredef (int ncid)
| Put file in define mode.
int | ncsetfill (int ncid, int fillmode)
| Set the fill mode.
int | ncsync (int ncid)
| Sync a file.
int | ncvardef (int ncid, const char *name, nc_type datatype, int ndims, const int *dim)
| Define a variable.
int | ncvarget (int ncid, int varid, const long *start, const long *count, void *value)
| Read some data.
int | ncvarget1 (int ncid, int varid, const long *index, void *value)
| Read 1 data value.
int | ncvargetg (int ncid, int varid, const long *start, const long *count, const long *stride, const long *map, void *value)
| Read mapped data.
int | ncvargets (int ncid, int varid, const long *start, const long *count, const long *stride, void *value)
| Read strided data.
int | ncvarid (int ncid, const char *name)
| Learn a variable ID from the name.
int | ncvarinq (int ncid, int varid, char *name, nc_type *datatype, int *ndims, int *dim, int *natts)
| Learn about a variable.
int | ncvarput (int ncid, int varid, const long *start, const long *count, const void *value)
| Write some data.
int | ncvarput1 (int ncid, int varid, const long *index, const void *value)
| Write 1 data value.
int | ncvarputg (int ncid, int varid, const long *start, const long *count, const long *stride, const long *map, const void *value)
| Write mapped data.
int | ncvarputs (int ncid, int varid, const long *start, const long *count, const long *stride, const void *value)
| Write strided data.
int | ncvarrename (int ncid, int varid, const char *name)
| Rename a variable.
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.

## Variables

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

## 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_DECL

#define A_DECL | ( |  | name,
|  |  | type,
|  |  | ndims,
|  |  | rhs )

Value:
const type *const name = ((const type *)(rhs))

Definition at line 48 of file dv2i.c.

## A_FREE

#define A_FREE | ( |  | name | ) |

Value:

Free a variable.

Definition at line 51 of file dv2i.c.

## A_INIT

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

Value:

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()

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

  ncid | File ID.
  varid | Variable ID.
  sizes | Pointer that gets sizes.

Returns
  NC_NOERR No error.
  -1 on error.

Author
  Russ Rew

Definition at line 240 of file dv2i.c.

## ncrecsize()

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

  ncid | File ID.
  varid | Variable ID.
  recsizep | Pointer that gets record size.

Returns
  size, or 0 if not a record variable

Definition at line 188 of file dv2i.c.

## numrecvars()

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

  ncid | File ID.
  nrecvarsp | Pointer that gets number of record variables.
  recvarids | Pointer 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.