grid.h 3.21 KB
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
2
3
#ifndef _GRID_H
#define _GRID_H

4
#include "cdi.h"
5
#ifndef RESOURCE_HANDLE_H
6
#include "resource_handle.h"
7
#endif
8

Uwe Schulzweida's avatar
Uwe Schulzweida committed
9
typedef unsigned char mask_t;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
10
11
12
13
14

typedef struct {
  int     self;
  int     type;                   /* grid type                      */
  int     prec;                   /* grid precision                 */
15
  int     proj;                   /* grid projection                */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
16
17
  mask_t *mask;
  mask_t *mask_gme;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
18
19
20
21
22
23
24
25
  double *xvals;
  double *yvals;
  double *area;
  double *xbounds;
  double *ybounds;
  double  xfirst, yfirst;
  double  xlast, ylast;
  double  xinc, yinc;
26
  double  lcc_originLon;          /* Lambert Conformal Conic        */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
27
28
29
30
31
32
  double  lcc_originLat;
  double  lcc_lonParY;
  double  lcc_lat1;
  double  lcc_lat2;
  double  lcc_xinc;
  double  lcc_yinc;
33
34
  int     lcc_projflag;
  int     lcc_scanflag;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
35
  int     lcc_defined;
36
37
38
39
40
41
  double  lcc2_lon_0;             /* Lambert Conformal Conic 2      */
  double  lcc2_lat_0;
  double  lcc2_lat_1;
  double  lcc2_lat_2;
  double  lcc2_a;
  int     lcc2_defined;
42
43
44
45
  double  laea_lon_0;             /* Lambert Azimuthal Equal Area   */
  double  laea_lat_0;
  double  laea_a;
  int     laea_defined;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
46
  double  xpole, ypole, angle;    /* rotated north pole             */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
47
  int     isCyclic;               /* TRUE for global cyclic grids   */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
48
49
50
51
  int     isRotated;              /* TRUE for rotated grids         */
  int     xdef;                   /* 0: undefined 1:xvals 2:x0+xinc */
  int     ydef;                   /* 0: undefined 1:yvals 2:y0+yinc */
  int     nd, ni, ni2, ni3;       /* parameter for GRID_GME         */
52
53
  int     number, position;       /* parameter for GRID_REFERENCE   */
  char   *reference;
54
  unsigned char uuid[CDI_UUID_SIZE]; /* uuid for grid reference        */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
55
56
57
58
59
  int     trunc;                  /* parameter for GRID_SPECTEAL    */
  int     nvertex;
  int    *rowlon;
  int     nrowlon;
  int     size;
60
61
62
  int     xsize;                  /* number of values along X */
  int     ysize;                  /* number of values along Y */
  int     np;                     /* number of parallels between a pole and the equator */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
63
  int     locked;
64
  int     lcomplex;
65
  int     hasdims;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
66
67
68
69
70
71
72
73
  char    xname[CDI_MAX_NAME];
  char    yname[CDI_MAX_NAME];
  char    xlongname[CDI_MAX_NAME];
  char    ylongname[CDI_MAX_NAME];
  char    xstdname[CDI_MAX_NAME];
  char    ystdname[CDI_MAX_NAME];
  char    xunits[CDI_MAX_NAME];
  char    yunits[CDI_MAX_NAME];
Uwe Schulzweida's avatar
Uwe Schulzweida committed
74
  char   *name;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
75
}
76
grid_t;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
77
78


Uwe Schulzweida's avatar
Uwe Schulzweida committed
79
80
81
void grid_init(grid_t *gridptr);
void grid_free(grid_t *gridptr);

82
unsigned cdiGridCount(void);
83

Uwe Schulzweida's avatar
Uwe Schulzweida committed
84
85
86
const double *gridInqXvalsPtr(int gridID);
const double *gridInqYvalsPtr(int gridID);

87
88
const double *gridInqXboundsPtr(int gridID);
const double *gridInqYboundsPtr(int gridID);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
89
90
const double *gridInqAreaPtr(int gridID);

91
92
int gridCompare(int gridID, const grid_t *grid);
int gridGenerate(const grid_t *grid);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
93

94
void cdiGridGetIndexList(unsigned, int * );
Uwe Schulzweida's avatar
Uwe Schulzweida committed
95

96
97
void
gridUnpack(char * unpackBuffer, int unpackBufferSize,
98
           int * unpackBufferPos, int originNamespace, void *context,
99
100
           int force_id);

101
102
extern const resOps gridOps;

Uwe Schulzweida's avatar
Uwe Schulzweida committed
103
#endif
104
105
106
107
108
109
110
111
112
/*
 * Local Variables:
 * c-file-style: "Java"
 * c-basic-offset: 2
 * indent-tabs-mode: nil
 * show-trailing-whitespace: t
 * require-trailing-newline: t
 * End:
 */