12#ifdef YAC_NETCDF_ENABLED
24#ifndef YAC_NETCDF_ENABLED
28 "ERROR(yac_open_woa_output): "
29 "YAC is built without the NetCDF support");
43#ifndef YAC_NETCDF_ENABLED
47 "ERROR(yac_close_woa_output): "
48 "YAC is built without the NetCDF support");
60#ifndef YAC_NETCDF_ENABLED
66 "ERROR(yac_read_woa_dimensions): "
67 "YAC is built without the NetCDF support");
83 fieldInfo->
varId = varId;
89 (varType == NC_FLOAT) || (varType == NC_DOUBLE),
90 "unsupported datatype for variable \"%s\" "
91 "(has to be either NC_DOUBLE or NC_FLOAT)",
fieldName)
97 (varNdims > 0) && (varNdims <= 4),
98 "invalid number of dimensions for "
99 "variable \"%s\" (has to be between 1 and 4)",
fieldName)
102 int varDimids[NC_MAX_VAR_DIMS];
106 for (
int i = 0; i < varNdims; ++i) {
109 char dim_name[NC_MAX_NAME + 1];
113 size_t * count = NULL;
116 if (!strcmp(dim_name,
"time")) {
119 }
else if (!strcmp(dim_name,
"depth")) {
122 }
else if (!strcmp(dim_name,
"lon")) {
125 }
else if (!strcmp(dim_name,
"lat")) {
131 (count != NULL) && (idx != NULL),
132 "supported dimension \"%s\" of variable \"%s\"", dim_name,
fieldName)
158 int timeStep,
int level) {
160#ifndef YAC_NETCDF_ENABLED
168 "ERROR(yac_read_woa_timestep_level): "
169 "YAC is built without the NetCDF support");
172 size_t start[4] = {0,0,0,0};
173 size_t count[4] = {1,1,1,1};
178 ((
size_t)level > 0) && ((
size_t)level <= fieldInfo.
nbrLevels),
179 "invalid level (has to be between 1 and %d)",
188 ((
size_t)timeStep > 0) && ((
size_t)timeStep <= fieldInfo.
nbrTimeSteps),
189 "invalid time step (has to be between 1 and %d)",
205 nc_get_vara_double(fileId, fieldInfo.
varId, start, count, cell_data));
void yac_nc_inq_varid(int ncid, char const *name, int *varidp)
void yac_nc_open(const char *path, int omode, int *ncidp)
void yac_read_woa_timestep_level(int fileId, double *cell_data, struct yac_fieldMetadata fieldInfo, int timeStep, int level)
void yac_close_woa_output(int ncid)
int yac_open_woa_output(char const *input_file)
void yac_read_woa_dimensions(int fileId, char const *fieldName, struct yac_fieldMetadata *fieldInfo)
double * yac_get_woa_memory(struct yac_fieldMetadata fieldInfo)
void yac_free_woa_memory(double *data)
general routines for reading WOA output NetCDF files
#define YAC_HANDLE_ERROR(exp)
#define YAC_ASSERT_F(exp, format,...)