Go to the documentation of this file.
12 static const char*
typename[] = {
29 if (stat != NC_NOERR) {
30 (void) fprintf(
stderr,
"line %d of %s: %s\n",
line,
file, nc_strerror(stat));
36 if (stat != NC_NOERR) {
37 (void) fprintf(
stderr,
"line %d of %s: %s\n",
line,
file, nc_strerror(stat));
55 if (
type == NC_CHAR) {
59 (
result = malloc(nchar *
sizeof (
char))));
70 sprintf(
tmp,
"\%db", ((
signed char *)
value)[
i]);
73 sprintf(
tmp,
"\%ds", ((
short *)
value)[
i]);
79 sprintf(
tmp,
"\%gf", ((
float *)
value)[
i]);
82 sprintf(
tmp,
"\%g", ((
double *)
value)[
i]);
85 sprintf(
tmp,
"\%uUB", ((
unsigned char *)
value)[
i]);
88 sprintf(
tmp,
"\%huUS", ((
unsigned short *)
value)[
i]);
91 sprintf(
tmp,
"\%uU", ((
unsigned int *)
value)[
i]);
94 sprintf(
tmp,
"\tvalue of unknown type %d, nvals %d)",
114 TRY_NC(__FILE__, __LINE__,
115 nc_inq_dimids(ncid, &ndims,
NULL, 1));
122 TRYMEM(__FILE__, __LINE__,
123 (dimids = malloc(ndims *
sizeof (*dimids))));
124 TRY_NC(__FILE__, __LINE__,
125 nc_inq_dimids(ncid,
NULL, dimids, 1));
127 TRYMEM(__FILE__, __LINE__,
128 (dim = malloc(ndims *
sizeof (*dim))));
129 for (
i = 0;
i < ndims;
i++)
130 TRY_NC(__FILE__, __LINE__,
131 nc_inq_dim(ncid, dimids[
i], dim[
i].
name, &dim[
i].len));
141 for (
i = 0;
i < ndims;
i++)
142 printf(
"\t%s = %d ;\n",
165 while (dimnames[
i] !=
NULL) {
166 status = nc_inq_dimid(ncid, dimnames[
i], dimid);
167 if (
status == NC_NOERR)
break;
182 TRY_NC(__FILE__, __LINE__,
183 nc_inq_varnatts(ncid, varid, &natts));
187 size_t typesize,
nvals;
190 TRYMEM(__FILE__, __LINE__,
191 (att = malloc(natts *
sizeof (*att))));
193 for (
i = 0;
i < natts;
i++) {
196 TRY_NC(__FILE__, __LINE__,
197 nc_inq_attname(ncid, varid,
i, att[
i].
name));
198 TRY_NC(__FILE__, __LINE__,
199 nc_inq_att(ncid, varid,
205 TRY_NC(__FILE__, __LINE__,
206 nc_inq_type(ncid, att[
i].
type,
NULL, &typesize));
208 TRYMEM(__FILE__, __LINE__,
212 TRY_NC(__FILE__, __LINE__,
213 nc_get_att(ncid, varid,
216 if (att[
i].
type == NC_CHAR)
226 for (
i = 0;
i < natts;
i++)
228 printf(
"\t\t%s:%s = %s ;\n",
229 varname, att[
i].
name,
239 for (
i = 0;
i < natts;
i++) {
259 TRY_NC(__FILE__, __LINE__,
260 nc_inq_varids(ncid, &nvars,
NULL));
267 TRYMEM(__FILE__, __LINE__,
268 (varids = malloc(nvars *
sizeof (*varids))));
269 TRY_NC(__FILE__, __LINE__,
270 nc_inq_varids(ncid,
NULL, varids));
271 TRYMEM(__FILE__, __LINE__,
272 (var = malloc(nvars *
sizeof (*var))));
274 for (
i = 0;
i < nvars;
i++) {
276 var[
i].
id = varids[
i];
281 TRY_NC(__FILE__, __LINE__,
282 nc_inq_var(ncid, varids[
i],
290 if (var[
i].ndims > 0) {
293 TRYMEM(__FILE__, __LINE__,
294 (dim = malloc(var[
i].ndims *
sizeof (*dim))));
295 for (idim = 0; idim < var[
i].
ndims; idim++) {
296 TRY_NC(__FILE__, __LINE__,
315 const char* varname,
const char* grpname) {
319 for (igrp = 0; igrp < nc.
ngrps; igrp++)
320 if (strcmp(grpname, (
char*) nc.
grps[igrp].
name) == 0)
323 if (igrp < nc.
ngrps) {
324 for (ivar = 0; ivar < nc.
grps[igrp].
nvars; ivar++)
325 if (strcmp(varname, (
char*) nc.
grps[igrp].
var[ivar].
name) == 0)
328 varptr = &nc.
grps[igrp].
var[ivar];
338 printf(
"-E- readall_var - Hey, you passed in a NULL pointer.\n");
342 if (var->
ndims > 0) {
348 TRY_NC(__FILE__, __LINE__,
349 nc_inq_type(var->
id, var->
type,
NULL, &typesize));
352 TRYMEM(__FILE__, __LINE__,
356 TRY_NC(__FILE__, __LINE__,
367 for (
i = 0;
i < nvars;
i++) {
369 printf(
"\t%s %s",
typename[
v.type],
v.name);
374 for (idim = 0; idim <
v.ndims; idim++) {
375 printf(
"%s",
v.dim[idim].name);
376 printf(
"%s", idim <
v.ndims - 1 ?
", " :
")");
387 for (
i = 0;
i < nvars;
i++) {
411 while (varnames[
i] !=
NULL) {
412 status = nc_inq_varid(ncid, varnames[
i], varid);
413 if (
status == NC_NOERR)
break;
428 TRY_NC(__FILE__, __LINE__,
429 nc_inq_grpname(ncid, grp->
name));
430 TRY_NC(__FILE__, __LINE__,
443 TRY_NC(__FILE__, __LINE__,
445 if (grp->
ngrps > 0) {
449 TRYMEM(__FILE__, __LINE__,
450 (grpids = malloc(grp->
ngrps * sizeof (*grpids))));
451 TRY_NC(__FILE__, __LINE__,
452 nc_inq_grps(ncid,
NULL, grpids));
454 TRYMEM(__FILE__, __LINE__,
469 printf(
"\ngroup: %s {\n", grp.
name);
472 if (grp.
ndims > 0) printf(
"dimensions:\n");
476 if (grp.
nvars > 0) printf(
"variables:\n");
480 if (grp.
natts > 0) printf(
"\n// attributes:\n");
490 printf(
"} // group %s\n", grp.
name);
void free_dims_nc(dim_str_nc *dim)
#define TRY_NC(file, line, ncstat)
int find_varid_nc(int ncid, int *varid, const char *varnames[])
void check_err(const int stat, const int line, const char *file)
dim_str_nc * load_grpdims(int ncid)
void print_grp_nc(grp_str_nc grp)
var_str_nc * load_vars_nc(int ncid)
int find_dimid_nc(int ncid, int *dimid, const char *dimnames[])
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed file
int load_grp_nc(grp_str_nc *grp)
void report_err(const int stat, const int line, const char *file)
var_str_nc * find_var_byname_nc(grp_str_nc nc, const char *varname, const char *grpname)
void print_atts_nc(att_str_nc *att, int natts, char *varname)
char * format_ncval(void *value, nc_type type, size_t nvals)
void free_grp_nc(grp_str_nc *grp)
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude data
void print_vars_nc(var_str_nc *var, int nvars)
void free_atts_nc(att_str_nc *att, int natts)
att_str_nc * load_atts_nc(int ncid, int varid)
int readall_var(var_str_nc *var)
#define TRYMEM(file, line, memstat)
void print_dims_nc(dim_str_nc *dim, int ndims)
void free_vars_nc(var_str_nc *var, int nvars)