OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
nccmp.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2004-2006, 2009 Remik Ziemlinski <first d0t surname att n0aa d0t g0v>
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2, or (at your option)
7  any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; see the file COPYING.
16  If not, write to the Free Software Foundation,
17  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef NCCMP_H
21 #define NCCMP_H 1
22 #include "opt.h"
23 #include <netcdf.h>
24 #include <math.h>
25 #include <cstring>
26 #include <cstdlib>
27 #include <stdint.h>
28 #include <string>
29 
30 #ifdef MACINTOSH
31 typedef unsigned int uint;
32 #endif
33 
34 #include "nccmp_user_type.h"
35 
36 typedef struct MISSING_STRUCT {
37  nc_type type;
38 
39  union {
40  char c;
41  int8_t b;
42  uint8_t ub;
43  short s;
44  uint16_t us;
45  int i;
46  uint ui;
47  int64_t l;
48  uint64_t ul;
49  float f;
50  double d;
51  };
52 } missing_struct;
53 
54 typedef struct VARSTRUCT {
55  char name[NC_MAX_NAME];
56  int varid;
57  off_t len; /* # elements per record (or overall if static). */
58  size_t dimlens[NC_MAX_VAR_DIMS];
59  nc_type type;
60  int ndims;
61  int dimids[NC_MAX_VAR_DIMS];
62  char hasrec; /* has record dimension? */
63  int natts;
65  char hasmissing;
67  missing_struct missing;
68 } varstruct;
69 
70 typedef struct DIMSTRUCT {
71  int dimid;
72  size_t len;
73  char name[NC_MAX_NAME];
74 } dimstruct;
75 
76 typedef struct GROUP_NODE {
77  int groupID;
78  char groupName[NC_MAX_NAME];
79  int ngroups;
80  struct GROUP_NODE *childGroups;
81 } GROUP_NODE;
82 
83 int openfiles(nccmpopts* opts, int *ncid1, int *ncid2);
84 int nccmp(nccmpopts* opts);
85 int nccmpmetadata(nccmpopts* opts, int ncid1, int ncid2);
86 int nccmpdata(nccmpopts* opts, int ncid1, int ncid2);
87 nccmp_user_type_t* getvarinfo(int ncid, varstruct* vars, int* nvars, int debug);
88 void type2string(nc_type type, char* str);
89 int excludevars(int ncid1, int ncid2, char** finallist,
90  int nfinal, char** excludelist, int nexclude);
91 
92 int allvarnames(char** list, int nvars, int ncid1, int ncid2);
93 int cmpattval(int nc1, int nc2, int varid1, int varid2, char* name, int len, nc_type type);
94 int findvar(char * name, varstruct *vars);
95 void handle_error(int status);
96 int odometer(size_t* odo, size_t* limits, int first, int last);
97 int compareGroup(nccmpopts* opts, int ncid1, int ncid2);
98 
99 extern "C" nccmp_user_type_t* nccmp_load_group_usertype_array(int group_id, int *nuser_types);
100 
101 #endif /* !NCCMP_H */
int ndims
Definition: nccmp.h:47
nccmp_user_type_t * getvarinfo(int ncid, varstruct *vars, int *nvars, int debug)
Definition: nccmp.c:865
size_t len
Definition: nccmp.h:58
nc_type type
Definition: nccmp.h:29
int user_type_idx
Definition: nccmp.hpp:64
int dimid
Definition: nccmp.h:57
int status
Definition: l1_czcs_hdf.c:32
char groupName[NC_MAX_NAME]
Definition: nccmp.h:64
list(APPEND LIBS ${PGSTK_LIBRARIES}) add_executable(atteph_info_modis atteph_info_modis.c) target_link_libraries(atteph_info_modis $
Definition: CMakeLists.txt:7
int cmpattval(int nc1, int nc2, int varid1, int varid2, char *name, int len, nc_type type)
Definition: nccmp.c:503
char c
Definition: nccmp.h:32
uint8_t ub
Definition: nccmp.hpp:42
void type2string(nc_type type, char *str)
Definition: nccmp.c:664
double d
Definition: nccmp.h:37
short s
Definition: nccmp.h:34
off_t len
Definition: nccmp.h:44
int natts
Definition: nccmp.h:50
int compareGroup(nccmpopts *opts, int ncid1, int ncid2)
Definition: nccmp.cpp:3095
int excludevars(int ncid1, int ncid2, char **finallist, int nfinal, char **excludelist, int nexclude)
Definition: nccmp.c:176
int varid
Definition: nccmp.h:43
char hasrec
Definition: nccmp.h:49
size_t dimlens[NC_MAX_VAR_DIMS]
Definition: nccmp.h:45
void handle_error(int status)
Definition: nccmp.c:219
int nuser_types
Definition: nccmp.h:66
int8_t b
Definition: nccmp.h:33
int notsupported
Definition: nccmp.hpp:66
int odometer(size_t *odo, size_t *limits, int first, int last)
Definition: nccmp.c:236
nccmp_user_type_t * nccmp_load_group_usertype_array(int group_id, int *nuser_types)
int groupID
Definition: nccmp.h:63
nc_type type
Definition: nccmp.h:46
int nccmp(nccmpopts *opts)
Definition: nccmp.c:2202
float f
Definition: nccmp.h:36
const char * str
Definition: l1c_msi.cpp:35
char name[NC_MAX_NAME]
Definition: nccmp.h:59
uint16_t us
Definition: nccmp.hpp:44
missing_struct missing
Definition: nccmp.h:52
int ngroups
Definition: nccmp.h:65
char name[NC_MAX_NAME]
Definition: nccmp.h:42
char hasmissing
Definition: nccmp.h:51
struct GROUP_NODE * childGroups
Definition: nccmp.h:68
int nccmpmetadata(nccmpopts *opts, int ncid1, int ncid2)
Definition: nccmp.c:1248
int openfiles(nccmpopts *opts, int *ncid1, int *ncid2)
Definition: nccmp.c:692
int dimids[NC_MAX_VAR_DIMS]
Definition: nccmp.h:48
int64_t l
Definition: nccmp.hpp:47
int nccmpdata(nccmpopts *opts, int ncid1, int ncid2)
Definition: nccmp.c:2085
int findvar(char *name, varstruct *vars)
Definition: nccmp.c:1527
uint64_t ul
Definition: nccmp.hpp:48
int allvarnames(char **list, int nvars, int ncid1, int ncid2)
Definition: nccmp.c:968