|
NEP 4.3.0
NetCDF Expansion Pack
|
#include <netcdf.h>#include <nep.h>#include "nxcdf/nxcdf.h"#include <stdio.h>#include <stdlib.h>#include <string.h>Macros | |
| #define | FILENAME "fun_renames.nc" |
| #define | NDIM1 1 |
| #define | NDIM2 2 |
| #define | NX 4 |
| #define | NY 4 |
| #define | DIM_X_NAME "x" |
| #define | DIM_Y_NAME "y" |
| #define | OLD_X_NAME "old_x" |
| #define | V_NAME "v" |
| #define | TMP_NAME "tmp" |
| #define | DATA_NAME "data" |
| #define | ERRCODE 2 |
| #define | ERR(e) |
Functions | |
| int | main (int argc, char **argv) |
| #define DATA_NAME "data" |
| #define DIM_X_NAME "x" |
| #define DIM_Y_NAME "y" |
| #define ERR | ( | e | ) |
| #define ERRCODE 2 |
| #define FILENAME "fun_renames.nc" |
Fun with renames.
Some coordinate-variable and dimension renames fail in netcdf-c — netcdf-c's own nc_test4/tst_rename3 leaves them commented out as "should work but does not (yet)". nxCDF performs them correctly, and the results are fully netCDF-4 compatible.
This program creates a netCDF-4 file with the netcdf-c backend, opens it with nxCDF, performs a sequence of tricky renames (breaking a coordinate variable, reforming another variable into the coordinate variable, and exchanging two coordinate-variable names across unrelated dimensions), closes the file, and reopens it with plain netcdf-c to confirm everything reads correctly — with no phantom dimensions left behind.
| #define NDIM1 1 |
| #define NDIM2 2 |
| #define NX 4 |
| #define NY 4 |
| #define OLD_X_NAME "old_x" |
| #define TMP_NAME "tmp" |
| #define V_NAME "v" |
| int main | ( | int | argc, |
| char ** | argv ) |