def onBoatSelect(self, widget):
     bdir = self.boats[self.builder.get_object(
         'boat-select').get_active()]['dir']
     boatPath = os.path.abspath(
         os.path.dirname(__file__)) + '/../../data/boats/' + bdir
     self.builder.get_object('boat-image').set_from_file(boatPath +
                                                         '/image.png')
     self.polar = weatherrouting.Polar(boatPath + '/polar.pol')
     self.builder.get_object('boat-polar-area').queue_draw()
Esempio n. 2
0
    def createRouting(self, algorithm, boatModel, track, startDatetime,
                      startPosition):
        polar = weatherrouting.Polar(
            os.path.abspath(os.path.dirname(__file__)) + '/../data/boats/' +
            boatModel + '/polar.pol')

        routing = weatherrouting.Routing(algorithm,
                                         polar,
                                         track,
                                         self.gribManager,
                                         utils.pointValidity,
                                         startDatetime=startDatetime,
                                         startPosition=startPosition)
        return routing
Esempio n. 3
0
    def point_validity(self, y, x):
        if weatherrouting.utils.pointDistance(
                x, y, *(self.mean_point)) < self.mean_island:
            return False
        else:
            return True

    def line_validity(self, y1, x1, y2, x2):
        if weatherrouting.utils.pointDistance(
                x1, y2, *(self.mean_point)) < self.mean_island:
            return False
        else:
            return True


polar_obj = weatherrouting.Polar(
    os.path.join(os.path.dirname(__file__), 'Bavaria38.pol'))


class TestRouting_lowWind_noIsland(unittest.TestCase):
    def setUp(self):
        grib = mock_grib(2, 180, 0.1)
        self.track = [(5, 38), (5.2, 38.2)]
        island_route = mock_point_validity(self.track)
        self.routing_obj = weatherrouting.Routing(
            LinearBestIsoRouter,
            polar_obj,
            self.track,
            grib,
            datetime.datetime.fromisoformat('2021-04-02T12:00:00'),
            pointValidity=island_route.point_validity,
        )