#include <GeoConstraint.h>
Inheritance diagram for GeoConstraint:
Public Types | |
enum | LatitudeSense { unknown_sense, normal, inverted } |
enum | Notation { unknown_notation, pos, neg_pos } |
Public Member Functions | |
virtual void | apply_constraint_to_data ()=0 |
Once the bounding box is set use this method to apply the constraint. | |
void | set_bounding_box (double left, double top, double right, double bottom) |
virtual | ~GeoConstraint () |
Constructors | |
GeoConstraint (const string &ds_name) | |
Initialize GeoConstraint with a Grid. | |
Protected Member Functions | |
virtual bool | build_lat_lon_maps ()=0 |
virtual LatitudeSense | categorize_latitude () const |
Notation | categorize_notation (double left, double right) const |
void | find_latitude_indeces (double top, double bottom, LatitudeSense sense, int &latitude_index_top, int &latitude_index_bottom) const |
void | find_longitude_indeces (double left, double right, int &longitude_index_left, int &longitude_index_right) const |
virtual bool | is_bounding_box_valid (double left, double top, double right, double bottom) const |
virtual bool | lat_lon_dimensions_ok ()=0 |
virtual void | reorder_data_longitude_axis (Array &a) |
virtual void | reorder_longitude_map (int longitude_index_left) |
void | transform_constraint_to_pos_notation (double &left, double &right) const |
virtual void | transform_longitude_to_neg_pos_notation () |
virtual void | transform_longitude_to_pos_notation () |
Friends | |
class | GridGeoConstraintTest |
This class will apply a longitude/latitude bounding box to a Grid that is a 'geo-referenced' Grid. That is, it follows the COARDS/CF conventions. This may be relaxed...
If the longitude range of the constraint crosses the boundary of the data array so that the constraint creates two separate rectangles, this class will arrange to return the result as a single Grid. It will do this by rearranging the data before control is passed onto the constraint evaluator and serialization logic. Here's a diagram of how it works:
Suppose a constraint for the longitude BB starts at the left edge of L and goes to the right edge of R:
0.0 180.0 360.0 (longitude, in degrees) +----------------------+ |xxxxxyyyyyyyyyyyyzzzzz| -----+ +----- | | | | | R | | L | | | | | -----+ +----- | | +----------------------+
For example, suppose the client provides a bounding box that starts at 200 degrees and ends at 80. This class will first copy the Left part to new storage and then copy the right part, thus 'stitching together' the two halves of the constraint. The result looks like:
80.0 360.0/0.0 180.0 ~200.0 (longitude, in degrees) +----------------------+ |zzzzzxxxxxxyyyyyyyyyyy| -----++----- | | || | | | L || R | | | || | | -----++----- | | | +----------------------+
The changes are made in the Grid variable itself, so once this is done the Grid should not be re-read by the CE or serialization code.
Definition at line 100 of file GeoConstraint.h.
|
Most of the time, latitude starts at the top of an array with positive values and ends up at the bottom with negative ones. But sometimes... the world is upside down. Definition at line 115 of file GeoConstraint.h. Referenced by categorize_latitude(). |
|
The longitude extents of the constraint bounding box can be expressed two ways: using a 0/359 notation and using a -180/179 notation. I call the 0/359 notation 'pos' and the -180/179 notation 'neg_pos'. Definition at line 106 of file GeoConstraint.h. Referenced by set_bounding_box(). |
|
Definition at line 521 of file GeoConstraint.cc. |
|
Definition at line 214 of file GeoConstraint.h. |
|
Implemented in ArrayGeoConstraint, and GridGeoConstraint. |
|
A protected method that searches for latitude and longitude map vectors and sets six key internal fields. This method returns false if either map cannot be found. The d_lon, d_lon_length and d_lon_dim (and matching lat) fields must be set by this method.
Referenced by GridGeoConstraint::GridGeoConstraint(). |
|
Take a look at the latitude vector values and record whether the world is normal or upside down.
Definition at line 332 of file GeoConstraint.cc. References LatitudeSense, and normal. Referenced by set_bounding_box(). |
|
A private method that determines if the longitude part of the bounding box uses 0/359 or -180/179 notation. This class only supports latitude constriants which use 90/-90 notation, so there's no need to figure out what sort of notation they use.
Definition at line 128 of file GeoConstraint.cc. References neg_pos. Referenced by set_bounding_box(). |
|
Scan from the top to the bottom, and the bottom to the top, looking for the top and bottom bounding box edges, respectively.
Definition at line 289 of file GeoConstraint.cc. Referenced by set_bounding_box(). |
|
Scan from the left to the right, and the right to the left, looking for the left and right bounding box edges, respectively.
Definition at line 201 of file GeoConstraint.cc. References DBG2. Referenced by set_bounding_box(). |
|
Definition at line 229 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 233 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 324 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 354 of file GeoConstraint.h. |
|
Definition at line 358 of file GeoConstraint.h. |
|
Definition at line 223 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), ArrayGeoConstraint::apply_constraint_to_data(), and reorder_data_longitude_axis(). |
|
Definition at line 238 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 276 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 255 of file GeoConstraint.h. |
|
Definition at line 363 of file GeoConstraint.h. |
|
Definition at line 294 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 290 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 341 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 242 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 272 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 259 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), ArrayGeoConstraint::apply_constraint_to_data(), and reorder_data_longitude_axis(). |
|
Definition at line 367 of file GeoConstraint.h. |
|
Definition at line 307 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), ArrayGeoConstraint::apply_constraint_to_data(), and reorder_data_longitude_axis(). |
|
Definition at line 311 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), ArrayGeoConstraint::apply_constraint_to_data(), and reorder_data_longitude_axis(). |
|
Definition at line 337 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 328 of file GeoConstraint.h. Referenced by reorder_data_longitude_axis(). |
|
Definition at line 169 of file GeoConstraint.cc. Referenced by set_bounding_box(). |
|
Are the latitude and longitude dimensions ordered so that this class can properly constrain the data? This method throws Error if lat and lon are not to two 'fastest-varying' (or 'rightmost) dimensions. It sets the internal property longitude_rightmost if that's true.
Referenced by GridGeoConstraint::GridGeoConstraint(). |
|
Reorder the data values relative to the longitude axis so that the reordered longitude map (see GeoConstraint::reorder_longitude_map()) and the data values match.
Definition at line 417 of file GeoConstraint.cc. References Array::add_constraint(), Vector::buf2val(), DBG, DBG2, get_dataset(), get_lon_length(), get_longitude_index_left(), get_longitude_index_right(), get_longitude_rightmost(), Array::print_val(), BaseType::read(), Vector::set_read_p(), Vector::var(), and BaseType::width(). Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
Here is the call graph for this function:
|
Reorder the elements in the longitude map so that the longitude constraint no longer crosses the edge of the map's storage. The d_lon field is modified.
Definition at line 377 of file GeoConstraint.cc. Referenced by GridGeoConstraint::apply_constraint_to_data(). |
|
Set the bounding box for this constraint. After calling this method the object has values for the indexes for the latitude and longitude extent as well as the sense of the latitude (south pole at the top or bottom of the Array or Grid). These are used by the apply_constraint_to_data() method to actually constrain the data.
Definition at line 560 of file GeoConstraint.cc. References categorize_latitude(), categorize_notation(), DBG, double_to_string(), find_latitude_indeces(), find_longitude_indeces(), is_bounding_box_valid(), Notation, transform_constraint_to_pos_notation(), and transform_longitude_to_pos_notation(). Referenced by libdap::function_geoarray(), and libdap::function_geogrid(). |
Here is the call graph for this function:
|
Definition at line 246 of file GeoConstraint.h. |
|
Definition at line 284 of file GeoConstraint.h. |
|
Definition at line 263 of file GeoConstraint.h. |
|
Definition at line 302 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 298 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 349 of file GeoConstraint.h. |
|
Definition at line 250 of file GeoConstraint.h. |
|
Definition at line 280 of file GeoConstraint.h. |
|
Definition at line 267 of file GeoConstraint.h. |
|
Definition at line 315 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 319 of file GeoConstraint.h. Referenced by GridGeoConstraint::apply_constraint_to_data(), and ArrayGeoConstraint::apply_constraint_to_data(). |
|
Definition at line 345 of file GeoConstraint.h. |
|
Definition at line 332 of file GeoConstraint.h. |
|
Definition at line 139 of file GeoConstraint.cc. Referenced by set_bounding_box(). |
|
Given that the Grid has a longitude map that uses the 'pos' notation, transform it to the 'neg_pos' notation. This method modifies the d_longitude Array. Definition at line 163 of file GeoConstraint.cc. Referenced by GridGeoConstraint::apply_constraint_to_data(). |
|
Given that the Grid has a longitude map that uses the 'neg_pos' notation, transform it to the 'pos' notation. This method modifies the d_longitude Array. Definition at line 151 of file GeoConstraint.cc. Referenced by set_bounding_box(). |
|
Reimplemented in GridGeoConstraint. Definition at line 206 of file GeoConstraint.h. |