#include <ArrayGeoConstraint.h>
Classes | |
struct | Extent |
struct | Projection |
Public Types | |
Public Member Functions | |
virtual void | apply_constraint_to_data () |
virtual Array * | get_constrained_array () const |
void | set_bounding_box (double left, double top, double right, double bottom) |
virtual | ~ArrayGeoConstraint () |
Constructors | |
ArrayGeoConstraint (Array *array, const string &ds_name, double left, double top, double right, double bottom, const string &projection, const string &datum) | |
ArrayGeoConstraint (Array *array, const string &ds_name, double left, double top, double right, double bottom) | |
ArrayGeoConstraint (Array *, const string &ds_name) | |
Accessors/Mutators | |
char * | get_array_data () const |
int | get_array_data_size () const |
bool | get_bounding_box_set () const |
set< string > | get_coards_lat_units () const |
set< string > | get_coards_lon_units () const |
string | get_dataset () const |
double * | get_lat () const |
Array::Dim_iter | get_lat_dim () const |
int | get_lat_length () const |
set< string > | get_lat_names () const |
int | get_latitude_index_bottom () const |
int | get_latitude_index_top () const |
LatitudeSense | get_latitude_sense () const |
double * | get_lon () const |
Array::Dim_iter | get_lon_dim () const |
int | get_lon_length () const |
set< string > | get_lon_names () const |
int | get_longitude_index_left () const |
int | get_longitude_index_right () const |
Notation | get_longitude_notation () const |
bool | get_longitude_rightmost () const |
void | set_lat (double *lat) |
void | set_lat_dim (Array::Dim_iter lat) |
void | set_lat_length (int len) |
void | set_latitude_index_bottom (int bottom) |
void | set_latitude_index_top (int top) |
void | set_latitude_sense (LatitudeSense l) |
void | set_lon (double *lon) |
void | set_lon_dim (Array::Dim_iter lon) |
void | set_lon_length (int len) |
void | set_longitude_index_left (int left) |
void | set_longitude_index_right (int right) |
void | set_longitude_notation (Notation n) |
void | set_longitude_rightmost (bool state) |
Protected Member Functions | |
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 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 | ArrayGeoConstraintTest |
class | GridGeoConstraintTest |
Definition at line 55 of file ArrayGeoConstraint.h.
enum libdap::GeoConstraint::LatitudeSense [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.
Definition at line 118 of file GeoConstraint.h.
enum libdap::GeoConstraint::Notation [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'.
Definition at line 109 of file GeoConstraint.h.
libdap::ArrayGeoConstraint::ArrayGeoConstraint | ( | Array * | , | |
const string & | ds_name | |||
) | [inline] |
Definition at line 110 of file ArrayGeoConstraint.h.
libdap::ArrayGeoConstraint::ArrayGeoConstraint | ( | Array * | array, | |
const string & | ds_name, | |||
double | left, | |||
double | top, | |||
double | right, | |||
double | bottom | |||
) |
Definition at line 63 of file ArrayGeoConstraint.cc.
libdap::ArrayGeoConstraint::ArrayGeoConstraint | ( | Array * | array, | |
const string & | ds_name, | |||
double | left, | |||
double | top, | |||
double | right, | |||
double | bottom, | |||
const string & | projection, | |||
const string & | datum | |||
) |
Definition at line 72 of file ArrayGeoConstraint.cc.
virtual libdap::ArrayGeoConstraint::~ArrayGeoConstraint | ( | ) | [inline, virtual] |
Definition at line 125 of file ArrayGeoConstraint.h.
void libdap::ArrayGeoConstraint::apply_constraint_to_data | ( | ) | [virtual] |
Once the bounding box is set, apply the constraint. If the data can be sent using Vector::serialize(), do so. If they cannot, read and organize the data so that Vector::serialize() will be able to send the data when asked to.
How can it be that Vector::serialize() would not be able to read the data? If the longitude extent of the bounding box for the constraint wraps around the edge of the data/array, then two reads are required to get the data. This method performs those reads (using the constraints and the read() method so that the data server's type-specific and optimized code will be used to read actual data values) and then loads the combined result back into the object, marking it as having been read. Vector::serialize() will then see the object is loaded with data values, skip the regular read call and send all the data in the buffer.
Implements libdap::GeoConstraint.
Definition at line 148 of file ArrayGeoConstraint.cc.
References libdap::Array::add_constraint(), libdap::GeoConstraint::get_array_data(), libdap::GeoConstraint::get_array_data_size(), libdap::GeoConstraint::get_bounding_box_set(), libdap::GeoConstraint::get_dataset(), 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_dim(), libdap::GeoConstraint::get_lon_length(), libdap::GeoConstraint::get_longitude_index_left(), libdap::GeoConstraint::get_longitude_index_right(), libdap::GeoConstraint::inverted, libdap::BaseType::read(), libdap::GeoConstraint::reorder_data_longitude_axis(), 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::Vector::set_read_p(), and libdap::Vector::val2buf().
Referenced by libdap::function_geoarray().
GeoConstraint::LatitudeSense libdap::GeoConstraint::categorize_latitude | ( | ) | const [protected, virtual, inherited] |
Take a look at the latitude vector values and record whether the world is normal or upside down.
Definition at line 334 of file GeoConstraint.cc.
References libdap::GeoConstraint::inverted, and libdap::GeoConstraint::normal.
Referenced by libdap::GeoConstraint::set_bounding_box().
GeoConstraint::Notation libdap::GeoConstraint::categorize_notation | ( | double | left, | |
double | right | |||
) | const [protected, inherited] |
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.
left | The left side of the bounding box, in degrees | |
right | The right side of the boubding box |
Definition at line 128 of file GeoConstraint.cc.
References libdap::GeoConstraint::neg_pos, and libdap::GeoConstraint::pos.
Referenced by libdap::GeoConstraint::set_bounding_box().
void libdap::GeoConstraint::find_latitude_indeces | ( | double | top, | |
double | bottom, | |||
LatitudeSense | sense, | |||
int & | latitude_index_top, | |||
int & | latitude_index_bottom | |||
) | const [protected, inherited] |
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 291 of file GeoConstraint.cc.
References libdap::GeoConstraint::normal.
Referenced by libdap::GeoConstraint::set_bounding_box().
void libdap::GeoConstraint::find_longitude_indeces | ( | double | left, | |
double | right, | |||
int & | longitude_index_left, | |||
int & | longitude_index_right | |||
) | const [protected, inherited] |
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 201 of file GeoConstraint.cc.
References DBG2.
Referenced by libdap::GeoConstraint::set_bounding_box().
char* libdap::GeoConstraint::get_array_data | ( | ) | const [inline, inherited] |
Definition at line 232 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
int libdap::GeoConstraint::get_array_data_size | ( | ) | const [inline, inherited] |
Definition at line 236 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
bool libdap::GeoConstraint::get_bounding_box_set | ( | ) | const [inline, inherited] |
Definition at line 327 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
set<string> libdap::GeoConstraint::get_coards_lat_units | ( | ) | const [inline, inherited] |
Definition at line 357 of file GeoConstraint.h.
set<string> libdap::GeoConstraint::get_coards_lon_units | ( | ) | const [inline, inherited] |
Definition at line 361 of file GeoConstraint.h.
virtual Array* libdap::ArrayGeoConstraint::get_constrained_array | ( | ) | const [inline, virtual] |
string libdap::GeoConstraint::get_dataset | ( | ) | const [inline, inherited] |
Definition at line 226 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), apply_constraint_to_data(), and libdap::GeoConstraint::reorder_data_longitude_axis().
double* libdap::GeoConstraint::get_lat | ( | ) | const [inline, inherited] |
Definition at line 241 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data().
Array::Dim_iter libdap::GeoConstraint::get_lat_dim | ( | ) | const [inline, inherited] |
Definition at line 279 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
int libdap::GeoConstraint::get_lat_length | ( | ) | const [inline, inherited] |
Definition at line 258 of file GeoConstraint.h.
set<string> libdap::GeoConstraint::get_lat_names | ( | ) | const [inline, inherited] |
Definition at line 366 of file GeoConstraint.h.
int libdap::GeoConstraint::get_latitude_index_bottom | ( | ) | const [inline, inherited] |
Definition at line 297 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
int libdap::GeoConstraint::get_latitude_index_top | ( | ) | const [inline, inherited] |
Definition at line 293 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
LatitudeSense libdap::GeoConstraint::get_latitude_sense | ( | ) | const [inline, inherited] |
Definition at line 344 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
double* libdap::GeoConstraint::get_lon | ( | ) | const [inline, inherited] |
Definition at line 245 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data().
Array::Dim_iter libdap::GeoConstraint::get_lon_dim | ( | ) | const [inline, inherited] |
Definition at line 275 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
int libdap::GeoConstraint::get_lon_length | ( | ) | const [inline, inherited] |
Definition at line 262 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), apply_constraint_to_data(), and libdap::GeoConstraint::reorder_data_longitude_axis().
set<string> libdap::GeoConstraint::get_lon_names | ( | ) | const [inline, inherited] |
Definition at line 370 of file GeoConstraint.h.
int libdap::GeoConstraint::get_longitude_index_left | ( | ) | const [inline, inherited] |
Definition at line 310 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), apply_constraint_to_data(), and libdap::GeoConstraint::reorder_data_longitude_axis().
int libdap::GeoConstraint::get_longitude_index_right | ( | ) | const [inline, inherited] |
Definition at line 314 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), apply_constraint_to_data(), and libdap::GeoConstraint::reorder_data_longitude_axis().
Notation libdap::GeoConstraint::get_longitude_notation | ( | ) | const [inline, inherited] |
Definition at line 340 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data().
bool libdap::GeoConstraint::get_longitude_rightmost | ( | ) | const [inline, inherited] |
Definition at line 331 of file GeoConstraint.h.
Referenced by libdap::GeoConstraint::reorder_data_longitude_axis().
bool libdap::GeoConstraint::is_bounding_box_valid | ( | double | left, | |
double | top, | |||
double | right, | |||
double | bottom | |||
) | const [protected, virtual, inherited] |
Definition at line 169 of file GeoConstraint.cc.
References libdap::GeoConstraint::normal.
Referenced by libdap::GeoConstraint::set_bounding_box().
void libdap::GeoConstraint::reorder_data_longitude_axis | ( | Array & | a | ) | [protected, virtual, inherited] |
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.
First set all the other constraints, including the latitude and then make this call. Other constraints, besides latitude, will be simple range constraints. Latitude might require that values be inverted, but that can be done _after_ the longitude reordering takes place. The latitude constraint can be imposed by inverting the top and bottom indices if the sense of the grid is inverted, before data are read in this method. Then apply the longitude constraint, then invert the result of the merge, if needed.
Definition at line 419 of file GeoConstraint.cc.
References libdap::Array::add_constraint(), libdap::Vector::buf2val(), DBG, DBG2, libdap::GeoConstraint::get_dataset(), libdap::GeoConstraint::get_lon_length(), libdap::GeoConstraint::get_longitude_index_left(), libdap::GeoConstraint::get_longitude_index_right(), libdap::GeoConstraint::get_longitude_rightmost(), libdap::Vector::length(), libdap::Array::print_val(), libdap::BaseType::read(), libdap::Vector::set_read_p(), libdap::Vector::value(), libdap::Vector::var(), and libdap::BaseType::width().
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
void libdap::GeoConstraint::reorder_longitude_map | ( | int | longitude_index_left | ) | [protected, virtual, inherited] |
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 379 of file GeoConstraint.cc.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data().
void libdap::GeoConstraint::set_bounding_box | ( | double | left, | |
double | top, | |||
double | right, | |||
double | bottom | |||
) | [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 567 of file GeoConstraint.cc.
References libdap::GeoConstraint::categorize_latitude(), libdap::GeoConstraint::categorize_notation(), DBG, libdap::double_to_string(), libdap::GeoConstraint::find_latitude_indeces(), libdap::GeoConstraint::find_longitude_indeces(), 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_geoarray(), and libdap::function_geogrid().
void libdap::GeoConstraint::set_lat | ( | double * | lat | ) | [inline, inherited] |
Definition at line 249 of file GeoConstraint.h.
void libdap::GeoConstraint::set_lat_dim | ( | Array::Dim_iter | lat | ) | [inline, inherited] |
Definition at line 287 of file GeoConstraint.h.
void libdap::GeoConstraint::set_lat_length | ( | int | len | ) | [inline, inherited] |
Definition at line 266 of file GeoConstraint.h.
void libdap::GeoConstraint::set_latitude_index_bottom | ( | int | bottom | ) | [inline, inherited] |
Definition at line 305 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
void libdap::GeoConstraint::set_latitude_index_top | ( | int | top | ) | [inline, inherited] |
Definition at line 301 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
void libdap::GeoConstraint::set_latitude_sense | ( | LatitudeSense | l | ) | [inline, inherited] |
Definition at line 352 of file GeoConstraint.h.
void libdap::GeoConstraint::set_lon | ( | double * | lon | ) | [inline, inherited] |
Definition at line 253 of file GeoConstraint.h.
void libdap::GeoConstraint::set_lon_dim | ( | Array::Dim_iter | lon | ) | [inline, inherited] |
Definition at line 283 of file GeoConstraint.h.
void libdap::GeoConstraint::set_lon_length | ( | int | len | ) | [inline, inherited] |
Definition at line 270 of file GeoConstraint.h.
void libdap::GeoConstraint::set_longitude_index_left | ( | int | left | ) | [inline, inherited] |
Definition at line 318 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
void libdap::GeoConstraint::set_longitude_index_right | ( | int | right | ) | [inline, inherited] |
Definition at line 322 of file GeoConstraint.h.
Referenced by libdap::GridGeoConstraint::apply_constraint_to_data(), and apply_constraint_to_data().
void libdap::GeoConstraint::set_longitude_notation | ( | Notation | n | ) | [inline, inherited] |
Definition at line 348 of file GeoConstraint.h.
void libdap::GeoConstraint::set_longitude_rightmost | ( | bool | state | ) | [inline, inherited] |
Definition at line 335 of file GeoConstraint.h.
void libdap::GeoConstraint::transform_constraint_to_pos_notation | ( | double & | left, | |
double & | right | |||
) | const [protected, inherited] |
Definition at line 139 of file GeoConstraint.cc.
Referenced by libdap::GeoConstraint::set_bounding_box().
void libdap::GeoConstraint::transform_longitude_to_neg_pos_notation | ( | ) | [protected, virtual, inherited] |
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 libdap::GridGeoConstraint::apply_constraint_to_data().
void libdap::GeoConstraint::transform_longitude_to_pos_notation | ( | ) | [protected, virtual, inherited] |
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 libdap::GeoConstraint::set_bounding_box().
friend class ArrayGeoConstraintTest [friend] |
Definition at line 105 of file ArrayGeoConstraint.h.
friend class GridGeoConstraintTest [friend, inherited] |