ncdf4a13/libsrc4/tst_v2.c File Reference

#include <netcdf.h>
#include <nc_tests.h>

Include dependency graph for tst_v2.c:

Go to the source code of this file.

Defines

#define FILE_NAME   "tst_v2.nc"
#define NDIMS   2
#define DIM1_NAME   "rise_height"
#define DIM2_NAME   "saltiness"
#define DIM1_SIZE   3
#define DIM2_SIZE   5
#define VAR1_NAME   "wheat_loaf"
#define VAR2_NAME   "sourdough_wheat_loaf"
#define VAR3_NAME   "white_loaf"

Functions

int main (int argc, char **argv)

Variables

int ncopts


Define Documentation

#define DIM1_NAME   "rise_height"
 

Definition at line 14 of file tst_v2.c.

#define DIM1_SIZE   3
 

Definition at line 16 of file tst_v2.c.

Referenced by main().

#define DIM2_NAME   "saltiness"
 

Definition at line 15 of file tst_v2.c.

#define DIM2_SIZE   5
 

Definition at line 17 of file tst_v2.c.

Referenced by main().

#define FILE_NAME   "tst_v2.nc"
 

Definition at line 12 of file tst_v2.c.

#define NDIMS   2
 

Definition at line 13 of file tst_v2.c.

#define VAR1_NAME   "wheat_loaf"
 

Definition at line 18 of file tst_v2.c.

#define VAR2_NAME   "sourdough_wheat_loaf"
 

Definition at line 19 of file tst_v2.c.

#define VAR3_NAME   "white_loaf"
 

Definition at line 20 of file tst_v2.c.


Function Documentation

int main int  argc,
char **  argv
 

Definition at line 25 of file tst_v2.c.

References DIM1_NAME, DIM1_SIZE, DIM2_NAME, DIM2_SIZE, ERR, FILE_NAME, FINAL_RESULTS, NC_CLOBBER, NC_DOUBLE, NC_INT, NC_SHORT, NC_VERBOSE, NC_WRITE, ncclose(), nccreate(), ncdimdef(), ncid, ncopen(), ncopts, ncredef(), ncvardef(), NDIMS, SUMMARIZE_ERR, VAR1_NAME, VAR2_NAME, and VAR3_NAME.

00026 {
00027    /*nc_set_log_level(3);*/
00028 
00029    printf("\n*** Testing netcdf-4 v2 API functions.\n");
00030    printf("*** testing simple opens and creates...");
00031    {
00032       int ncid, varid, dimids[2];
00033 
00034       /* Turn off the crashing whenever there is a problem. */
00035       ncopts = NC_VERBOSE;
00036 
00037       /* Create an empty file. */
00038       if ((ncid = nccreate(FILE_NAME, NC_CLOBBER)) == -1) ERR;
00039       if (ncclose(ncid) == -1) ERR;
00040 
00041       /* Open the file, go into redef, and add some dims and vars. */
00042       if ((ncid = ncopen(FILE_NAME, NC_WRITE)) == -1) ERR;
00043       if (ncredef(ncid) == -1) ERR;
00044       if ((dimids[0] = ncdimdef(ncid, DIM1_NAME, DIM1_SIZE)) == -1) ERR;
00045       if ((dimids[1] = ncdimdef(ncid, DIM2_NAME, DIM2_SIZE)) == -1) ERR;
00046       if ((varid = ncvardef(ncid, VAR1_NAME, NC_DOUBLE, NDIMS, dimids)) == -1) ERR;
00047       if ((varid = ncvardef(ncid, VAR2_NAME, NC_INT, NDIMS, dimids)) == -1) ERR;
00048       if ((varid = ncvardef(ncid, VAR3_NAME, NC_SHORT, NDIMS, dimids)) == -1) ERR;
00049       if (ncclose(ncid) == -1) ERR;
00050    }
00051 
00052    SUMMARIZE_ERR;
00053 
00054    FINAL_RESULTS;
00055 }


Variable Documentation

int ncopts
 

Definition at line 999 of file netcdf.h.


Generated on Thu Mar 16 18:11:54 2006 for nco by  doxygen 1.4.4