|
|
|
@ -21,6 +21,7 @@ class UVDataStorage
|
|
|
|
|
std::vector<real> u, v, u2; |
|
|
|
|
size_t nx = 0, ny = 0; |
|
|
|
|
Metric metric; |
|
|
|
|
MString unit; |
|
|
|
|
|
|
|
|
|
UVDataStorage() = default; |
|
|
|
|
real D(real lon1, real lat1, real lon2, real lat2) const |
|
|
|
@ -38,6 +39,8 @@ class UVDataStorage
|
|
|
|
|
real Ud(size_t ix, size_t iy) const { return IsCoast(ix, iy) ? 0.0 : U(ix, iy); } |
|
|
|
|
real Vd(size_t ix, size_t iy) const { return IsCoast(ix, iy) ? 0.0 : V(ix, iy); } |
|
|
|
|
|
|
|
|
|
void SetUnit(const MString& str) { unit = str; } |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
enum STPOINT |
|
|
|
|
{ |
|
|
|
@ -82,7 +85,22 @@ class UVDataStorage
|
|
|
|
|
bool IsCoast(size_t i) const { return U(i) == fillval || V(i) == fillval; } |
|
|
|
|
bool IsCoast(size_t ix, size_t iy) const { return U(ix, iy) == fillval || V(ix, iy) == fillval; } |
|
|
|
|
|
|
|
|
|
bool IsFill(size_t i) const { return IsCoast(i); } |
|
|
|
|
bool IsFill(size_t ix, size_t iy) const { return IsCoast(ix, iy); } |
|
|
|
|
|
|
|
|
|
static real Fillval() { return fillval; } |
|
|
|
|
|
|
|
|
|
const MString& Unit() const { return unit; } |
|
|
|
|
|
|
|
|
|
const MString DUnit() const |
|
|
|
|
{ |
|
|
|
|
switch(metric) |
|
|
|
|
{ |
|
|
|
|
case(Metric::EUCLID): return ""; |
|
|
|
|
case(Metric::SPHERIC): return "km"; |
|
|
|
|
} |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
template<class OneVarData, bool isgrid> class UVDataDims; |
|
|
|
@ -128,6 +146,7 @@ template<class OneVarData> class UVDataDims<OneVarData, true>: public UVDataStor
|
|
|
|
|
U2(i) = u(i) * u(i) + v(i) * v(i); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
SetUnit(u.Unit()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
@ -138,6 +157,9 @@ template<class OneVarData> class UVDataDims<OneVarData, true>: public UVDataStor
|
|
|
|
|
|
|
|
|
|
real XStep() const { return xstep; } |
|
|
|
|
real YStep() const { return ystep; } |
|
|
|
|
|
|
|
|
|
real Ix2Lon(size_t ix) const { return x0 + ix * xstep; } |
|
|
|
|
real Iy2Lat(size_t iy) const { return y0 + iy * ystep; } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
template<class OneVarData> class UVDataDims<OneVarData, false>: public UVDataStorage |
|
|
|
|