libdap Updated for version 3.21.1
libdap4 is an implementation of OPeNDAP's DAP protocol.
|
#include <GeoConstraint.h>
Public Types | |
enum | LatitudeSense { unknown_sense , normal , inverted } |
enum | Notation { unknown_notation , pos , neg_pos } |
Protected Member Functions | |
virtual bool | build_lat_lon_maps ()=0 |
virtual LatitudeSense | categorize_latitude () const |
Notation | categorize_notation (const double left, const 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 void | flip_latitude_within_array (libdap::Array &a, int lat_length, int lon_length) |
virtual bool | is_bounding_box_valid (const double left, const double top, const double right, const double bottom) const |
virtual bool | lat_lon_dimensions_ok ()=0 |
virtual void | reorder_data_longitude_axis (libdap::Array &a, libdap::Array::Dim_iter lon_dim) |
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 () |
virtual void | transpose_vector (double *src, const int length) |
Friends | |
class | GridGeoConstraintTest |
Encapsulate the logic needed to handle geographical constraints when they are applied to DAP Grid (and some Array) variables.
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 96 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.
Enumerator | |
---|---|
unknown_sense | |
normal | |
inverted |
Definition at line 106 of file GeoConstraint.h.
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'.
Enumerator | |
---|---|
unknown_notation | |
pos | |
neg_pos |
Definition at line 101 of file GeoConstraint.h.
functions::GeoConstraint::GeoConstraint | ( | ) |
Initialize GeoConstraint.
Definition at line 504 of file GeoConstraint.cc.
|
inlinevirtual |
Definition at line 192 of file GeoConstraint.h.
|
pure virtual |
Once the bounding box is set use this method to apply the constraint.
Implemented in functions::GridGeoConstraint.
|
protectedpure virtual |
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.
|
protectedvirtual |
Take a look at the latitude vector values and record whether the world is normal or upside down.
Definition at line 307 of file GeoConstraint.cc.
|
protected |
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 constraints which use 90/-90 notation, so there's no need to figure out what sort of notation they use.
left | The left side of the bounding box, in degrees |
right | The right side of the bounding box |
Definition at line 97 of file GeoConstraint.cc.
|
protected |
Scan from the top to the bottom, and the bottom to the top, looking for the top and bottom bounding box edges, respectively.
top | The top edge of the bounding box |
bottom | The bottom edge |
sense | Does the array/grid store data with larger latitudes at the starting indices or are the latitude 'upside down?' |
latitude_index_top | Value-result parameter that holds the index in the grid's latitude map of the top bounding box edge. Uses a closed interval for the test. |
latitude_index_bottom | Value-result parameter for the bottom edge index. |
Definition at line 261 of file GeoConstraint.cc.
|
protected |
Scan from the left to the right, and the right to the left, looking for the left and right bounding box edges, respectively.
left | The left edge of the bounding box |
right | The right edge |
longitude_index_left | Value-result parameter that holds the index in the grid's longitude map of the left bounding box edge. Uses a closed interval for the test. |
longitude_index_right | Value-result parameter for the right edge index. |
Definition at line 184 of file GeoConstraint.cc.
|
protectedvirtual |
Definition at line 358 of file GeoConstraint.cc.
|
inline |
Definition at line 204 of file GeoConstraint.h.
|
inline |
Definition at line 205 of file GeoConstraint.h.
|
inline |
Definition at line 242 of file GeoConstraint.h.
|
inline |
Definition at line 243 of file GeoConstraint.h.
|
inline |
Definition at line 207 of file GeoConstraint.h.
|
inline |
Definition at line 218 of file GeoConstraint.h.
|
inline |
Definition at line 212 of file GeoConstraint.h.
|
inline |
Definition at line 245 of file GeoConstraint.h.
|
inline |
Definition at line 224 of file GeoConstraint.h.
|
inline |
Definition at line 223 of file GeoConstraint.h.
|
inline |
Definition at line 238 of file GeoConstraint.h.
|
inline |
Definition at line 208 of file GeoConstraint.h.
|
inline |
Definition at line 217 of file GeoConstraint.h.
|
inline |
Definition at line 213 of file GeoConstraint.h.
|
inline |
Definition at line 246 of file GeoConstraint.h.
|
inline |
Definition at line 228 of file GeoConstraint.h.
|
inline |
Definition at line 229 of file GeoConstraint.h.
|
inline |
Definition at line 237 of file GeoConstraint.h.
|
inline |
Definition at line 233 of file GeoConstraint.h.
|
protectedvirtual |
Definition at line 155 of file GeoConstraint.cc.
|
inline |
Definition at line 234 of file GeoConstraint.h.
|
protectedpure virtual |
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.
|
protectedvirtual |
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 434 of file GeoConstraint.cc.
|
protectedvirtual |
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.
longitude_index_left | The left edge of the bounding box. |
Definition at line 399 of file GeoConstraint.cc.
void functions::GeoConstraint::set_bounding_box | ( | double | top, |
double | left, | ||
double | bottom, | ||
double | right ) |
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.
left | The left side of the bounding box. |
right | The right side |
top | The top |
bottom | The bottom |
Definition at line 541 of file GeoConstraint.cc.
|
inline |
Definition at line 209 of file GeoConstraint.h.
|
inline |
Definition at line 220 of file GeoConstraint.h.
|
inline |
Definition at line 214 of file GeoConstraint.h.
|
inline |
Definition at line 226 of file GeoConstraint.h.
|
inline |
Definition at line 225 of file GeoConstraint.h.
|
inline |
Definition at line 240 of file GeoConstraint.h.
|
inline |
Definition at line 210 of file GeoConstraint.h.
|
inline |
Definition at line 219 of file GeoConstraint.h.
|
inline |
Definition at line 215 of file GeoConstraint.h.
|
inline |
Definition at line 230 of file GeoConstraint.h.
|
inline |
Definition at line 231 of file GeoConstraint.h.
|
inline |
Definition at line 239 of file GeoConstraint.h.
|
inline |
Definition at line 235 of file GeoConstraint.h.
|
protected |
Definition at line 115 of file GeoConstraint.cc.
|
protectedvirtual |
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_lon array.
Definition at line 149 of file GeoConstraint.cc.
|
protectedvirtual |
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_lon array.
Definition at line 131 of file GeoConstraint.cc.
|
protectedvirtual |
Given a vector of doubles, transpose the elements. Use this to flip the latitude vector for a Grid that stores the southern latitudes at the top instead of the bottom.
src | A pointer to the vector |
length | The number of elements in the vector |
Definition at line 335 of file GeoConstraint.cc.
|
friend |
Definition at line 184 of file GeoConstraint.h.