Skip to content

mesh_validator

MeshValidator(mesh_config_file)

a class that validates a constructed mesh against its actual sourced geo-spatial data. Validation takes place by comparing the aggregated data value of mesh's cellbox against the actual data contained within cellbox's bounds. Attributes: conf (dict): conatins the initial config used to build the mesh under vlaidation validation_length (float): the legnth of the validation square used for each sample, all the data_points contained within this square wil be validated. Higher values would incur higher processing cost mesh (Mesh): object that represents the constructed mesh (a representation before aggregating cellbox data, used to have access to the mesh data source to validate against the actual data) env_mesh (EnvironmentMesh): objects that represents the constructed env mesh (a representation after aggregating the mesh cellboox data)

Parameters:

Name Type Description Default
mesh_config_file String

the path to the config file used to build the mesh under validation

required

get_range_end(sample)

calculates the range end of the provided sample lat and long, claculation is based on the specified validation_length Args: sample (float[]): a decimal array contains the sampled lat and long values Returns: float[]: lat and long range end

get_value_from_data(sample)

gets the actual data within the provided sample lat and long Args: sample (float[]): a decimal array contains the sampled lat and long values Returns: a numpy array that contains all the data within the sampled lat and long range

get_values_from_mesh(sample)

finds the mesh's cellboxes that contains the sample's lat and long then returns the aggregated values within. Args: sample (float[]): a decimal array contains the sampled lat and long values Returns: a numpy array that contains the mesh's data within the sampled lat and long range

validate_mesh(number_of_samples=10)

samples the mesh's lat and long space and compares the actual data within the sampled's range to the mesh agg_value then calculates the RMSE.

Args: number_of_samples (int): the number of samples used to validate the mesh Returns: distance (float): the RMSE between the actaul data value and the mesh's agg_value.