NEP 4.3.0
NetCDF Expansion Pack
Loading...
Searching...
No Matches
fun_renames.c File Reference
#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)

Macro Definition Documentation

◆ DATA_NAME

#define DATA_NAME   "data"

◆ DIM_X_NAME

#define DIM_X_NAME   "x"

◆ DIM_Y_NAME

#define DIM_Y_NAME   "y"

◆ ERR

#define ERR ( e)
Value:
{printf("Error: %s\n", nc_strerror(e)); exit(ERRCODE);}
#define ERRCODE
Definition bfloat16.c:84

◆ ERRCODE

#define ERRCODE   2

◆ FILENAME

#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.

Author
Edward Hartnett 12/18/26

◆ NDIM1

#define NDIM1   1

◆ NDIM2

#define NDIM2   2

◆ NX

#define NX   4

◆ NY

#define NY   4

◆ OLD_X_NAME

#define OLD_X_NAME   "old_x"

◆ TMP_NAME

#define TMP_NAME   "tmp"

◆ V_NAME

#define V_NAME   "v"

Function Documentation

◆ main()

int main ( int argc,
char ** argv )