|
NEP 4.3.0
NetCDF Expansion Pack
|
Store references to remote datasets and follow them. More...
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <netcdf.h>#include "nep.h"#include "nxcdf/nxcdf.h"#include "nep_meta.h"Macros | |
| #define | FILE_NAME "remote_refs.nc" |
| #define | ATT_URL "remote_url" |
| #define | ATT_PATH "remote_path" |
| #define | CHECK(expr) |
Functions | |
| int | main (int argc, char **argv) |
Store references to remote datasets and follow them.
This program demonstrates nxCDF remote references. Unlike file references (see external_refs.c), a remote reference is not an HDF5 token: it is a stored convention of two strings — a URL and an object path — kept here as NC_STRING attribute values. The program writes a (URL, path) pair to a nxCDF file, reads it back after reopening, then calls nc_ref_open_remote() to open the remote dataset through nc_open() — DAP2, DAP4 or NCZarr dispatch, whatever the installed NetCDF-C resolves — and resolve the path to a real NetCDF variable, group or attribute in one call.
Usage:
With no arguments the program only exercises the storage convention and reports that no remote URL was given. Pass a resolvable URL (for example a public DAP server dataset) and an object path like /sst or /grp/var#units to resolve a real remote object.
Learning Objectives:
| #define ATT_PATH "remote_path" |
| #define ATT_URL "remote_url" |
| #define CHECK | ( | expr | ) |
| #define FILE_NAME "remote_refs.nc" |
| int main | ( | int | argc, |
| char ** | argv ) |