This contains examples for yac_read_fesom_basic_grid_data.
#include <netcdf.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "tests.h"
static void write_dummy_grid_file(char * name);
write_dummy_grid_file("fesom_grid.nc");
unlink("fesom_grid.nc");
check_grid(fesom_grid);
#ifdef WRITE_VTK_GRID_FILE
#endif
return TEST_EXIT_CODE;
}
static void write_dummy_grid_file(char * file_name) {
int ncid;
int dim_ncells_id;
int dim_nv_id;
int dim_ids[2];
dim_ids[0] = dim_ncells_id;
dim_ids[1] = dim_nv_id;
int var_lon_id, var_lon_v_id, var_lat_id, var_lat_v_id;
nc_def_var(ncid, "lon", NC_DOUBLE, 1, &dim_ncells_id, &var_lon_id));
nc_def_var(ncid, "lon_vertices", NC_DOUBLE, 2, dim_ids, &var_lon_v_id));
nc_def_var(ncid, "lat", NC_DOUBLE, 1, &dim_ncells_id, &var_lat_id));
nc_def_var(ncid, "lat_vertices", NC_DOUBLE, 2, dim_ids, &var_lat_v_id));
double lon[8] = {1,2,3,4,3,3,5.5,5.5};
double lon_vertices[8*9] = {0,1,2,2,1,0,0,0,0,
1,3,2,2,2,2,2,2,2,
3,4,2,2,2,2,2,2,2,
3,5,4,4,4,4,4,4,4,
2,4,4,2,2,2,2,2,2,
1,2,4,5,4,2,2,2,2,
4,6,7,6,5,4,4,4,4,
5,6,4,4,4,4,4,4,4};
double lat[8] = {1.5,0.5,0.5,0.5,1.5,3,1.5,0.5};
double lat_vertices[8*9] = {1,0,1,2,3,2,2,2,2,
0,0,1,1,1,1,1,1,1,
0,1,1,1,1,1,1,1,1,
0,0,1,1,1,1,1,1,1,
1,1,2,2,2,2,2,2,2,
3,2,2,3,4,4,4,4,4,
1,1,2,3,3,2,2,2,2,
0,1,1,1,1,1,1,1,1};
}
size_t ref_num_cells = 8;
PUT_ERR("wrong number of grid cells");
int ref_num_corners_per_cell[8] = {6,3,3,3,4,6,6,3};
for (size_t i = 0; i < ref_num_cells; ++i)
PUT_ERR("wrong number of corners per cell");
}
void yac_basic_grid_data_free(struct yac_basic_grid_data grid)
int main(int argc, char **argv)
void yac_write_basic_grid_data_to_file(struct yac_basic_grid_data *grid, char const *name)
void yac_nc_create(const char *path, int cmode, int *ncidp)
#define YAC_HANDLE_ERROR(exp)
struct yac_basic_grid_data yac_read_fesom_basic_grid_data(char const *filename)
int * num_vertices_per_cell