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

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

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

Go to the source code of this file.

Macros

#define ERR(e)
 
#define FILE_NAME   "sfc_pres_temp.nc"
 
#define LAT_NAME   "latitude"
 
#define LAT_UNITS   "degrees_north"
 
#define LON_NAME   "longitude"
 
#define LON_UNITS   "degrees_east"
 
#define MAX_ATT_LEN   80
 
#define NDIMS   2
 
#define NLAT   6
 
#define NLON   12
 
#define PRES_NAME   "pressure"
 
#define PRES_UNITS   "hPa"
 
#define SAMPLE_PRESSURE   900
 
#define SAMPLE_TEMP   9.0
 
#define START_LAT   25.0
 
#define START_LON   -125.0
 
#define TEMP_NAME   "temperature"
 
#define TEMP_UNITS   "celsius"
 
#define UNITS   "units"
 

Functions

int main ()
 

Detailed Description

A simple example of reading a netCDF file.

This is an example which reads some surface pressure and temperatures. The data file read by this program is produced by the companion program sfc_pres_temp_wr.c. It is intended to illustrate the use of the netCDF C API.

Author
Ed Hartnett

Definition in file sfc_pres_temp_rd.c.

Macro Definition Documentation

◆ 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 48 of file sfc_pres_temp_rd.c.

◆ FILE_NAME

#define FILE_NAME   "sfc_pres_temp.nc"

Definition at line 20 of file sfc_pres_temp_rd.c.

◆ LAT_NAME

#define LAT_NAME   "latitude"

Definition at line 27 of file sfc_pres_temp_rd.c.

◆ LAT_UNITS

#define LAT_UNITS   "degrees_north"

Definition at line 42 of file sfc_pres_temp_rd.c.

◆ LON_NAME

#define LON_NAME   "longitude"

Definition at line 28 of file sfc_pres_temp_rd.c.

◆ LON_UNITS

#define LON_UNITS   "degrees_east"

Definition at line 43 of file sfc_pres_temp_rd.c.

◆ MAX_ATT_LEN

#define MAX_ATT_LEN   80

Definition at line 44 of file sfc_pres_temp_rd.c.

◆ NDIMS

#define NDIMS   2

Definition at line 23 of file sfc_pres_temp_rd.c.

◆ NLAT

#define NLAT   6

Definition at line 24 of file sfc_pres_temp_rd.c.

◆ NLON

#define NLON   12

Definition at line 25 of file sfc_pres_temp_rd.c.

◆ PRES_NAME

#define PRES_NAME   "pressure"

Definition at line 29 of file sfc_pres_temp_rd.c.

◆ PRES_UNITS

#define PRES_UNITS   "hPa"

Definition at line 40 of file sfc_pres_temp_rd.c.

◆ SAMPLE_PRESSURE

#define SAMPLE_PRESSURE   900

Definition at line 33 of file sfc_pres_temp_rd.c.

◆ SAMPLE_TEMP

#define SAMPLE_TEMP   9.0

Definition at line 34 of file sfc_pres_temp_rd.c.

◆ START_LAT

#define START_LAT   25.0

Definition at line 35 of file sfc_pres_temp_rd.c.

◆ START_LON

#define START_LON   -125.0

Definition at line 36 of file sfc_pres_temp_rd.c.

◆ TEMP_NAME

#define TEMP_NAME   "temperature"

Definition at line 30 of file sfc_pres_temp_rd.c.

◆ TEMP_UNITS

#define TEMP_UNITS   "celsius"

Definition at line 41 of file sfc_pres_temp_rd.c.

◆ UNITS

#define UNITS   "units"

Definition at line 39 of file sfc_pres_temp_rd.c.

Function Documentation

◆ main()

int main ( )

Definition at line 51 of file sfc_pres_temp_rd.c.