Skip to content

Commit 4f29c0e

Browse files
committed
Merge branch 'main' of github.com:52North/WeatherRoutingTool
2 parents f70c3bb + 7595b2e commit 4f29c0e

4 files changed

Lines changed: 13 additions & 9 deletions

File tree

WeatherRoutingTool/algorithms/genetic/repair.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def repair_single_route(self, rt, patchfn, constrained):
132132
# check for correct input shape of rt
133133
assert len(rt.shape) == 2
134134
assert rt.shape[1] == 2
135-
debug = True
135+
debug = False
136136

137137
prev_seg_end = 0
138138
on_constraint = False

WeatherRoutingTool/routeparams.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def plot_route(self, ax, colour, label, linestyle=False):
362362

363363
def get_power_type(self, power_type):
364364
if power_type == 'power':
365-
return {"value": self.ship_params_per_step.get_power(), "label": 'power consumption', "unit": u.Watt}
365+
return {"value": self.ship_params_per_step.get_power(), "label": 'power consumption (kW)', "unit": u.Watt}
366366
if power_type == 'fuel':
367367
return {"value": self.get_fuel_per_dist(), "label": "fuel consumption", "unit": u.kg}
368368

@@ -474,10 +474,10 @@ def plot_power_vs_dist_ratios(self, denominator, color, label, power_type):
474474
marker='o', color=color, linewidth=0, label=label)
475475
plt.errorbar(x=hist_values_nom["bin_centres"].to(u.km).value, y=hist_values_ratios, yerr=None,
476476
xerr=hist_values_nom["bin_widths"].to(u.km).value / 2, fmt=' ', color=color, linestyle=None)
477-
plt.axhline(y=mean_dev, color=color, linestyle='dashed')
477+
#plt.axhline(y=mean_dev, color=color, linestyle='dashed')
478478

479479
plt.xlabel('travel distance (km)')
480-
plt.ylabel(power_nom["label"] + ' data/model')
480+
plt.ylabel(power_nom["label"] + ' scipy shortest/model')
481481
plt.xticks()
482482

483483
def plot_power_vs_coord(self, ax, color, label, coordstring, power_type):

scripts/compare_routes.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
##
44

55
import argparse
6+
import copy
67
import datetime as dt
78

89
from WeatherRoutingTool.config import set_up_logging
@@ -14,7 +15,7 @@
1415

1516
def plot_power_vs_dist(rp_list, rp_str_list, scenario_str, power_type='fuel'):
1617
fig, ax = plt.subplots(figsize=(12, 8), dpi=96)
17-
ax.set_ylim(0, 5500)
18+
ax.set_ylim(4500, 5500)
1819
for irp in range(0, len(rp_list)):
1920
rp_list[irp].plot_power_vs_dist(graphics.get_colour(irp), rp_str_list[irp], power_type, ax)
2021

@@ -47,16 +48,18 @@ def plot_power_vs_coord(rp_list, rp_str_list, coordstring, power_type='fuel'):
4748

4849
def plot_power_vs_dist_ratios(rp_list, rp_str_list, scenario_str, power_type='fuel'):
4950
fig, ax = plt.subplots(figsize=(12, 8), dpi=96)
50-
ax.set_ylim(0.7, 1.3)
51+
ax.set_ylim(0.9, 1.1)
5152
colour = 0
5253

53-
for irp in range(1, len(rp_list)):
54+
rp_bruch = copy.deepcopy(rp_list[0])
55+
56+
for irp in range(0, len(rp_list)):
5457
if rp_str_list[irp] == '':
55-
rp_list[irp].plot_power_vs_dist_ratios(rp_list[0], graphics.get_colour(colour),
58+
rp_list[irp].plot_power_vs_dist_ratios(rp_bruch, graphics.get_colour(colour),
5659
rp_str_list[irp], power_type)
5760
colour = colour + 1
5861
else:
59-
rp_list[irp].plot_power_vs_dist_ratios(rp_list[0], graphics.get_colour(colour),
62+
rp_list[irp].plot_power_vs_dist_ratios(rp_bruch, graphics.get_colour(colour),
6063
rp_str_list[irp], power_type)
6164
colour = colour + 1
6265

scripts/fuel_consumption_for_specific_route.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def run_dpm_test_scenario(waypoint_dict, geojsondir, sog, output_route):
5959

6060
def lat_lon_from_file(filename):
6161
with open(filename) as file:
62+
print('reading file: ', filename)
6263
rp_dict = json.load(file)
6364

6465
point_list = rp_dict['features']

0 commit comments

Comments
 (0)