|
NEP 1.7.0
NetCDF Extension Pack: compression extensions for NetCDF
|
Minimal introduction to NetCDF - the simplest starting point for new users. More...
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <netcdf.h>Macros | |
| #define | FILE_NAME "quickstart.nc" |
| #define | ERRCODE 2 |
| #define | ERR(e) {printf("Error: %s\n", nc_strerror(e)); return ERRCODE;} |
Functions | |
| int | main () |
Minimal introduction to NetCDF - the simplest starting point for new users.
This is the most basic NetCDF example, demonstrating the essential operations:
The program creates a tiny 2D array (2x3) with 6 integer values, adds descriptive attributes, writes it to a file, then reopens the file to verify everything was stored correctly. This demonstrates the complete NetCDF workflow in under 150 lines.
Learning Objectives:
Key Concepts:
Prerequisites: Basic C programming knowledge
Related Examples:
Compilation:
Usage:
Expected Output: Creates quickstart.nc containing:
| #define ERR | ( | e | ) | {printf("Error: %s\n", nc_strerror(e)); return ERRCODE;} |
| #define ERRCODE 2 |
| #define FILE_NAME "quickstart.nc" |
| int main | ( | ) |