Skip to content

utils

calculate_md5(filename)

create md5sum checksum for any file

check_mesh_data(mesh)

Check a mesh object for missing data sources.

Parameters:

Name Type Description Default
mesh Mesh

mesh object to evaluate.

required

Returns:

Type Description
str

A user-friendly warning message as a string.

evaluate_route(route_json, mesh)

Run calculate_route method from PolarRoute to evaluate the fuel usage and travel time of a route.

Parameters:

Name Type Description Default
route_json dict

route to evaluate in geojson format.

required
mesh Mesh

mesh object on which to evaluate the route.

required

Returns:

Name Type Description
dict dict

evaluated route

route_exists(meshes, start_lat, start_lon, end_lat, end_lon)

Check if a route of given parameters has already been calculated. Works through list of meshes in order, returns first matching route Return None if not and the route object if it has.

select_mesh(start_lat, start_lon, end_lat, end_lon)

Find the most suitable mesh from the database for a given set of start and end coordinates. Returns either a list of Mesh objects or None.

select_mesh_for_route_evaluation(route)

Select a mesh from the database to be used for route evaluation. The latest mesh containing all points in the route will be chosen. If no suitable meshes are available, return None.

Parameters:

Name Type Description Default
route dict

GeoJSON route to be evaluated.

required

Returns:

Type Description
Union[list[Mesh], None]

Union[Mesh,None]: Selected mesh object or None.