grid.h 2.28 KB
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef _GRID_H
#define _GRID_H


typedef struct {
  int     self;
  int     type;                   /* grid type                      */
  int     prec;                   /* grid precision                 */
  int    *mask;
  double *xvals;
  double *yvals;
  double *area;
  double *xbounds;
  double *ybounds;
  double  xfirst, yfirst;
  double  xlast, ylast;
  double  xinc, yinc;
18
19
20
21
22
23
24
25
  double  lam_originLon;          /* lambert                        */
  double  lam_originLat;
  double  lam_lonParY;
  double  lam_lat1;
  double  lam_lat2;
  double  lam_xinc;
  double  lam_yinc;
  int     lam_defined;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
26
  double  xpole, ypole, angle;    /* rotated north pole             */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
27
  int     isCyclic;               /* TRUE for global cyclic grids   */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
  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         */
  int     trunc;                  /* parameter for GRID_SPECTEAL    */
  int     nvertex;
  int    *rowlon;
  int     nrowlon;
  int     size;
  int     xsize;
  int     ysize;
  int     locked;
  char    xname[256];
  char    yname[256];
  char    xlongname[256];
  char    ylongname[256];
  char    xstdname[256];
  char    ystdname[256];
  char    xunits[256];
  char    yunits[256];
}
GRID;


const double *gridInqXvalsPtr(int gridID);
const double *gridInqYvalsPtr(int gridID);

double *gridInqXboundsPtr(int gridID);
double *gridInqYboundsPtr(int gridID);
const double *gridInqAreaPtr(int gridID);

int gridCompare(int gridID, GRID grid);
int gridGenerate(GRID grid);

62
/* GME grid */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
63
64
65
66
void gme_grid(int gridsize, double *rlon, double *rlat,
	      double *blon, double *blat, int *imask,
              int ni, int nd, int ni2, int ni3);

67
/* Rotated grid */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
68
69
70
71
72
double rls_to_rl(double phis, double rlas, double polphi, double pollam);
double phs_to_ph(double phis, double rlas, double polphi);
double rl_to_rls(double phi, double rla, double polphi, double pollam);
double ph_to_phs(double phi, double rla, double polphi, double pollam);

73
74
75
/* Lambert grid */
int W3FB12(double xi, double xj, double alat1, double elon1, double dx,
	   double elonv, double alatan, double *alat, double *elon);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
76
#endif