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

4
5
#include "cdi.h"

Uwe Schulzweida's avatar
Uwe Schulzweida committed
6
typedef unsigned char mask_t;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
7
8
9
10
11

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


Uwe Schulzweida's avatar
Uwe Schulzweida committed
75
76
77
void grid_init(grid_t *gridptr);
void grid_free(grid_t *gridptr);

Thomas Jahns's avatar
Thomas Jahns committed
78
unsigned cdiGridCount(void);
79

Uwe Schulzweida's avatar
Uwe Schulzweida committed
80
81
82
const double *gridInqXvalsPtr(int gridID);
const double *gridInqYvalsPtr(int gridID);

83
84
const double *gridInqXboundsPtr(int gridID);
const double *gridInqYboundsPtr(int gridID);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
85
86
const double *gridInqAreaPtr(int gridID);

87
88
int gridCompare(int gridID, const grid_t *grid);
int gridGenerate(const grid_t *grid);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
89

Thomas Jahns's avatar
Thomas Jahns committed
90
void cdiGridGetIndexList(unsigned, int * );
Uwe Schulzweida's avatar
Uwe Schulzweida committed
91

92
93
void
gridUnpack(char * unpackBuffer, int unpackBufferSize,
94
           int * unpackBufferPos, int originNamespace, void *context,
95
96
           int force_id);

97
98
int  varDefGrid(int vlistID, const grid_t *grid, int mode);

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