cellbox
Outlined in this section we will discuss the usage of the CellBox functionality of the meshiphi package. In this series of class distributions we house our discrete representation of input data. In each CellBox, we represent a way of accessing the information governing our numerical world, this includes and is not limited to: Ocean Currents, Sea Ice Concentration and Bathymetric depth.
Example:
An example of running this code can be executed by running the following in a ipython/Jupyter Notebook::
from meshiphi.mesh_generation.cellbox import cellbox
....
Note:
CellBoxes are intended to be constructed by and used within a Mesh object.
The methods provided are to extract information for CellBoxes contained within a Mesh.
CellBox(bounds, id)
¶
A CellBox represnts a geo-spatial/temporal boundary that enables projecting to information within. Information about any given value of a CellBox is calculated from aggregating all data points of within those bounds. CellBoxes may be split into smaller CellBoxes and the data points within distributed between the newly created CellBoxes so as to construct a non-uniform mesh of CellBoxes, such as within a Mesh.
Attributes:
| Name | Type | Description |
|---|---|---|
Bounds |
Boundary
|
object that contains the latitude and logtitute range and the time range |
id |
int
|
the id of the cellbox |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bounds
|
Boundary
|
encapsulates latitude, longtitude and time range of the CellBox |
required |
id
|
int
|
the id of the cellbox |
required |
aggregate()
¶
aggregates CellBox data using the associated data_sources' aggregate type (ex. MEAN, MAX) and returns AggregatedCellBox object
Returns:
| Name | Type | Description |
|---|---|---|
AggregatedCellbox |
object contains the aggregated data within cellbox bounds. |
check_vector_data(source, loader, agg_value, data_name)
¶
method that checks if the vector data is None and calls the parent get value
create_splitted_cell_boxes(index)
¶
method that creates 4 splitted cellbox
deallocate_cellbox()
¶
Method to free up the memory space allocated by the cellbox
get_bounds()
¶
get the spatial and temporal bounds (lat range, long range and time range) of this cellbox
get_data_source()
¶
a method that gets the data source of the cellbox
(the data loaders, splitting conditions and aggregation type)
returns:
data_source (List
get_id()
¶
method returns cellbox cell id
get_minimum_datapoints()
¶
get the minimum number of data contained within CellBox boundaries
get_parent()
¶
get the parent CellBox, which is the bigger CellBox that conains this CellBox
get_split_depth()
¶
get the split depth of a CellBox, which represents is the number of times the CellBox has been split to reach it's current size.
set_bounds(bounds)
¶
Set the boundary of this cellbox
set_data_source(data_source)
¶
a method that sets the data source of the cellbox ( which includes the data loaders, splitting conditions and aggregation type)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_source
|
List <MetaData>
|
a list of MetaData objects, each object represents a source of this CellBox data (where the data comes from, how it is spitted and aggregated) |
required |
set_id(id)
¶
method ssts cellbox id
set_minimum_datapoints(minimum_datapoints)
¶
set the minimum number of data contained within CellBox boundaries
set_parent(parent)
¶
set the parent CellBox, which is the bigger CellBox that conains this CellBox Args: CellBox: the bigger Cellbox object that got splitted to produce this cellbox
set_split_depth(split_depth)
¶
set the split depth of a CellBox, which represents is the number of times the CellBox has been split to reach it's current size.
should_split(stop_index)
¶
determines if a cellbox should be split based on the homogeneity condition of each data type contained within. The homogeneity condition of values within this cellbox is calculated using the method 'get_hom_cond' in each DataLoader object inside CellBox's metadata
if ANY data returns 'HOM': do not split if ANY data returns 'MIN': do not split if ALL data returns 'CLR': do not split else (mixture of CLR & HET): split
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stop_index
|
the index of the data source at which checking the splitting conditions stops. |
required |
Returns: bool: True if the splitting_conditions of this CellBox will result in the CellBox being split.
should_split_breadth_first()
¶
determines if a cellbox should be split based on the homogeneity condition of each data type contained within. The homogeneity condition of values within this cellbox is calculated using the method 'get_hom_cond' in each DataLoader object inside CellBox's metadata
if ANY data returns 'HOM': do not split if ANY data returns 'MIN': do not split if ALL data returns 'CLR': do not split else (mixture of CLR & HET): split
Returns:
| Name | Type | Description |
|---|---|---|
should_split |
bool
|
True if the splitting_conditions of this CellBox will result in the CellBox being split. |
split(start_id)
¶
splits the current cellbox into 4 corners, returns as a list of cellbox objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_id
|
represenst the start of the splitted cellboxes ids, usuallly it is the number of the existing cellboxes |
required |
Returns:
list