NetCDF 4.9.3
Loading...
Searching...
No Matches
sfc_pres_temp_wr.c File Reference

A simple example of writing a netCDF file. More...

#include <stdio.h>
#include <string.h>
#include <netcdf.h>
Include dependency graph for sfc_pres_temp_wr.c:

Go to the source code of this file.

Macros

#define DEGREES_EAST   "degrees_east"
 
#define DEGREES_NORTH   "degrees_north"
 
#define ERR(e)
 
#define FILE_NAME   "sfc_pres_temp.nc"
 
#define LAT_NAME   "latitude"
 
#define LON_NAME   "longitude"
 
#define NDIMS   2
 
#define NLAT   6
 
#define NLON   12
 
#define PRES_NAME   "pressure"
 
#define SAMPLE_PRESSURE   900.0f
 
#define SAMPLE_TEMP   9.0f
 
#define START_LAT   25.0f
 
#define START_LON   -125.0f
 
#define TEMP_NAME   "temperature"
 
#define UNITS   "units"
 

Functions

int main ()
 

Detailed Description

A simple example of writing a netCDF file.

This example writes some surface pressure and temperatures. It is intended to illustrate the use of the netCDF C API. The companion program sfc_pres_temp_rd.c shows how to read the netCDF data file created by this program.

Author
Ed Hartnett

Definition in file sfc_pres_temp_wr.c.

Macro Definition Documentation

◆ DEGREES_EAST

#define DEGREES_EAST   "degrees_east"

Definition at line 34 of file sfc_pres_temp_wr.c.

◆ DEGREES_NORTH

#define DEGREES_NORTH   "degrees_north"

Definition at line 35 of file sfc_pres_temp_wr.c.

◆ ERR

#define ERR ( e)
Value:
{printf("Error: %s\n", nc_strerror(e)); return 2;}
EXTERNL const char * nc_strerror(int ncerr)
Given an error number, return an error message.
Definition derror.c:87

Definition at line 45 of file sfc_pres_temp_wr.c.

◆ FILE_NAME

#define FILE_NAME   "sfc_pres_temp.nc"

Definition at line 20 of file sfc_pres_temp_wr.c.

◆ LAT_NAME

#define LAT_NAME   "latitude"

Definition at line 27 of file sfc_pres_temp_wr.c.

◆ LON_NAME

#define LON_NAME   "longitude"

Definition at line 28 of file sfc_pres_temp_wr.c.

◆ NDIMS

#define NDIMS   2

Definition at line 24 of file sfc_pres_temp_wr.c.

◆ NLAT

#define NLAT   6

Definition at line 25 of file sfc_pres_temp_wr.c.

◆ NLON

#define NLON   12

Definition at line 26 of file sfc_pres_temp_wr.c.

◆ PRES_NAME

#define PRES_NAME   "pressure"

Definition at line 31 of file sfc_pres_temp_wr.c.

◆ SAMPLE_PRESSURE

#define SAMPLE_PRESSURE   900.0f

Definition at line 38 of file sfc_pres_temp_wr.c.

◆ SAMPLE_TEMP

#define SAMPLE_TEMP   9.0f

Definition at line 39 of file sfc_pres_temp_wr.c.

◆ START_LAT

#define START_LAT   25.0f

Definition at line 40 of file sfc_pres_temp_wr.c.

◆ START_LON

#define START_LON   -125.0f

Definition at line 41 of file sfc_pres_temp_wr.c.

◆ TEMP_NAME

#define TEMP_NAME   "temperature"

Definition at line 32 of file sfc_pres_temp_wr.c.

◆ UNITS

#define UNITS   "units"

Definition at line 33 of file sfc_pres_temp_wr.c.

Function Documentation

◆ main()

int main ( )

Definition at line 48 of file sfc_pres_temp_wr.c.