WeatherRoutingTool package
Subpackages
- WeatherRoutingTool.algorithms package
- Submodules
- WeatherRoutingTool.algorithms.data_utils module
- WeatherRoutingTool.algorithms.genetic module
Genetic
Genetic.check_destination()
Genetic.check_positive_power()
Genetic.default_map
Genetic.execute_routing()
Genetic.fig
Genetic.n_offsprings
Genetic.optimize()
Genetic.path_to_route_folder
Genetic.plot_convergence()
Genetic.plot_population_per_generation()
Genetic.plot_running_metric()
Genetic.pop_size
Genetic.print_current_status()
Genetic.print_init()
Genetic.terminate()
Genetic.weather_path
- WeatherRoutingTool.algorithms.genetic_utils module
- WeatherRoutingTool.algorithms.isobased module
IsoBased
IsoBased.absolutefuel_per_step
IsoBased.branch_based_pruning()
IsoBased.check_bearing()
IsoBased.check_constraints()
IsoBased.check_course_def()
IsoBased.check_destination()
IsoBased.check_for_positive_constraints()
IsoBased.check_positive_power()
IsoBased.check_settings()
IsoBased.check_status()
IsoBased.count
IsoBased.course_increments_deg
IsoBased.course_per_step
IsoBased.course_segments
IsoBased.courses_based_pruning()
IsoBased.current_course
IsoBased.current_number_of_routes
IsoBased.current_position()
IsoBased.current_step_routes
IsoBased.define_courses()
IsoBased.define_courses_per_step()
IsoBased.define_initial_variants()
IsoBased.desired_number_of_routes
IsoBased.dist_per_step
IsoBased.execute_routing()
IsoBased.expand_axis_for_intermediate()
IsoBased.final_pruning()
IsoBased.find_every_route_reaching_destination()
IsoBased.find_routes_reaching_destination_in_current_step()
IsoBased.finish_temp
IsoBased.full_dist_traveled
IsoBased.full_time_traveled
IsoBased.gcr_course_temp
IsoBased.get_current_course()
IsoBased.get_current_lats()
IsoBased.get_current_lons()
IsoBased.get_current_speed()
IsoBased.get_delta_variables()
IsoBased.get_delta_variables_netCDF_last_step()
IsoBased.get_final_index()
IsoBased.get_pruned_indices_statistics()
IsoBased.get_wind_functions()
IsoBased.init_fig()
IsoBased.larger_direction_based_pruning()
IsoBased.lats_per_step
IsoBased.lons_per_step
IsoBased.make_route_object()
IsoBased.minimisation_criterion
IsoBased.move_boat_direct()
IsoBased.ncount
IsoBased.next_step_routes
IsoBased.plot_routes()
IsoBased.print_current_status()
IsoBased.print_init()
IsoBased.print_shape()
IsoBased.prune_groups
IsoBased.prune_sector_deg_half
IsoBased.prune_segments
IsoBased.prune_symmetry_axis
IsoBased.pruning()
IsoBased.pruning_error
IsoBased.pruning_gcr_centered()
IsoBased.pruning_headings_centered()
IsoBased.pruning_per_step()
IsoBased.revert_to_previous_step()
IsoBased.route_list
IsoBased.route_reached_destination
IsoBased.route_reached_waypoint
IsoBased.routes_from_previous_step()
IsoBased.set_course_segments()
IsoBased.set_minimisation_criterion()
IsoBased.set_next_step_routes()
IsoBased.set_pruning_settings()
IsoBased.shipparams_per_step
IsoBased.start_temp
IsoBased.starttime_per_step
IsoBased.terminate()
IsoBased.time
IsoBased.update_dist()
IsoBased.update_fig()
IsoBased.update_fuel()
IsoBased.update_position()
IsoBased.update_shipparams()
IsoBased.update_time()
- WeatherRoutingTool.algorithms.isochrone module
- WeatherRoutingTool.algorithms.isofuel module
- WeatherRoutingTool.algorithms.routingalg module
RoutingAlg
RoutingAlg.calculate_gcr()
RoutingAlg.check_destination()
RoutingAlg.check_for_positive_constraints()
RoutingAlg.check_positive_power()
RoutingAlg.departure_time
RoutingAlg.execute_routing()
RoutingAlg.fig
RoutingAlg.figure_path
RoutingAlg.finish
RoutingAlg.gcr_course
RoutingAlg.init_fig()
RoutingAlg.print_current_status()
RoutingAlg.print_init()
RoutingAlg.route_ensemble
RoutingAlg.start
RoutingAlg.terminate()
RoutingAlg.update_fig()
- WeatherRoutingTool.algorithms.routingalg_factory module
- Module contents
- WeatherRoutingTool.constraints package
- Submodules
- WeatherRoutingTool.constraints.constraints module
Constraint
ConstraintPars
ConstraintsList
ConstraintsList.add_neg_constraint()
ConstraintsList.add_pos_constraint()
ConstraintsList.check_weather()
ConstraintsList.constraints_crossed
ConstraintsList.current_positive
ConstraintsList.get_current_destination()
ConstraintsList.get_current_start()
ConstraintsList.have_negative()
ConstraintsList.have_positive()
ConstraintsList.init_positive_lists()
ConstraintsList.neg_cont_size
ConstraintsList.neg_dis_size
ConstraintsList.negative_constraints_continuous
ConstraintsList.negative_constraints_discrete
ConstraintsList.pars
ConstraintsList.pos_size
ConstraintsList.positive_constraints
ConstraintsList.positive_point_dict
ConstraintsList.print_active_constraints()
ConstraintsList.print_constraints_crossed()
ConstraintsList.print_settings()
ConstraintsList.reached_positive()
ConstraintsList.safe_crossing()
ConstraintsList.safe_crossing_continuous()
ConstraintsList.safe_crossing_discrete()
ConstraintsList.safe_endpoint()
ConstraintsList.shall_I_pass()
ConstraintsList.split_route()
ConstraintsList.weather
ConstraintsListFactory
ContinuousCheck
LandCrossing
LandPolygonsCrossing
NegativeConstraintFromWeather
NegativeContraint
PositiveConstraint
PositiveConstraintPoint
RunTestContinuousChecks
SeamarkCrossing
SeamarkCrossing.build_seamark_query()
SeamarkCrossing.check_crossing()
SeamarkCrossing.concat_nodes_ways()
SeamarkCrossing.concat_tree
SeamarkCrossing.database
SeamarkCrossing.host
SeamarkCrossing.password
SeamarkCrossing.port
SeamarkCrossing.predicates
SeamarkCrossing.query_nodes()
SeamarkCrossing.query_ways()
SeamarkCrossing.set_STRTree()
SeamarkCrossing.tags
SeamarkCrossing.user
StatusCodeError
StayOnMap
WaterDepth
WaterDepth.check_depth()
WaterDepth.constraint_on_point()
WaterDepth.current_depth
WaterDepth.depth_data
WaterDepth.get_current_depth()
WaterDepth.load_data_ODC()
WaterDepth.load_data_automatic()
WaterDepth.load_data_from_file()
WaterDepth.map_size
WaterDepth.min_depth
WaterDepth.plot_constraint()
WaterDepth.plot_depth_map_from_file()
WaterDepth.print_info()
WaterDepth.set_draught()
WaveHeight
- WeatherRoutingTool.constraints.route_postprocessing module
RoutePostprocessing
RoutePostprocessing.boat
RoutePostprocessing.calculate_angle_from_slope()
RoutePostprocessing.calculate_angle_of_current_crossing()
RoutePostprocessing.calculate_slope()
RoutePostprocessing.calculate_timsestamp()
RoutePostprocessing.check_valid_crossing()
RoutePostprocessing.connect_database()
RoutePostprocessing.connect_route_segments()
RoutePostprocessing.create_first_connecting_seg()
RoutePostprocessing.create_first_connecting_seg_from_node()
RoutePostprocessing.create_last_connecting_line()
RoutePostprocessing.create_last_connecting_line_from_node()
RoutePostprocessing.create_route_segments()
RoutePostprocessing.find_first_node_of_route_seg()
RoutePostprocessing.find_last_node_of_route_seg()
RoutePostprocessing.find_point_from_perpendicular_angle()
RoutePostprocessing.find_seamark_intersections()
RoutePostprocessing.find_seperation_lane_to_follow()
RoutePostprocessing.get_route_bbox()
RoutePostprocessing.is_start_or_finish_node_in_separation_zone()
RoutePostprocessing.lats_per_step
RoutePostprocessing.lons_per_step
RoutePostprocessing.post_process_route()
RoutePostprocessing.query_data()
RoutePostprocessing.recalculate_starttime_per_node()
RoutePostprocessing.retrieve_seamark_data()
RoutePostprocessing.retrieve_seperation_lane_data()
RoutePostprocessing.route
RoutePostprocessing.set_data()
RoutePostprocessing.ship_speed
RoutePostprocessing.starttime_per_step
RoutePostprocessing.terminate()
- Module contents
- WeatherRoutingTool.ship package
- Submodules
- WeatherRoutingTool.ship.ship module
- WeatherRoutingTool.ship.ship_factory module
- WeatherRoutingTool.ship.shipparams module
ShipParams
ShipParams.air_temperature
ShipParams.define_courses()
ShipParams.expand_axis_for_intermediate()
ShipParams.flip()
ShipParams.fuel_rate
ShipParams.fuel_type
ShipParams.get_air_temperature()
ShipParams.get_element()
ShipParams.get_fuel_rate()
ShipParams.get_fuel_type()
ShipParams.get_message()
ShipParams.get_power()
ShipParams.get_pressure()
ShipParams.get_rcalm()
ShipParams.get_reduced_2D_object()
ShipParams.get_rpm()
ShipParams.get_rroughness()
ShipParams.get_rshallow()
ShipParams.get_rwaves()
ShipParams.get_rwind()
ShipParams.get_salinity()
ShipParams.get_single_object()
ShipParams.get_speed()
ShipParams.get_status()
ShipParams.get_u_currents()
ShipParams.get_u_wind_speed()
ShipParams.get_v_currents()
ShipParams.get_v_wind_speed()
ShipParams.get_water_temperature()
ShipParams.get_wave_direction()
ShipParams.get_wave_height()
ShipParams.get_wave_period()
ShipParams.message
ShipParams.power
ShipParams.pressure
ShipParams.print()
ShipParams.print_shape()
ShipParams.r_calm
ShipParams.r_roughness
ShipParams.r_shallow
ShipParams.r_waves
ShipParams.r_wind
ShipParams.rpm
ShipParams.salinity
ShipParams.select()
ShipParams.set_air_temperature()
ShipParams.set_default_array()
ShipParams.set_default_array_1D()
ShipParams.set_fuel_rate()
ShipParams.set_message()
ShipParams.set_power()
ShipParams.set_pressure()
ShipParams.set_rcalm()
ShipParams.set_rpm()
ShipParams.set_rroughness()
ShipParams.set_rshallow()
ShipParams.set_rwaves()
ShipParams.set_rwind()
ShipParams.set_salinity()
ShipParams.set_speed()
ShipParams.set_status()
ShipParams.set_u_currents()
ShipParams.set_u_wind_speed()
ShipParams.set_v_currents()
ShipParams.set_v_wind_speed()
ShipParams.set_water_temperature()
ShipParams.set_wave_direction()
ShipParams.set_wave_height()
ShipParams.set_wave_period()
ShipParams.speed
ShipParams.status
ShipParams.u_currents
ShipParams.u_wind_speed
ShipParams.v_currents
ShipParams.v_wind_speed
ShipParams.water_temperature
ShipParams.wave_direction
ShipParams.wave_height
ShipParams.wave_period
- Module contents
- WeatherRoutingTool.utils package
- Submodules
- WeatherRoutingTool.utils.formatting module
- WeatherRoutingTool.utils.graphics module
create_map()
create_maps()
generate_basemap()
get_accumulated_dist()
get_colour()
get_figure_path()
get_gcr_points()
get_hist_values_from_boundaries()
get_hist_values_from_widths()
get_marker()
get_standard()
merge_figs()
plot_barbs()
plot_gcr()
plot_genetic_algorithm_initial_population()
plot_legend()
rebin()
set_graphics_standards()
- WeatherRoutingTool.utils.maps module
- WeatherRoutingTool.utils.unit_conversion module
- Module contents
Submodules
WeatherRoutingTool.config module
- class WeatherRoutingTool.config.Config(*, ALGORITHM_TYPE: ~typing.Literal['isofuel', 'genetic', 'speedy_isobased'] = 'isofuel', BOAT_TYPE: ~typing.Literal['CBT', 'SAL', 'speedy_isobased', 'direct_power_method'] = 'direct_power_method', CONSTRAINTS_LIST: ~typing.List[~typing.Literal['land_crossing_global_land_mask', 'land_crossing_polygons', 'seamarks', 'water_depth', 'on_map', 'via_waypoints', 'status_error']], DEFAULT_ROUTE: ~typing.Annotated[list[int | float], ~annotated_types.MinLen(min_length=4), ~annotated_types.MaxLen(max_length=4)], DEFAULT_MAP: ~typing.Annotated[list[int | float], ~annotated_types.MinLen(min_length=4), ~annotated_types.MaxLen(max_length=4)], DELTA_FUEL: float = 3000, DELTA_TIME_FORECAST: float = 3, DEPARTURE_TIME: ~datetime.datetime, GENETIC_MUTATION_TYPE: ~typing.Literal['grid_based'] = 'grid_based', GENETIC_NUMBER_GENERATIONS: int = 20, GENETIC_NUMBER_OFFSPRINGS: int = 2, GENETIC_POPULATION_SIZE: int = 20, GENETIC_POPULATION_TYPE: ~typing.Literal['grid_based', 'from_geojson'] = 'grid_based', GENETIC_POPULATION_PATH: str | None = None, INTERMEDIATE_WAYPOINTS: list[~typing.Annotated[list[int | float], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=2), MaxLen(max_length=2)])]] = <factory>, ISOCHRONE_MAX_ROUTING_STEPS: int = 100, ISOCHRONE_MINIMISATION_CRITERION: ~typing.Literal['dist', 'squareddist_over_disttodest'] = 'squareddist_over_disttodest', ISOCHRONE_NUMBER_OF_ROUTES: int = 1, ISOCHRONE_PRUNE_GROUPS: ~typing.Literal['courses', 'larger_direction', 'branch'] = 'larger_direction', ISOCHRONE_PRUNE_SECTOR_DEG_HALF: int = 91, ISOCHRONE_PRUNE_SEGMENTS: int = 20, ISOCHRONE_PRUNE_SYMMETRY_AXIS: ~typing.Literal['gcr', 'headings_based'] = 'gcr', ROUTER_HDGS_SEGMENTS: int = 30, ROUTER_HDGS_INCREMENTS_DEG: int = 6, ROUTE_POSTPROCESSING: bool = False, ROUTING_STEPS: int = 60, TIME_FORECAST: float = 90, COURSES_FILE: str = None, DEPTH_DATA: str = None, WEATHER_DATA: str = None, ROUTE_PATH: str, CONFIG_PATH: str = None)[source]
Bases:
BaseModel
Central configuration class of the Weather Routing Tool. Parameters are validated using pydantic.
- ALGORITHM_TYPE: Literal['isofuel', 'genetic', 'speedy_isobased']
- BOAT_TYPE: Literal['CBT', 'SAL', 'speedy_isobased', 'direct_power_method']
- CONFIG_PATH: str
- CONSTRAINTS_LIST: List[Literal['land_crossing_global_land_mask', 'land_crossing_polygons', 'seamarks', 'water_depth', 'on_map', 'via_waypoints', 'status_error']]
- COURSES_FILE: str
- DEFAULT_MAP: Annotated[list[int | float], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=4), MaxLen(max_length=4)])]
- DEFAULT_ROUTE: Annotated[list[int | float], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=4), MaxLen(max_length=4)])]
- DELTA_FUEL: float
- DELTA_TIME_FORECAST: float
- DEPARTURE_TIME: datetime
- DEPTH_DATA: str
- GENETIC_MUTATION_TYPE: Literal['grid_based']
- GENETIC_NUMBER_GENERATIONS: int
- GENETIC_NUMBER_OFFSPRINGS: int
- GENETIC_POPULATION_PATH: str | None
- GENETIC_POPULATION_SIZE: int
- GENETIC_POPULATION_TYPE: Literal['grid_based', 'from_geojson']
- INTERMEDIATE_WAYPOINTS: Annotated[list[Annotated[list[int | float], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=2), MaxLen(max_length=2)])]], FieldInfo(annotation=NoneType, required=False, default_factory=list)]
- ISOCHRONE_MAX_ROUTING_STEPS: int
- ISOCHRONE_MINIMISATION_CRITERION: Literal['dist', 'squareddist_over_disttodest']
- ISOCHRONE_NUMBER_OF_ROUTES: int
- ISOCHRONE_PRUNE_GROUPS: Literal['courses', 'larger_direction', 'branch']
- ISOCHRONE_PRUNE_SECTOR_DEG_HALF: int
- ISOCHRONE_PRUNE_SEGMENTS: int
- ISOCHRONE_PRUNE_SYMMETRY_AXIS: Literal['gcr', 'headings_based']
- ROUTER_HDGS_INCREMENTS_DEG: int
- ROUTER_HDGS_SEGMENTS: int
- ROUTE_PATH: str
- ROUTE_POSTPROCESSING: bool
- ROUTING_STEPS: int
- TIME_FORECAST: float
- WEATHER_DATA: str
- classmethod assign_config(path=None, init_mode='from_json', config_dict=None)[source]
Check input type of config data and run validate_config
- Parameters:
path (str, optional) – path to json with config data, defaults to None
init_mode (str, optional) – _description_, defaults to ‘from_json’
config_dict (dict, optional) – dict with config data, defaults to None
- Raises:
ValueError – Path to json file doesn’t exist although chosen as input type for config
ValueError – Dict doesn’t exist although chosen as input type for config
ValueError – Mode chosen as input type for config doesn’t exist
- Returns:
Validated config
- Return type:
- check_boat_algorithm_compatibility() Self [source]
The boat type ‘speedy_isobased’ is configured to run only with the corresponding algorithm type ‘speedy_isobased’
- Raises:
ValueError – BOAT_TYPE is not compatible with ALGORITHM_TYPE
- Returns:
Config object with validated BOAT_TYPE-ALGORITHM_TYPE-compatibility
- Return type:
- classmethod check_constraint_list(v)[source]
Check that the CONSTRAINTS_LIST contains ‘land_crossing_global_land_mask’ else the boat would be allowed to cross land
- Raises:
ValueError – CONSTRAINTS_LIST doesn’t contain ‘land_crossing_global_land_mask’
- Returns:
Validated CONSTRAINTS_LIST
- Return type:
list
- check_route_depth_data_compatibility() Self [source]
Check that the route runs inside the map that has depth data available considering only place as the depth data is time independent
- Raises:
ValueError – Depth data doesn’t cover map
- Returns:
Config object with validated DEPTH_DATA regarding place
- Return type:
- check_route_on_map() Self [source]
Check that the route runs inside the bounds of the defined map
- Raises:
ValueError – Route coordinates are outside the DEFAULT_MAP bounds
- Returns:
Config object with validated DEFAULT_ROUTE-DEFAULT_MAP-compatibility
- Return type:
- check_route_weather_data_compatibility() Self [source]
Check that the route runs inside the map that has weather data available considering place and time :raises ValueError: Weather data doesn’t cover map :raises ValueError: Weather data doesn’t cover full routing time range :raises ValueError: Weather data has no time dimension :return: Config object with validated WEATHER_DATA regarding place and time :rtype: WeatherRoutingTool.config.Config
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- classmethod validate_config(config_data)[source]
Validate the config by creating a Config class object and throw errors if necessary
- Parameters:
config_data (dict) – Config data provided by the user in form of a json file or a dict
- Returns:
Validated config
- Return type:
- classmethod validate_map_coordinates(v, info)[source]
Check if the coordinates of DEFAULT_MAP have values that the program can work with
- Raises:
ValueError – DEFAULT_MAP doesn’t contain exactly 4 values
ValueError – One of the coordinates isn’t in the required range
- Returns:
validated DEFAULT_MAP
- Return type:
tuple
- classmethod validate_route_coordinates(v)[source]
Check if the coordinates of DEFAULT_ROUTE have values that the program can work with
- Raises:
ValueError – DEFAULT_ROUTE doesn’t contain exactly 4 values
ValueError – One of the coordinates isn’t in the required range
- Returns:
Validated DEFAULT_ROUTE
- Return type:
tuple
WeatherRoutingTool.execute_routing module
- WeatherRoutingTool.execute_routing.execute_routing(config)[source]
Execute route optimization based on the user-defined configuration. After a successful run the final route is saved into the configured folder.
- Parameters:
config (WeatherRoutingTool.config.Config) – validated configuration
- Returns:
None
WeatherRoutingTool.routeparams module
- class WeatherRoutingTool.routeparams.RouteParams(count, start, finish, gcr, route_type, time, lats_per_step, lons_per_step, course_per_step, dists_per_step, starttime_per_step, ship_params_per_step)[source]
Bases:
object
This is a Container class for route parameters. Parameters are assumed to be constant for every route segment (= distance from one coordinate pair to the following). The parameters for each routing step are tied to the start point of each route segment. Since the number of routing steps is by one smaller than the number of coordinate pairs, the arrays of this container class exhibit different lengths:
Type 1: count + 1: dists_per_step, ship_params_per_step, courses_per_step
Type 2: count + 2: lats_per_step, lons_per_step, starttime_per_step
When the RouteParams object is written to json file, the full arrays of type 2 are written. The corresponding values from the arrays of type 1 are set to -99 for the last coordinate pair.
- count: int
- course_per_step: tuple
- dists_per_step: tuple
- finish: tuple
- gcr: tuple
- lats_per_step: tuple
- lons_per_step: tuple
- plot_power_vs_dist(color, label, power_type, ax, bin_center_mean=None, bin_width_mean=None)[source]
- route_type: str
- ship_params_per_step: ShipParams
- start: tuple
- starttime_per_step: tuple
- time: timedelta
WeatherRoutingTool.test_maripower_settings_for_different_courses module
WeatherRoutingTool.test_maripower_settings_for_specific_route module
WeatherRoutingTool.weather module
- class WeatherRoutingTool.weather.FakeWeather(time, hours, time_res, coord_res=0.08333333333333333, var_dict=None)[source]
Bases:
WeatherCond
- class WeatherRoutingTool.weather.WeatherCond(time, hours, time_res)[source]
Bases:
object
- ds: Dataset
- property time_end
- property time_res
- property time_start
- time_steps: int
- class WeatherRoutingTool.weather.WeatherCondEnvAutomatic(time, hours, time_res)[source]
Bases:
WeatherCond
- class WeatherRoutingTool.weather.WeatherCondFromFile(time, hours, time_res)[source]
Bases:
WeatherCond
- wind_functions: None
- wind_vectors: None