|
NEP 1.5.1
NetCDF Extension Pack: compression extensions for NetCDF
|
Demonstrates coordinate variables and CF convention metadata. More...
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <netcdf.h>Macros | |
| #define | FILE_NAME "coord_vars.nc" |
| #define | NLAT 4 |
| #define | NLON 5 |
| #define | ERRCODE 2 |
| #define | ERR(e) {printf("Error: %s\n", nc_strerror(e)); exit(ERRCODE);} |
Functions | |
| int | main () |
Demonstrates coordinate variables and CF convention metadata.
This example introduces the concept of coordinate variables - special 1D variables that share the same name as their dimension and provide values along that axis. Coordinate variables are essential for geospatial data, defining latitude, longitude, time, or other dimensional coordinates.
The program creates a 2D temperature field (4x5 grid) with latitude and longitude coordinate variables following Climate and Forecast (CF) conventions. CF conventions are the standard metadata conventions for climate and forecast data.
Learning Objectives:
Key Concepts:
CF Convention Attributes Used:
units: Physical units (degrees_north, degrees_east, K)standard_name: CF standard name vocabulary (latitude, longitude, air_temperature)long_name: Human-readable descriptive nameaxis: Coordinate axis identifier (X, Y, Z, T)_FillValue: Value representing missing dataPrerequisites:
Related Examples:
Compilation:
Usage:
Expected Output: Creates coord_vars.nc containing:
| #define ERR | ( | e | ) | {printf("Error: %s\n", nc_strerror(e)); exit(ERRCODE);} |
| #define ERRCODE 2 |
| #define FILE_NAME "coord_vars.nc" |
| #define NLAT 4 |
| #define NLON 5 |
| int main | ( | ) |