|
NEP 1.5.1
NetCDF Extension Pack: compression extensions for NetCDF
|
Demonstrates NetCDF-4 hierarchical groups, nested groups, and dimension visibility. More...
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <netcdf.h>Macros | |
| #define | FILE_NAME "groups.nc" |
| #define | NX 3 |
| #define | NY 4 |
| #define | NZ 2 |
| #define | NDIMS_2D 2 |
| #define | NDIMS_3D 3 |
| #define | ERRCODE 2 |
| #define | ERR(e) {printf("Error: %s\n", nc_strerror(e)); exit(ERRCODE);} |
Functions | |
| int | main () |
Demonstrates NetCDF-4 hierarchical groups, nested groups, and dimension visibility.
This example showcases NetCDF-4's hierarchical group feature, which enables organizing datasets into logical groupings similar to directories in a filesystem. Groups provide namespace isolation for variables while allowing dimensions to be shared across the hierarchy through dimension visibility rules.
The program creates a three-level group hierarchy (root → SubGroup1, root → SubGroup2 → NestedGroup), demonstrates dimension visibility across group boundaries, and showcases all five new NetCDF-4 integer types (NC_UBYTE, NC_USHORT, NC_UINT, NC_INT64, NC_UINT64).
Learning Objectives:
Key Concepts:
NetCDF-4 Group Architecture:
Dimension Visibility Rules:
Use Cases for Groups:
Prerequisites:
Related Examples:
Compilation:
Usage:
Expected Output: Creates groups.nc in NetCDF-4/HDF5 format containing:
| #define ERR | ( | e | ) | {printf("Error: %s\n", nc_strerror(e)); exit(ERRCODE);} |
| #define ERRCODE 2 |
| #define FILE_NAME "groups.nc" |
| #define NDIMS_2D 2 |
| #define NDIMS_3D 3 |
| #define NX 3 |
| #define NY 4 |
| #define NZ 2 |
| int main | ( | ) |