16 #include "atlas/util/Factory.h" 18 #include "atlas/util/Object.h" 20 #include "atlas/util/Rotation.h" 23 class Parametrisation;
29 class RectangularLonLatDomain;
36 namespace projection {
42 class Jacobian :
public std::array<std::array<double, 2>, 2> {
54 double det = jac[0][0] * jac[1][1] - jac[0][1] * jac[1][0];
55 inv[0][0] = +jac[1][1] / det;
56 inv[0][1] = -jac[0][1] / det;
57 inv[1][0] = -jac[1][0] / det;
58 inv[1][1] = +jac[0][0] / det;
64 std::swap( tra[0][1], tra[1][0] );
71 jac[0][0] = jac1[0][0] - jac2[0][0];
72 jac[0][1] = jac1[0][1] - jac2[0][1];
73 jac[1][0] = jac1[1][0] - jac2[1][0];
74 jac[1][1] = jac1[1][1] - jac2[1][1];
81 jac[0][0] = jac1[0][0] + jac2[0][0];
82 jac[0][1] = jac1[0][1] + jac2[0][1];
83 jac[1][0] = jac1[1][0] + jac2[1][0];
84 jac[1][1] = jac1[1][1] + jac2[1][1];
90 return sqrt( jac[0][0] * jac[0][0] + jac[0][1] * jac[0][1] + jac[1][0] * jac[1][0] +
91 jac[1][1] * jac[1][1] );
97 jac[0][0] = jac1[0][0] * jac2[0][0] + jac1[0][1] * jac2[1][0];
98 jac[0][1] = jac1[0][0] * jac2[0][1] + jac1[0][1] * jac2[1][1];
99 jac[1][0] = jac1[1][0] * jac2[0][0] + jac1[1][1] * jac2[1][0];
100 jac[1][1] = jac1[1][0] * jac2[0][1] + jac1[1][1] * jac2[1][1];
104 double dx_dlon()
const {
106 return jac[JDX][JDLON];
108 double dy_dlon()
const {
110 return jac[JDY][JDLON];
112 double dx_dlat()
const {
114 return jac[JDX][JDLAT];
116 double dy_dlat()
const {
118 return jac[JDY][JDLAT];
121 double dlon_dx()
const {
123 return jac[JDLON][JDX];
125 double dlon_dy()
const {
127 return jac[JDLON][JDY];
129 double dlat_dx()
const {
131 return jac[JDLAT][JDX];
133 double dlat_dy()
const {
135 return jac[JDLAT][JDY];
152 static const ProjectionImpl* create(
const eckit::Parametrisation& p );
153 static const ProjectionImpl* create(
const std::string& type,
const eckit::Parametrisation& p );
158 virtual std::string type()
const = 0;
160 virtual void xy2lonlat(
double crd[] )
const = 0;
161 virtual void lonlat2xy(
double crd[] )
const = 0;
165 void xy2lonlat( Point2& )
const;
166 void lonlat2xy( Point2& )
const;
172 virtual bool strictlyRegional()
const = 0;
175 virtual Spec spec()
const = 0;
177 virtual std::string units()
const = 0;
179 virtual operator bool()
const {
return true; }
181 virtual void hash( eckit::Hash& )
const = 0;
187 bool crossesDateLine(
bool );
188 bool includesNorthPole(
bool );
189 bool includesSouthPole(
bool );
191 bool crossesDateLine()
const {
return crossesDateLine_; }
192 bool includesNorthPole()
const {
return includesNorthPole_; }
193 bool includesSouthPole()
const {
return includesSouthPole_; }
198 bool crossesDateLine_ =
false;
199 bool includesNorthPole_ =
false;
200 bool includesSouthPole_ =
false;
205 Normalise(
const eckit::Parametrisation& );
207 void hash( eckit::Hash& )
const;
208 void spec(
Spec& )
const;
209 void operator()(
double crd[] )
const {
211 crd[0] = ( *normalise_ )( crd[0] );
214 operator bool()
const {
return bool( normalise_ ); }
217 std::unique_ptr<util::NormaliseLongitude> normalise_;
218 std::vector<double> values_;
230 const double refLongitude_;
235 static std::string className() {
return "DerivateFactory"; }
237 double h,
double refLongitude = 0. );
240 using Factory::Factory;
243 double refLongitude = 0. ) = 0;
247 inline void ProjectionImpl::xy2lonlat( Point2& point )
const {
248 xy2lonlat( point.data() );
251 inline void ProjectionImpl::lonlat2xy( Point2& point )
const {
252 lonlat2xy( point.data() );
257 xy2lonlat( lonlat.data() );
263 lonlat2xy( xy.data() );
274 Rotated(
const eckit::Parametrisation& );
277 static std::string classNamePrefix() {
return "Rotated"; }
278 static std::string typePrefix() {
return "rotated_"; }
280 void spec(
Spec& )
const;
282 void hash( eckit::Hash& )
const;
290 NotRotated(
const eckit::Parametrisation& ) {}
293 static std::string classNamePrefix() {
return ""; }
294 static std::string typePrefix() {
return ""; }
296 void rotate(
double* )
const {
298 void unrotate(
double* )
const {
301 bool rotated()
const {
return false; }
303 void spec(
Spec& )
const {}
305 void hash( eckit::Hash& )
const {}
309 const ProjectionImpl* atlas__Projection__ctor_config(
const eckit::Parametrisation* config );
310 void atlas__Projection__type(
const ProjectionImpl* This,
char*& type,
int& size );
311 void atlas__Projection__hash(
const ProjectionImpl* This,
char*& hash,
int& size );
Point in arbitrary XYZ-coordinate system.
Definition: Point.h:66
Definition: Rotation.h:26
This file contains classes and functions working on points.
Point in longitude-latitude coordinate system.
Definition: Point.h:103
Definition: ProjectionImpl.h:42
Definition: ProjectionImpl.h:39
Definition: ProjectionImpl.h:183
Point in arbitrary XY-coordinate system.
Definition: Point.h:40
Definition: ProjectionImpl.h:221
Contains all atlas classes and methods.
Definition: atlas-grids.cc:33
Definition: ProjectionImpl.h:204
Definition: ProjectionImpl.h:269
Definition: ProjectionImpl.h:285
Definition: ProjectionImpl.h:234
Configuration class used to construct various atlas components.
Definition: Config.h:27