|
NEP 4.3.0
NetCDF Expansion Pack
|
Store references to variables in other files and follow them. More...
#include <netcdf.h>#include <nep.h>#include "nxcdf/nxcdf.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>Macros | |
| #define | NVALS 4 |
| #define | NREFS 2 |
| #define | TARGET_A "external_ref_target_a.h5" |
| #define | TARGET_B "external_ref_target_b.h5" |
| #define | INDEX_FILE "external_refs.h5" |
| #define | ERRCODE 2 |
| #define | ERR(e) |
Functions | |
| static void | make_target (const char *name, const char *var_name, const char *units, const int *data) |
| int | main (void) |
Store references to variables in other files and follow them.
This program demonstrates nxCDF external references. It creates two target files, each holding one variable with a little sample data and an attribute, then creates a third file whose refs variable stores one NC_STD_REF token per target variable. After closing everything, it reopens the third file, reads the tokens back, opens each target with nc_ref_open_target(), and resolves the references with nc_deref_object() to read the data and metadata straight through the NetCDF API.
Usage:
The nxCDF backend is loaded through the .ncrc UDF9 autoload mechanism, so NCRCENV_RC and NETCDF_RC must name the NEP build directory that contains the generated .ncrc. The program writes and reads three files in the current directory: external_ref_target_a.h5, external_ref_target_b.h5 and external_refs.h5.
Learning Objectives:
Key Concepts:
Key API functions:
Related Examples:
| #define ERR | ( | e | ) |
| #define ERRCODE 2 |
| #define INDEX_FILE "external_refs.h5" |
File holding the reference tokens.
| #define NREFS 2 |
Number of reference tokens stored in the index file.
| #define NVALS 4 |
Number of sample values in each target variable.
| #define TARGET_A "external_ref_target_a.h5" |
First target file.
| #define TARGET_B "external_ref_target_b.h5" |
Second target file.
| int main | ( | void | ) |
|
static |