vlist.h 3.88 KB
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
2
3
#ifndef _VLIST_H
#define _VLIST_H

4
5
#include <stddef.h>  /* size_t */

Uwe Schulzweida's avatar
Uwe Schulzweida committed
6
7
8
9
#ifndef _CDI_LIMITS_H
#  include "cdi_limits.h"
#endif

10
#define VALIDMISS 1.e+303
Uwe Schulzweida's avatar
Uwe Schulzweida committed
11

12
13
14
15
/*
 * CDI attribute
 */
typedef struct {
16
17
18
19
20
  size_t    xsz;	  /* amount of space at xvalue                      */
  size_t    namesz;       /* size of name                                   */
  char     *name;         /* attribute name                                 */
  int       indtype;	  /* internal data type of xvalue (INT, FLT or TXT) */
  int       exdtype;      /* external data type                             */
21
                          /* indtype    exdtype                             */
22
23
24
25
26
                          /* TXT        TXT                                 */
                          /* INT        INT16, INT32                        */
                          /* FLT        FLT32, FLT64                        */
  size_t    nelems;    	  /* number of elements                             */
  void     *xvalue;       /* the actual data                                */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
27
} cdi_att_t;
28
29
30


typedef struct {
Uwe Schulzweida's avatar
Uwe Schulzweida committed
31
32
33
34
  size_t     nalloc;		/* number allocated >= nelems */
  size_t     nelems;		/* length of the array */
  cdi_att_t  value[MAX_ATTRIBUTES];
} cdi_atts_t;
35
36


Uwe Schulzweida's avatar
Uwe Schulzweida committed
37
38
39
40
typedef struct
{
  int      flag;
  int      index;
41
  int      mlevelID;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
42
43
  int      flevelID;
}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
44
levinfo_t;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
45

Uwe Schulzweida's avatar
Uwe Schulzweida committed
46

Uwe Schulzweida's avatar
Uwe Schulzweida committed
47
48
typedef struct
{
Uwe Schulzweida's avatar
Uwe Schulzweida committed
49
50
51
52
53
54
55
56
  int         flag;
  int         nlevs;
  int         isUsed;
  int         mvarID;
  int         fvarID;
  int         param;
  int         gridID;
  int         zaxisID;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
57
  int         timeID;    /* TIME_VARIABLE or TIME_CONSTANT */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
58
59
60
61
  int         datatype;  /* DATATYPE_PACKX for GRIB data, else DATATYPE_FLT32 or DATATYPE_FLT64 */
  int         instID;
  int         modelID;
  int         tableID;
62
  int         tsteptype; /* Time step type: TSTEP_INSTANT, TSTEP_AVG ... */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
63
64
  int         timave;
  int         timaccu;
65
  int         xyz;
66
  int         missvalused; /* TRUE if missval is defined */
67
  int         lvalidrange;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
68
69
70
71
72
73
74
  char       *name;
  char       *longname;
  char       *stdname;
  char       *units;
  double      missval;
  double      scalefactor;
  double      addoffset;
75
  double      validrange[2];
Uwe Schulzweida's avatar
Uwe Schulzweida committed
76
  levinfo_t  *levinfo;
77
  int         comptype;     // compression type
78
  int         complevel;    // compression level
Uwe Schulzweida's avatar
Uwe Schulzweida committed
79
  cdi_atts_t  atts;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
80
}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
81
var_t;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
82

Uwe Schulzweida's avatar
Uwe Schulzweida committed
83

Uwe Schulzweida's avatar
Uwe Schulzweida committed
84
85
typedef struct
{
Uwe Schulzweida's avatar
Uwe Schulzweida committed
86
87
88
89
90
91
92
93
94
95
96
  int         self;
  int         nvars;        /* number of variables                */
  int         ngrids;
  int         nzaxis;
  int         ntsteps;
  int         taxisID;
  int         tableID;
  int         instID;
  int         modelID;
  int         varsAllocated;
  int         gridIDs[MAX_GRIDS_PS];
97
  int         zaxisIDs[MAX_ZAXES_PS];
Uwe Schulzweida's avatar
Uwe Schulzweida committed
98
99
  var_t      *vars;
  cdi_atts_t  atts;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
100
}
101
102
103
104
vlist_t;


vlist_t *vlist_to_pointer(int vlistID);
105
106
107
108
const char *vlistInqVarNamePtr(int vlistID, int varID);
const char *vlistInqVarLongnamePtr(int vlistID, int varID);
const char *vlistInqVarStdnamePtr(int vlistID, int varID);
const char *vlistInqVarUnitsPtr(int vlistID, int varID);
109
110
111
112
113
114
115
116
117
void     vlistDestroyVarName(int vlistID, int varID);
void     vlistDestroyVarLongname(int vlistID, int varID);
void     vlistDestroyVarUnits(int vlistID, int varID);
void     vlistDefVarTime(int vlistID, int varID, int timeID);
int      vlistInqVarMissvalUsed(int vlistID, int varID);
int      vlistHasTime(int vlistID);

int      vlistDelAtts(int vlistID, int varID);
int      vlistCopyVarAtts(int vlistID1, int varID_1, int vlistID2, int varID_2);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
118

119
120
121
122
123
124
/*      vlistDefVarValidrange: Define the valid range of a Variable */
void    vlistDefVarValidrange(int vlistID, int varID, const double *validrange);

/*      vlistInqVarValidrange: Get the valid range of a Variable */
int     vlistInqVarValidrange(int vlistID, int varID, double *validrange);

Uwe Schulzweida's avatar
Uwe Schulzweida committed
125
#endif  /* _VLIST_H */
126
127
128
129
130
131
132
133
134
/*
 * Local Variables:
 * c-file-style: "Java"
 * c-basic-offset: 2
 * indent-tabs-mode: nil
 * show-trailing-whitespace: t
 * require-trailing-newline: t
 * End:
 */