#include <stdlib.h>
#include <stdio.h>
#define FILE_NAME "simple_xy.nc"
#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, varid;
int data_in[NX][NY];
int x, y, retval;
ERR(retval);
ERR(retval);
ERR(retval);
for (x = 0; x < NX; x++)
for (y = 0; y < NY; y++)
if (data_in[x][y] != x * NY + y)
return ERRCODE;
ERR(retval);
printf("*** SUCCESS reading example file %s!\n", FILE_NAME);
return 0;
}