OPeNDAP Hyrax Back End Server (BES)
Updated for version 3.8.3
|
Geographical constraint applied to a grid. More...
#include <GridGeoConstraint.h>
Public Types | |
enum | LatitudeSense { unknown_sense, normal, inverted } |
Most of the time, latitude starts at the top of an array with positive values and ends up at the bottom with negative ones. More... | |
enum | Notation { unknown_notation, pos, neg_pos } |
The longitude extents of the constraint bounding box can be expressed two ways: using a 0/359 notation and using a -180/179 notation. More... | |
Public Member Functions | |
virtual void | apply_constraint_to_data () |
Once the bounding box is set use this method to apply the constraint. More... | |
virtual Grid * | get_constrained_grid () const |
void | set_bounding_box (double top, double left, double bottom, double right) |
Set the bounding box for this constraint. More... | |
virtual | ~GridGeoConstraint () |
Constructors | |
GridGeoConstraint (Grid *grid) | |
Initialize GeoConstraint with a Grid. More... | |
GridGeoConstraint (Grid *grid, Array *lat, Array *lon) | |
Accessors/Mutators | |
char * | get_array_data () const |
int | get_array_data_size () const |
double * | get_lat () const |
double * | get_lon () const |
void | set_lat (double *lat) |
void | set_lon (double *lon) |
int | get_lat_length () const |
int | get_lon_length () const |
void | set_lat_length (int len) |
void | set_lon_length (int len) |
Array::Dim_iter | get_lon_dim () const |
Array::Dim_iter | get_lat_dim () const |
void | set_lon_dim (Array::Dim_iter lon) |
void | set_lat_dim (Array::Dim_iter lat) |
int | get_latitude_index_top () const |
int | get_latitude_index_bottom () const |
void | set_latitude_index_top (int top) |
void | set_latitude_index_bottom (int bottom) |
int | get_longitude_index_left () const |
int | get_longitude_index_right () const |
void | set_longitude_index_left (int left) |
void | set_longitude_index_right (int right) |
bool | is_bounding_box_set () const |
bool | is_longitude_rightmost () const |
void | set_longitude_rightmost (bool state) |
Notation | get_longitude_notation () const |
LatitudeSense | get_latitude_sense () const |
void | set_longitude_notation (Notation n) |
void | set_latitude_sense (LatitudeSense l) |
set< string > | get_coards_lat_units () const |
set< string > | get_coards_lon_units () const |
set< string > | get_lat_names () const |
set< string > | get_lon_names () const |
Protected Member Functions | |
virtual LatitudeSense | categorize_latitude () const |
Take a look at the latitude vector values and record whether the world is normal or upside down. More... | |
Notation | categorize_notation (const double left, const double right) const |
A private method that determines if the longitude part of the bounding box uses 0/359 or -180/179 notation. More... | |
void | find_latitude_indeces (double top, double bottom, LatitudeSense sense, int &latitude_index_top, int &latitude_index_bottom) const |
Scan from the top to the bottom, and the bottom to the top, looking for the top and bottom bounding box edges, respectively. More... | |
void | find_longitude_indeces (double left, double right, int &longitude_index_left, int &longitude_index_right) const |
Scan from the left to the right, and the right to the left, looking for the left and right bounding box edges, respectively. More... | |
virtual void | flip_latitude_within_array (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 void | reorder_data_longitude_axis (Array &a, Array::Dim_iter lon_dim) |
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. More... | |
virtual void | reorder_longitude_map (int longitude_index_left) |
Reorder the elements in the longitude map so that the longitude constraint no longer crosses the edge of the map's storage. More... | |
void | transform_constraint_to_pos_notation (double &left, double &right) const |
virtual void | transform_longitude_to_neg_pos_notation () |
Given that the Grid has a longitude map that uses the 'pos' notation, transform it to the 'neg_pos' notation. More... | |
virtual void | transform_longitude_to_pos_notation () |
Given that the Grid has a longitude map that uses the 'neg_pos' notation, transform it to the 'pos' notation. More... | |
virtual void | transpose_vector (double *src, const int length) |
Given a vector of doubles, transpose the elements. More... | |
Friends | |
class | GridGeoConstraintTest |
Geographical constraint applied to a grid.
Definition at line 48 of file GridGeoConstraint.h.
|
inherited |
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 110 of file GeoConstraint.h.
|
inherited |
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.
libdap::GridGeoConstraint::GridGeoConstraint | ( | Grid * | grid | ) |
Initialize GeoConstraint with a Grid.
grid | Set the GeoConstraint to use this Grid variable. It is the caller's responsibility to ensure that the value grid is a valid Grid variable. |
Definition at line 57 of file GridGeoConstraint.cc.
libdap::GridGeoConstraint::GridGeoConstraint | ( | Grid * | grid, |
Array * | lat, | ||
Array * | lon | ||
) |
Definition at line 73 of file GridGeoConstraint.cc.
|
inlinevirtual |
Definition at line 72 of file GridGeoConstraint.h.
|
virtual |
Once the bounding box is set use this method to apply the constraint.
This modifies the data values in the Grid so that the software in Vector::serialize() will work correctly. Vector::serialize() assumes that the BaseType::read() method is called after the projection is applied to the data. That is, the projection is applied, then data are read. but geogrid() first reads all the data values and then computes the projection. To make Vector::serialize() work, this method uses the projection information recorded in the Grid by set_bounding_box() to arrange data so that the information to be sent is all that is held by the Grid. Call this after applying any 'Grid selection expressions' of the sort that can be passed to the grid() function.
Implements libdap::GeoConstraint.
Definition at line 273 of file GridGeoConstraint.cc.
References libdap::GeoConstraint::flip_latitude_within_array(), libdap::GeoConstraint::get_array_data(), libdap::GeoConstraint::get_array_data_size(), libdap::GeoConstraint::get_lat(), libdap::GeoConstraint::get_lat_dim(), libdap::GeoConstraint::get_latitude_index_bottom(), libdap::GeoConstraint::get_latitude_index_top(), libdap::GeoConstraint::get_latitude_sense(), libdap::GeoConstraint::get_lon(), libdap::GeoConstraint::get_lon_dim(), libdap::GeoConstraint::get_lon_length(), libdap::GeoConstraint::get_longitude_index_left(), libdap::GeoConstraint::get_longitude_index_right(), libdap::GeoConstraint::get_longitude_notation(), libdap::GeoConstraint::inverted, libdap::GeoConstraint::is_bounding_box_set(), libdap::GeoConstraint::neg_pos, libdap::GeoConstraint::reorder_data_longitude_axis(), libdap::GeoConstraint::reorder_longitude_map(), libdap::GeoConstraint::set_latitude_index_bottom(), libdap::GeoConstraint::set_latitude_index_top(), libdap::GeoConstraint::set_longitude_index_left(), libdap::GeoConstraint::set_longitude_index_right(), libdap::GeoConstraint::transform_longitude_to_neg_pos_notation(), and libdap::GeoConstraint::transpose_vector().
Referenced by libdap::function_geogrid().
|
protectedvirtualinherited |
Take a look at the latitude vector values and record whether the world is normal or upside down.
Definition at line 331 of file GeoConstraint.cc.
Referenced by libdap::GeoConstraint::set_bounding_box().
|
protectedinherited |
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 105 of file GeoConstraint.cc.
Referenced by libdap::GeoConstraint::set_bounding_box().
|
protectedinherited |
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 280 of file GeoConstraint.cc.
Referenced by libdap::GeoConstraint::set_bounding_box().
|
protectedinherited |
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 202 of file GeoConstraint.cc.
Referenced by libdap::GeoConstraint::set_bounding_box().
|
protectedvirtualinherited |
Definition at line 390 of file GeoConstraint.cc.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 214 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 218 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 339 of file GeoConstraint.h.
|
inlineinherited |
Definition at line 343 of file GeoConstraint.h.
|
inlinevirtual |
Definition at line 77 of file GridGeoConstraint.h.
Referenced by libdap::function_geogrid().
|
inlineinherited |
Definition at line 223 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 261 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 240 of file GeoConstraint.h.
|
inlineinherited |
Definition at line 348 of file GeoConstraint.h.
|
inlineinherited |
Definition at line 279 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 275 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 326 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 227 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 257 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 244 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 352 of file GeoConstraint.h.
|
inlineinherited |
Definition at line 292 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 296 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 322 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 309 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
protectedvirtualinherited |
Definition at line 170 of file GeoConstraint.cc.
Referenced by libdap::GeoConstraint::set_bounding_box().
|
inlineinherited |
Definition at line 313 of file GeoConstraint.h.
|
protectedvirtualinherited |
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 473 of file GeoConstraint.cc.
Referenced by apply_constraint_to_data().
|
protectedvirtualinherited |
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 434 of file GeoConstraint.cc.
Referenced by apply_constraint_to_data().
|
inherited |
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 589 of file GeoConstraint.cc.
References libdap::GeoConstraint::categorize_latitude(), libdap::GeoConstraint::categorize_notation(), libdap::GeoConstraint::find_latitude_indeces(), libdap::GeoConstraint::find_longitude_indeces(), libdap::GeoConstraint::inverted, libdap::GeoConstraint::is_bounding_box_valid(), libdap::GeoConstraint::neg_pos, libdap::GeoConstraint::transform_constraint_to_pos_notation(), and libdap::GeoConstraint::transform_longitude_to_pos_notation().
Referenced by libdap::function_geogrid().
|
inlineinherited |
Definition at line 231 of file GeoConstraint.h.
|
inlineinherited |
Definition at line 269 of file GeoConstraint.h.
|
inlineinherited |
Definition at line 248 of file GeoConstraint.h.
|
inlineinherited |
Definition at line 287 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 283 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 334 of file GeoConstraint.h.
|
inlineinherited |
Definition at line 235 of file GeoConstraint.h.
|
inlineinherited |
Definition at line 265 of file GeoConstraint.h.
|
inlineinherited |
Definition at line 252 of file GeoConstraint.h.
|
inlineinherited |
Definition at line 300 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 304 of file GeoConstraint.h.
Referenced by apply_constraint_to_data().
|
inlineinherited |
Definition at line 330 of file GeoConstraint.h.
|
inlineinherited |
Definition at line 317 of file GeoConstraint.h.
|
protectedinherited |
Definition at line 126 of file GeoConstraint.cc.
Referenced by libdap::GeoConstraint::set_bounding_box().
|
protectedvirtualinherited |
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 163 of file GeoConstraint.cc.
Referenced by apply_constraint_to_data().
|
protectedvirtualinherited |
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 144 of file GeoConstraint.cc.
Referenced by libdap::GeoConstraint::set_bounding_box().
|
protectedvirtualinherited |
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 364 of file GeoConstraint.cc.
Referenced by apply_constraint_to_data().
|
friend |
Definition at line 63 of file GridGeoConstraint.h.