#include <stdlib.h>
#include <stdio.h>
#define FILE_NAME "simple_xy.nc"
#define NDIMS 2
#define NX 6
#define NY 12
#define ERRCODE 2
#define ERR(e) {printf("Error: %s\n", nc_strerror(e)); exit(ERRCODE);}
int
main()
{
int ncid, x_dimid, y_dimid, varid;
int dimids[NDIMS];
int data_out[NX][NY];
int x, y, retval;
for (x = 0; x < NX; x++)
for (y = 0; y < NY; y++)
data_out[x][y] = x * NY + y;
ERR(retval);
if ((retval =
nc_def_dim(ncid,
"x", NX, &x_dimid)))
ERR(retval);
if ((retval =
nc_def_dim(ncid,
"y", NY, &y_dimid)))
ERR(retval);
dimids[0] = x_dimid;
dimids[1] = y_dimid;
dimids, &varid)))
ERR(retval);
ERR(retval);
ERR(retval);
ERR(retval);
printf("*** SUCCESS writing example file simple_xy.nc!\n");
return 0;
}