|
NEP 1.5.1
NetCDF Extension Pack: compression extensions for NetCDF
|
Demonstrates multiple unlimited dimensions (NetCDF-4 feature) More...
#include <stdio.h>#include <stdlib.h>#include <math.h>#include <netcdf.h>Macros | |
| #define | FILE_NAME "multi_unlimited.nc" |
| #define | INITIAL_STATIONS 3 |
| #define | INITIAL_TIMES 5 |
| #define | ADDED_STATIONS 2 |
| #define | ADDED_TIMES 3 |
| #define | NDIMS 2 |
| #define | ERRCODE 2 |
| #define | ERR(e) {printf("Error: %s\n", nc_strerror(e)); exit(ERRCODE);} |
Functions | |
| int | main () |
Demonstrates multiple unlimited dimensions (NetCDF-4 feature)
This example showcases one of NetCDF-4's key enhancements over classic NetCDF: the ability to have multiple unlimited dimensions. While classic NetCDF allows only one unlimited dimension, NetCDF-4 supports any number, enabling more flexible data structures for complex datasets.
The program creates a file with two unlimited dimensions (station and time), writes initial data, then demonstrates appending data along both dimensions. This pattern is common in observational data where both the number of stations and timesteps can grow over time.
Learning Objectives:
Key Concepts:
Use Cases for Multiple Unlimited Dimensions:
Design Considerations:
Prerequisites:
Related Examples:
Compilation:
Usage:
Expected Output: Creates multi_unlimited.nc containing:
| #define ADDED_STATIONS 2 |
| #define ADDED_TIMES 3 |
| #define ERR | ( | e | ) | {printf("Error: %s\n", nc_strerror(e)); exit(ERRCODE);} |
| #define ERRCODE 2 |
| #define FILE_NAME "multi_unlimited.nc" |
| #define INITIAL_STATIONS 3 |
| #define INITIAL_TIMES 5 |
| #define NDIMS 2 |
| int main | ( | ) |