boundary
Boundary(lat_range, long_range, time_range=None)
¶
A Boundary is a class that defines the geo-spatial/temporal boundaries (longtitude, latitude and time).
Attributes:
| Name | Type | Description |
|---|---|---|
lat_range |
float[]
|
array contains the start and end of latitude range |
long_range |
float[]
|
array contains the start and end of longtitude range. In the case of constructing a global mesh, the longtitude range should be -180:180. |
time_range(string[]) |
float[]
|
array contains the start and end of time range |
Note
All geospatial boundaries are given in a 'EPSG:4326' projection
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lat_range
|
float[]
|
array contains the start and end of latitude range |
required |
long_range
|
float[]
|
array contains the start and end of longtitude range |
required |
time_range
|
Date[]
|
array contains the start and end of time range |
None
|
__eq__(other)
¶
Evaluates whether two Boundary objects have the same lat/long min/max, and start/end time
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Boundary
|
Boundary object being compared to |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
True if all boundary edges are equal |
calc_size()
¶
Calculate the great circle distance (in meters) between two points on the earth (specified in decimal degrees)
from_json(config)
classmethod
¶
constructs a boundary object from json input Args: config (json): json object that contains the boundary attributes
from_poly_string(poly_string)
classmethod
¶
Creates a Boundary object from a string representation of a polygon.
get_bounds()
¶
returns the bounds of this cellbox
Returns:
| Name | Type | Description |
|---|---|---|
bounds |
list<tuples>
|
The geo-spatial boundaries of this CellBox. |
get_height()
¶
returns height of the cellbox
Returns:
| Name | Type | Description |
|---|---|---|
height |
float
|
the height of the CellBox given in degrees latitude. |
get_lat_max()
¶
returns the max latitude
get_lat_min()
¶
returns the min latitude
get_long_max()
¶
returns the max longtitude
get_long_min()
¶
returns the min longtitude
get_time_max()
¶
returns the max of time range
get_time_min()
¶
returns the min of time range
get_time_range()
¶
returns the time range
get_width()
¶
returns width of the cellbox
Returns:
| Name | Type | Description |
|---|---|---|
width |
float
|
the width of the CellBox given in degrees longtitude. |
getcx()
¶
returns x-position of the centroid of the cellbox
Returns:
| Name | Type | Description |
|---|---|---|
cx |
float
|
the x-position of the top-left corner of the CellBox given in degrees longitude. |
getcy()
¶
returns y-position of the centroid of the cellbox
Returns:
| Name | Type | Description |
|---|---|---|
cy |
float
|
the y-position of the top-left corner of the CellBox given in degrees latitude. |
getdcx()
¶
returns x-distance from the edge to the centroid of the cellbox
Returns:
| Name | Type | Description |
|---|---|---|
dcx |
float
|
the x-distance from the edge of the CellBox to the centroid of the CellBox. Given in degrees longitude |
getdcy()
¶
returns y-distance from the edge to the centroid of the cellbox
Returns:
| Name | Type | Description |
|---|---|---|
dxy |
float
|
the y-distance from the edge of the CellBox to the centroid of the CellBox. Given in degrees latitude |
parse_datetime(datetime_str)
staticmethod
¶
Attempts to parse a string containing reference to system time into datetime format. If given the string 'TODAY', will return system time. special characters '+' and '-' can be used to adjust system time. e.g 'TODAY + 3' will return system time + 3 days, 'TODAY - 16' will return system time - 16 days
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
datetime_str
|
String
|
String attempted to be parsed to datetime format. Expected input format is '%Y-%m-%d', or 'TODAY +- n' |
required |
Returns: date (String): date in a String format, '%Y-%m-%d'. Raises: ValueError : If given 'datetime_str' cannot be parsed, raises ValueError.
split()
¶
Splits the boundary into four equal parts.
Returns:
| Type | Description |
|---|---|
list<Boundary>
|
List of four new boundaries, each representing a quarter of the original boundary. |
to_poly_string()
¶
Creates a string representation of the polygon from the extent of the boundary. Will be a rectangle in mercator projection.
Returns:
| Type | Description |
|---|---|
str
|
String representation of the shapely polygon with corners at the min/max lat/long values of this boundary |
to_polygon()
¶
Creates a shapely polygon from the extent of the boundary. Will be a rectangle in mercator projection.
Returns:
| Type | Description |
|---|---|
Polygon
|
Shapely polygon with corners at the min/max lat/long values of this boundary |
validate_bounds(lat_range, long_range, time_range)
¶
method to check the bounds are valid Args: lat_range (float[]): array contains the start and end of latitude range long_range (float[]): array contains the start and end of longtitude range time_range(Date[]): array contains the start and end of time range