WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Grid.h
1#ifndef _WINC_GRID
2#define _WINC_GRID
3
4#include <WXP/Date.h>
5#include <WXP/DateVal.h>
6#include <WXP/Domain.h>
7#include <WXP/DomainVal.h>
8#include <WXP/EarthPoint.h>
9#include <WXP/FloatArray.h>
10#include <WXP/ForeTime.h>
11#include <WXP/GridPoint.h>
12#include <WXP/GridSpec.h>
13#include <WXP/Level.h>
14#include <WXP/Point.h>
15#include <WXP/Range.h>
16#include <WXP/VarSpec.h>
17#include <WXP/Variable.h>
18
19namespace WXP {
20 class Grid {
21 int type; /* Grid type used in grid */
22 int version; /* Version of grid */
23 int source; /* Source of grid */
24 char datim[50]; /* Date and time information */
25 char info[90]; /* Label for grid information */
26 Date date; /* Initial date of file */
27 int nx, ny; /* Size of grid */
28 int grid_type; /* Grid type number */
29 Domain domain; /* The grid location */
30 int model; /* Model number */
31 char gen_name[20]; /* Model used to generate grid */
32 VarSpec var;
33 float *data; /* A pointer to the grid */
34 float *xloc; /* A pointer to X location of grid */
35 float *yloc; /* A pointer to Y location of grid */
36
37 int initClass();
38
39 public:
40 Grid();
41 Grid( int rnx, int rny );
42 Grid( const Grid &grid );
43 ~Grid();
44 int init();
45 int copy( const Grid &grid );
46 int copyInfo( const Grid &grid );
47 int copyData( const Grid &grid );
48 Grid operator=(const Grid &grid);
49 int setType( int val );
50 int getType();
51 int setSource( int val );
52 int getSource();
53 int setVersion( int val );
54 int getVersion();
55 int setDatim( const char *str );
56 int setDatim( String &str );
57 const char *getDatim();
58 int setInfo( const char *str );
59 const char *getInfo();
60 int setDate( Date &d );
61 int setDate( DateVal &dv );
62 inline Date getDate(){ return date; };
63 inline Date getDate( Date &rdate ){ rdate = date; return 1; };
64 Date getInitDate();
66 int setSize( int x, int y );
67 int getSize( int &x, int &y );
68 int getNx();
69 int getNy();
70 float getDx();
71 float getDy();
72 inline int setGridType( int type ){ grid_type = type; return 1; };
73 inline int getGridType(){ return grid_type; };
74 int setDomain( DomainVal &dv );
75 int setDomain( Domain &dom );
78 int getDomain( Domain &dom );
79 int getProj();
80 int tran( EarthPoint ept, Point &pt );
81 int tran( Point pt, EarthPoint &ept );
82 int tran( GridPoint gpt, Point &pt );
83 int tran( Point pt, GridPoint &gpt );
84 int tran( EarthPoint ept, GridPoint &gpt );
85 int tran( GridPoint gpt, EarthPoint &ept );
86 int tran( Domain &dom, Point pt1, Point &pt2 );
87 int tran( Point pt1, Domain &dom, Point &pt2 );
88 float adjustDir( float dir, Point &pt );
89 float unadjustDir( float dir, Point &pt );
90 inline int setModel( int val ){ model = val; return 1; };
91 inline int getModel(){ return model; };
92 int setGenName( const char *str );
93 inline const char *getGenName(){ return gen_name; };
94 inline int setVar( VarSpec v ){ var = v; return 1; };
95 inline int getVar( VarSpec &v ){ v = var; return 1; };
96 inline VarSpec getVarSpec(){ return var; };
97 int setLevel( const char *str );
98 int setLevel( Level &l );
99 int getLevel( Level &l );
100 Level getLevel();
101 int getLevelType();
102 int setForeTime( const char *str );
103 int setForeTime( ForeTime &t );
104 int getForeTime( ForeTime &t );
106 float getForeHours();
107 int getForeSeconds();
108 int setVar( const char *str );
109 int setVar( Variable &v );
110 const char *getUnits();
111 int setUnits( const char *units );
114 int getSpec(GridSpec &spec);
115 int allocData();
116 int allocLocate();
117 int setData( float *array, int order = 0 );
118 int setData( FloatArray &array, int order = 0 );
119 int setValue( int x, int y, float val );
120 inline int setValue1( int x, int y, float val ){ data[y*nx+x] = val; return 1; };
121 float getValue( int x, int y );
122 inline float getValue1( int x, int y ){ return data[y*nx+x]; };
123 float getValue( GridPoint gpt );
124 float getValue( EarthPoint ept );
125 float getValue( Point pt );
126 bool isLocate();
127 bool isData();
128 bool isValue();
129 int setLocate( int x, int y, Point &pt );
130 int getLocate( int x, int y, Point &pt );
131 Point getLocate( int x, int y );
132 int getValid();
133 float getAverage();
134 int getRange( float &min, float &max );
135 int getRange( Range &range );
136 int scale( float scale );
137 int offset( float offset );
138 int print();
139 int printInfo();
140 int printStats();
141 int printData();
142
143 static const int Y = 1; // Grid starts at bottom and goes up
144 static const int INV = 2;// Invert a grid that is y fastest
145
146 static int copyInfo( Grid &grid1, const Grid &grid2 );
147 static int copyData( Grid &grid1, const Grid &grid2 );
148 static int copy( Grid &grid1, const Grid &grid2 );
149 };
150}
151#endif
This class stores date and time information.
Definition Date.h:8
This class stores and manipulates domain data.
Definition Domain.h:19
This class creates an integer array.
Definition FloatArray.h:7
This class defines forecast time parameters.
Definition ForeTime.h:9
This class defines vertical level parameters.
Definition GridSpec.h:7
This class defines a grid.
Definition Grid.h:20
float unadjustDir(float dir, Point &pt)
Definition Grid.cc:532
int tran(EarthPoint ept, Point &pt)
Definition Grid.cc:447
Grid operator=(const Grid &grid)
Definition Grid.cc:91
GridSpec getSpec()
Definition Grid.cc:424
int getNx()
Definition Grid.cc:319
int getType()
Definition Grid.cc:185
Level getLevel()
Definition Grid.cc:578
int getVersion()
Definition Grid.cc:219
Domain getDomain()
Definition Grid.cc:353
int setData(float *array, int order=0)
Definition Grid.cc:716
int setValue(int x, int y, float val)
Definition Grid.cc:754
float getDy()
Definition Grid.cc:394
int getSize(int &x, int &y)
Definition Grid.cc:309
~Grid()
Definition Grid.cc:166
Variable getVar()
Definition Grid.cc:676
DateVal getDateVal()
Definition Grid.cc:288
float getDx()
Definition Grid.cc:386
int getValid()
Definition Grid.cc:921
Grid()
Definition Grid.cc:60
float getValue(int x, int y)
Definition Grid.cc:772
int setSize(int x, int y)
Definition Grid.cc:297
int setDatim(const char *str)
Definition Grid.cc:227
float adjustDir(float dir, Point &pt)
Definition Grid.cc:522
int allocData()
Definition Grid.cc:683
int getNy()
Definition Grid.cc:327
int getLevelType()
Definition Grid.cc:586
float getForeHours()
Definition Grid.cc:631
float getAverage()
Definition Grid.cc:944
int print()
Definition Grid.cc:1048
int setType(int val)
Definition Grid.cc:176
int setDate(Date &d)
Definition Grid.cc:270
int offset(float offset)
Definition Grid.cc:1030
int scale(float scale)
Definition Grid.cc:1011
int setForeTime(const char *str)
Definition Grid.cc:594
int setDomain(DomainVal &dv)
Definition Grid.cc:335
ForeTime getForeTime()
Definition Grid.cc:623
int setGenName(const char *str)
Definition Grid.cc:540
int setVersion(int val)
Definition Grid.cc:210
int setLocate(int x, int y, Point &pt)
Definition Grid.cc:877
int getRange(float &min, float &max)
Definition Grid.cc:972
int setSource(int val)
Definition Grid.cc:193
int init()
Definition Grid.cc:27
int setInfo(const char *str)
Definition Grid.cc:253
const char * getDatim()
Definition Grid.cc:245
DomainVal getDomainVal()
Definition Grid.cc:361
int allocLocate()
Definition Grid.cc:700
int setLevel(const char *str)
Definition Grid.cc:549
int getForeSeconds()
Definition Grid.cc:639
int printInfo()
Definition Grid.cc:1067
int getSource()
Definition Grid.cc:202
const char * getInfo()
Definition Grid.cc:262
int getProj()
Definition Grid.cc:378
This class defines vertical level parameters.
Definition Level.h:8
This is a variable length string class.
Definition String.h:5
This class specifies variable information.
Definition VarSpec.h:13
This class specifies variable information.
Definition Variable.h:7
All WXP classes fall under the WXP namespace.
Definition Angle.h:4
This struct defines basic date values.
Definition DateVal.h:5
This struct defines basic domain parameters.
Definition DomainVal.h:5
This struct defines earth point values (lat, lon, elev)
Definition EarthPoint.h:5
This struct defines basic gridpoint values.
Definition GridPoint.h:5
This struct sets a 3D point (x, y, z)
Definition Point.h:5
This struct defines a simple range of values.
Definition Range.h:5