Changeset 43fd35c


Ignore:
Timestamp:
Apr 19, 2020, 4:27:01 PM (7 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
2a31181
Parents:
77cd9cf
Message:

Refactored code to have one gnuboat python structure

Files:
9 added
21 deleted
2 edited
143 moved

Legend:

Unmodified
Added
Removed
  • .gitignore

    r77cd9cf r43fd35c  
    1 build/
    21# Compiled python modules.
    32*.pyc
     3__pycache__/
     4.directory
    45
    56# Setuptools distribution folder.
    67dist/
    7 
     8build/
    89# Python egg metadata, regenerated from source files by setuptools.
    910*.egg-info
    1011
    1112.tox/
     13.pytest_cache/
    1214.coverage
     15.coverage.*
    1316reports
    1417
    15 src/mapservice/src-gen
     18buildhelpers/codegen/openapi-generator-cli-*.jar
     19src/gnuboat/mapservice/
    1620src/mapservice-webclient/src-gen
    1721src/mapservice/codegen/openapi-generator-cli-*.jar
  • buildhelpers/codegen/templates/__init__test.mustache

    r77cd9cf r43fd35c  
    1414
    1515from {{packageName}}.encoder import JSONEncoder
    16 from {{packageName}}.server_impl.database.Model import db, db_setup, load_spatialite
    17 from . import db_test_setup
     16from {{packageName}}_impl.database.Model import (
     17    db, db_setup, load_spatialite
     18)
     19from {{packageName}}_impl.tests import db_test_setup
    1820
    1921class BaseTestCase(TestCase):
    … …  
    2729                app.add_api('openapi.yaml')
    2830
    29                 application.config.from_object('{{packageName}}.server_impl.Config.TestingConfig')
    30                 application.template_folder = os.path.join(os.path.dirname(__file__), '../templates')
     31                application.config.from_object('{{packageName}}_impl.Config.TestingConfig')
     32                application.template_folder = os.path.join(os.path.dirname(__file__), '../../mapservice_impl/templates')
    3133                celery = Celery(__name__, broker=application.config['CELERY_BROKER_URL'])
    3234                celery.config_from_object(application.config)
  • buildhelpers/codegen/templates/__main__.mustache

    r77cd9cf r43fd35c  
    88import os
    99
    10 from {{packageName}}.server_impl import app, application, mail, celery, setup_app, config_object
     10from {{packageName}}_impl import (
     11    app, application, mail, celery, setup_app, config_object
     12)
    1113
    1214def main():
  • buildhelpers/codegen/templates/controller.mustache

    r77cd9cf r43fd35c  
    88{{#operation}}
    99
    10 from {{packageName}}.server_impl.controllers import {{classname}}
     10from {{packageName}}_impl.controllers import {{classname}}
    1111
    1212def {{operationId}}({{#allParams}}{{paramName}}{{^required}}=None{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}):  # noqa: E501
  • buildhelpers/codegen/templates/controller_test.mustache

    r77cd9cf r43fd35c  
    2121    def test_{{operationId}}(self):
    2222        """Test case for {{{operationId}}}
    23 
    2423        {{{summary}}}
    2524        """
  • buildhelpers/codegen/templates/model.mustache

    r77cd9cf r43fd35c  
    2323{{#model}}
    2424class {{classname}}(Model):
    25     """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
     25    """NOTE: This class is auto generated by OpenAPI Generator
     26       (https://openapi-generator.tech).
    2627
    2728    Do not edit the class manually.
  • src/gnuboat/common/__init__.py

    r77cd9cf r43fd35c  
    11# -*- coding: utf-8 -*-
    22'''
    3     Copyright (C) 2017 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     3    Copyright (C) 2017 - 2020 EngSaS - Langenbach. All rights reserved.
    44
    55    This program is free software: you can redistribute it and/or modify
    … …  
    1616    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1717'''
    18 from .datahandler.loghandler import LogHandler
    19 from .datahandler.logdataset import LogDataset
    20 from .spatial.tilegenerator import TileGenerator
     18from gnuboat.common.datahandler.loghandler import LogHandler
     19from gnuboat.common.datahandler.logdataset import LogDataset
     20from gnuboat.common.spatial.tilegenerator import TileGenerator
  • src/gnuboat/common/bin/gdal2tiles-gnuboat.py

    r77cd9cf r43fd35c  
    6464__version__ = "$Id: gdal2tiles.py fae3a65f16af509cf9e0dd16cd16858d8e49eb25 2019-03-12 15:23:57 -0700 Kevin Mehall $"
    6565
    66 resampling_list = ('average', 'near', 'bilinear', 'cubic', 'cubicspline', 'lanczos', 'antialias')
     66resampling_list = (
     67    'average', 'near', 'bilinear', 'cubic', 'cubicspline', 'lanczos',
     68    'antialias'
     69)
    6770profile_list = ('mercator', 'geodetic', 'raster')
    6871webviewer_list = ('all', 'google', 'openlayers', 'leaflet', 'none')
    … …  
    207210                 AUTHORITY["EPSG","9001"]]]
    208211    """
    209 
    210212    def __init__(self, tile_size=256):
    211213        "Initialize the TMS Global Mercator pyramid"
    … …  
    220222
    221223        mx = lon * self.originShift / 180.0
    222         my = math.log(math.tan((90 + lat) * math.pi / 360.0)) / (math.pi / 180.0)
     224        my = math.log(math.tan((90 + lat) * math.pi / 360.0)
     225                      ) / (math.pi / 180.0)
    223226
    224227        my = my * self.originShift / 180.0
    … …  
    231234        lat = (my / self.originShift) * 180.0
    232235
    233         lat = 180 / math.pi * (2 * math.atan(math.exp(lat * math.pi / 180.0)) - math.pi / 2.0)
     236        lat = 180 / math.pi * (
     237            2 * math.atan(math.exp(lat * math.pi / 180.0)) - math.pi / 2.0
     238        )
    234239        return lat, lon
    235240
    … …  
    272277        "Returns bounds of the given tile in EPSG:3857 coordinates"
    273278
    274         minx, miny = self.PixelsToMeters(tx * self.tile_size, ty * self.tile_size, zoom)
    275         maxx, maxy = self.PixelsToMeters((tx + 1) * self.tile_size, (ty + 1) * self.tile_size, zoom)
     279        minx, miny = self.PixelsToMeters(
     280            tx * self.tile_size, ty * self.tile_size, zoom
     281        )
     282        maxx, maxy = self.PixelsToMeters((tx + 1) * self.tile_size,
     283                                         (ty + 1) * self.tile_size, zoom)
    276284        return (minx, miny, maxx, maxy)
    277285
    … …  
    296304        for i in range(MAXZOOMLEVEL):
    297305            if pixelSize > self.Resolution(i):
    298                 return max(0, i - 1)    # We don't want to scale up
     306                return max(0, i - 1)  # We don't want to scale up
    299307        return MAXZOOMLEVEL - 1
    300308
    … …  
    356364       WMS, KML    Web Clients, Google Earth  TileMapService
    357365    """
    358 
    359366    def __init__(self, tmscompatible, tile_size=256):
    360367        self.tile_size = tile_size
    … …  
    400407        for i in range(MAXZOOMLEVEL):
    401408            if pixelSize > self.Resolution(i):
    402                 return max(0, i - 1)    # We don't want to scale up
     409                return max(0, i - 1)  # We don't want to scale up
    403410        return MAXZOOMLEVEL - 1
    404411
    … …  
    407414        res = self.resFact / 2**zoom
    408415        return (
    409             tx * self.tile_size * res - 180,
    410             ty * self.tile_size * res - 90,
     416            tx * self.tile_size * res - 180, ty * self.tile_size * res - 90,
    411417            (tx + 1) * self.tile_size * res - 180,
    412418            (ty + 1) * self.tile_size * res - 90
    … …  
    424430    ----------------------------------------
    425431    """
    426 
    427432    def __init__(self, width, height, tile_size=256, tileformat='jpg'):
    428433        """Initialization of the Zoomify tile tree"""
    … …  
    442447
    443448        while (imagesize[0] > tile_size or imagesize[1] > tile_size):
    444             imagesize = (math.floor(imagesize[0] / 2), math.floor(imagesize[1] / 2))
    445             tiles = (math.ceil(imagesize[0] / tile_size), math.ceil(imagesize[1] / tile_size))
     449            imagesize = (
     450                math.floor(imagesize[0] / 2), math.floor(imagesize[1] / 2)
     451            )
     452            tiles = (
     453                math.ceil(imagesize[0] / tile_size),
     454                math.ceil(imagesize[1] / tile_size)
     455            )
    446456            self.tierSizeInTiles.append(tiles)
    447457            self.tierImageSize.append(imagesize)
    … …  
    458468        for i in range(1, self.numberOfTiers + 1):
    459469            self.tileCountUpToTier.append(
    460                 self.tierSizeInTiles[i - 1][0] * self.tierSizeInTiles[i - 1][1] +
    461                 self.tileCountUpToTier[i - 1]
     470                self.tierSizeInTiles[i - 1][0] *
     471                self.tierSizeInTiles[i - 1][1] + self.tileCountUpToTier[i - 1]
    462472            )
    463473
    … …  
    465475        """Returns filename for tile with given coordinates"""
    466476
    467         tileIndex = x + y * self.tierSizeInTiles[z][0] + self.tileCountUpToTier[z]
    468         return os.path.join("TileGroup%.0f" % math.floor(tileIndex / 256),
    469                             "%s-%s-%s.%s" % (z, x, y, self.tileformat))
     477        tileIndex = x + y * self.tierSizeInTiles[z][
     478            0] + self.tileCountUpToTier[z]
     479        return os.path.join(
     480            "TileGroup%.0f" % math.floor(tileIndex / 256),
     481            "%s-%s-%s.%s" % (z, x, y, self.tileformat)
     482        )
    470483
    471484
    … …  
    485498
    486499
    487 def generate_kml(tx, ty, tz, tileext, tile_size, tileswne, options, children=None, **args):
     500def generate_kml(
     501    tx, ty, tz, tileext, tile_size, tileswne, options, children=None, **args
     502):
    488503    """
    489504    Template for the KML. Returns filled string.
    … …  
    510525        tilekml = True
    511526        args['title'] = "%d/%d/%d.kml" % (tz, tx, ty)
    512         args['south'], args['west'], args['north'], args['east'] = tileswne(tx, ty, tz)
     527        args['south'], args['west'], args['north'], args['east'] = tileswne(
     528            tx, ty, tz
     529        )
    513530
    514531    if tx == 0:
    … …  
    587604      </Link>
    588605    </NetworkLink>
    589         """ % (cz, cx, cy, args['tileformat'], cnorth, csouth, ceast, cwest,
    590                args['minlodpixels'], url, cz, cx, cy)
     606        """ % (
     607            cz, cx, cy, args['tileformat'], cnorth, csouth, ceast, cwest,
     608            args['minlodpixels'], url, cz, cx, cy
     609        )
    591610
    592611    s += """      </Document>
    … …  
    608627        for i in range(1, tilebands + 1):
    609628            # Black border around NODATA
    610             res = gdal.RegenerateOverview(dsquery.GetRasterBand(i), dstile.GetRasterBand(i),
    611                                           'average')
     629            res = gdal.RegenerateOverview(
     630                dsquery.GetRasterBand(i), dstile.GetRasterBand(i), 'average'
     631            )
    612632            if res != 0:
    613                 exit_with_error("RegenerateOverview() failed on %s, error %d" % (
    614                     tilefilename, res))
     633                exit_with_error(
     634                    "RegenerateOverview() failed on %s, error %d" %
     635                    (tilefilename, res)
     636                )
    615637
    616638    elif options.resampling == 'antialias' and numpy_available:
    … …  
    619641        array = numpy.zeros((querysize, querysize, tilebands), numpy.uint8)
    620642        for i in range(tilebands):
    621             array[:, :, i] = gdalarray.BandReadAsArray(dsquery.GetRasterBand(i + 1),
    622                                                        0, 0, querysize, querysize)
    623         im = Image.fromarray(array, 'RGBA')     # Always four bands
     643            array[:, :, i] = gdalarray.BandReadAsArray(
     644                dsquery.GetRasterBand(i + 1), 0, 0, querysize, querysize
     645            )
     646        im = Image.fromarray(array, 'RGBA')  # Always four bands
    624647        im1 = im.resize((tile_size, tile_size), Image.ANTIALIAS)
    625648        if os.path.exists(tilefilename):
    … …  
    646669
    647670        # Other algorithms are implemented by gdal.ReprojectImage().
    648         dsquery.SetGeoTransform((0.0, tile_size / float(querysize), 0.0, 0.0, 0.0,
    649                                  tile_size / float(querysize)))
     671        dsquery.SetGeoTransform((
     672            0.0, tile_size / float(querysize), 0.0, 0.0, 0.0,
     673            tile_size / float(querysize)
     674        ))
    650675        dstile.SetGeoTransform((0.0, 1.0, 0.0, 0.0, 0.0, 1.0))
    651676
    652677        res = gdal.ReprojectImage(dsquery, dstile, None, None, gdal_resampling)
    653678        if res != 0:
    654             exit_with_error("ReprojectImage() failed on %s, error %d" % (tilefilename, res))
     679            exit_with_error(
     680                "ReprojectImage() failed on %s, error %d" %
     681                (tilefilename, res)
     682            )
    655683
    656684
    … …  
    663691        nds = list(map(float, options.srcnodata.split(',')))
    664692        if len(nds) < input_dataset.RasterCount:
    665             in_nodata = (nds * input_dataset.RasterCount)[:input_dataset.RasterCount]
     693            in_nodata = (nds *
     694                         input_dataset.RasterCount)[:input_dataset.RasterCount]
    666695        else:
    667696            in_nodata = nds
    … …  
    722751
    723752def has_georeference(dataset):
    724     return (dataset.GetGeoTransform() != (0.0, 1.0, 0.0, 0.0, 0.0, 1.0) or
    725             dataset.GetGCPCount() != 0)
     753    return (
     754        dataset.GetGeoTransform() != (0.0, 1.0, 0.0, 0.0, 0.0, 1.0)
     755        or dataset.GetGCPCount() != 0
     756    )
    726757
    727758
    … …  
    732763    """
    733764    if not from_srs or not to_srs:
    734         raise GDALError("from and to SRS must be defined to reproject the dataset")
    735 
    736     if (from_srs.ExportToProj4() != to_srs.ExportToProj4()) or (from_dataset.GetGCPCount() != 0):
    737         to_dataset = gdal.AutoCreateWarpedVRT(from_dataset,
    738                                               from_srs.ExportToWkt(), to_srs.ExportToWkt())
     765        raise GDALError(
     766            "from and to SRS must be defined to reproject the dataset"
     767        )
     768
     769    if (from_srs.ExportToProj4() !=
     770        to_srs.ExportToProj4()) or (from_dataset.GetGCPCount() != 0):
     771        to_dataset = gdal.AutoCreateWarpedVRT(
     772            from_dataset, from_srs.ExportToWkt(), to_srs.ExportToWkt()
     773        )
    739774
    740775        if options and options.verbose:
    741             print("Warping of the raster by AutoCreateWarpedVRT (result saved into 'tiles.vrt')")
     776            print(
     777                "Warping of the raster by AutoCreateWarpedVRT (result saved into 'tiles.vrt')"
     778            )
    742779            to_dataset.GetDriver().CreateCopy("tiles.vrt", to_dataset)
    743780
    … …  
    778815
    779816    vrt_string = add_gdal_warp_options_to_string(
    780         vrt_string, {"INIT_DEST": "NO_DATA", "UNIFIED_SRC_NODATA": "YES"})
    781 
    782 # TODO: gbataille - check the need for this replacement. Seems to work without
    783 #         # replace BandMapping tag for NODATA bands....
    784 #         for i in range(len(nodata_values)):
    785 #             s = s.replace(
    786 #                 '<BandMapping src="%i" dst="%i"/>' % ((i+1), (i+1)),
    787 #                 """
    788 # <BandMapping src="%i" dst="%i">
    789 # <SrcNoDataReal>%i</SrcNoDataReal>
    790 # <SrcNoDataImag>0</SrcNoDataImag>
    791 # <DstNoDataReal>%i</DstNoDataReal>
    792 # <DstNoDataImag>0</DstNoDataImag>
    793 # </BandMapping>
    794 #                 """ % ((i+1), (i+1), nodata_values[i], nodata_values[i]))
     817        vrt_string, {
     818            "INIT_DEST": "NO_DATA",
     819            "UNIFIED_SRC_NODATA": "YES"
     820        }
     821    )
     822
     823    # TODO: gbataille - check the need for this replacement. Seems to work without
     824    #         # replace BandMapping tag for NODATA bands....
     825    #         for i in range(len(nodata_values)):
     826    #             s = s.replace(
     827    #                 '<BandMapping src="%i" dst="%i"/>' % ((i+1), (i+1)),
     828    #                 """
     829    # <BandMapping src="%i" dst="%i">
     830    # <SrcNoDataReal>%i</SrcNoDataReal>
     831    # <SrcNoDataImag>0</SrcNoDataImag>
     832    # <DstNoDataReal>%i</DstNoDataReal>
     833    # <DstNoDataImag>0</DstNoDataImag>
     834    # </BandMapping>
     835    #                 """ % ((i+1), (i+1), nodata_values[i], nodata_values[i]))
    795836
    796837    corrected_dataset = gdal.Open(vrt_string)
    … …  
    798839    # set NODATA_VALUE metadata
    799840    corrected_dataset.SetMetadataItem(
    800         'NODATA_VALUES', ' '.join([str(i) for i in nodata_values]))
     841        'NODATA_VALUES', ' '.join([str(i) for i in nodata_values])
     842    )
    801843
    802844    if options and options.verbose:
    … …  
    831873
    832874    tb = ElementTree.TreeBuilder()
    833     tb.start("VRTRasterBand",
    834              {'dataType': "Byte", "band": str(nb_bands + 1), "subClass": "VRTWarpedRasterBand"})
     875    tb.start(
     876        "VRTRasterBand", {
     877            'dataType': "Byte",
     878            "band": str(nb_bands + 1),
     879            "subClass": "VRTWarpedRasterBand"
     880        }
     881    )
    835882    tb.start("ColorInterp", {})
    836883    tb.data("Alpha")
    … …  
    887934    """
    888935    alphaband = dataset.GetRasterBand(1).GetMaskBand()
    889     if ((alphaband.GetMaskFlags() & gdal.GMF_ALPHA) or
    890             dataset.RasterCount == 4 or
    891             dataset.RasterCount == 2):
     936    if ((alphaband.GetMaskFlags() & gdal.GMF_ALPHA) or dataset.RasterCount == 4
     937        or dataset.RasterCount == 2):
    892938        return dataset.RasterCount - 1
    893939    return dataset.RasterCount
     940
    894941
    895942def create_base_tile(tile_job_info, tile_detail, queue=None):
    … …  
    929976    # Tile dataset in memory
    930977    tilefilename = os.path.join(
    931         output, str(tz), str(tx), "%s.%s" % (ty, tileext))
     978        output, str(tz), str(tx), "%s.%s" % (ty, tileext)
     979    )
    932980    dstile = mem_drv.Create('', tile_size, tile_size, tilebands)
    933981
    … …  
    935983
    936984    if options.verbose:
    937         print("\tReadRaster Extent: ",
    938               (rx, ry, rxsize, rysize), (wx, wy, wxsize, wysize))
     985        print(
     986            "\tReadRaster Extent: ", (rx, ry, rxsize, rysize),
     987            (wx, wy, wxsize, wysize)
     988        )
    939989
    940990    # Query is in 'nearest neighbour' but can be bigger in then the tile_size
    … …  
    945995
    946996        # Detect totally transparent tile and skip its creation
    947         if tile_job_info.exclude_transparent and len(alpha) == alpha.count('\x00'.encode('ascii')):
     997        if tile_job_info.exclude_transparent and len(alpha) == alpha.count(
     998            '\x00'.encode('ascii')
     999        ):
    9481000            return
    9491001
    950         data = ds.ReadRaster(rx, ry, rxsize, rysize, wxsize, wysize,
    951                              band_list=list(range(1, dataBandsCount + 1)))
     1002        data = ds.ReadRaster(
     1003            rx,
     1004            ry,
     1005            rxsize,
     1006            rysize,
     1007            wxsize,
     1008            wysize,
     1009            band_list=list(range(1, dataBandsCount + 1))
     1010        )
    9521011
    9531012    # The tile in memory is a transparent file by default. Write pixel values into it if
    … …  
    9561015        if tile_size == querysize:
    9571016            # Use the ReadRaster result directly in tiles ('nearest neighbour' query)
    958             dstile.WriteRaster(wx, wy, wxsize, wysize, data,
    959                                band_list=list(range(1, dataBandsCount + 1)))
    960             dstile.WriteRaster(wx, wy, wxsize, wysize, alpha, band_list=[tilebands])
     1017            dstile.WriteRaster(
     1018                wx,
     1019                wy,
     1020                wxsize,
     1021                wysize,
     1022                data,
     1023                band_list=list(range(1, dataBandsCount + 1))
     1024            )
     1025            dstile.WriteRaster(
     1026                wx, wy, wxsize, wysize, alpha, band_list=[tilebands]
     1027            )
    9611028
    9621029            # Note: For source drivers based on WaveLet compression (JPEG2000, ECW,
    … …  
    9701037            # TODO: fill the null value in case a tile without alpha is produced (now
    9711038            # only png tiles are supported)
    972             dsquery.WriteRaster(wx, wy, wxsize, wysize, data,
    973                                 band_list=list(range(1, dataBandsCount + 1)))
    974             dsquery.WriteRaster(wx, wy, wxsize, wysize, alpha, band_list=[tilebands])
    975 
    976             scale_query_to_tile(dsquery, dstile, tile_job_info.tile_driver, options,
    977                                 tilefilename=tilefilename)
     1039            dsquery.WriteRaster(
     1040                wx,
     1041                wy,
     1042                wxsize,
     1043                wysize,
     1044                data,
     1045                band_list=list(range(1, dataBandsCount + 1))
     1046            )
     1047            dsquery.WriteRaster(
     1048                wx, wy, wxsize, wysize, alpha, band_list=[tilebands]
     1049            )
     1050
     1051            scale_query_to_tile(
     1052                dsquery,
     1053                dstile,
     1054                tile_job_info.tile_driver,
     1055                options,
     1056                tilefilename=tilefilename
     1057            )
    9781058            del dsquery
    9791059
    … …  
    9911071        if not options.resume or not os.path.exists(kmlfilename):
    9921072            with open(kmlfilename, 'wb') as f:
    993                 f.write(generate_kml(
    994                     tx, ty, tz, tile_job_info.tile_extension, tile_job_info.tile_size,
    995                     get_tile_swne(tile_job_info, options), tile_job_info.options
    996                 ).encode('utf-8'))
     1073                f.write(
     1074                    generate_kml(
     1075                        tx, ty, tz, tile_job_info.tile_extension,
     1076                        tile_job_info.tile_size,
     1077                        get_tile_swne(tile_job_info,
     1078                                      options), tile_job_info.options
     1079                    ).encode('utf-8')
     1080                )
    9971081
    9981082    if queue:
    … …  
    10321116
    10331117                ti += 1
    1034                 tilefilename = os.path.join(output_folder,
    1035                                             str(tz),
    1036                                             str(tx),
    1037                                             "%s.%s" % (ty, tile_job_info.tile_extension))
     1118                tilefilename = os.path.join(
     1119                    output_folder, str(tz), str(tx),
     1120                    "%s.%s" % (ty, tile_job_info.tile_extension)
     1121                )
    10381122
    10391123                if options.verbose:
    … …  
    10511135                    os.makedirs(os.path.dirname(tilefilename))
    10521136
    1053                 dsquery = mem_driver.Create('', 2 * tile_job_info.tile_size,
    1054                                             2 * tile_job_info.tile_size, tilebands)
     1137                dsquery = mem_driver.Create(
     1138                    '', 2 * tile_job_info.tile_size,
     1139                    2 * tile_job_info.tile_size, tilebands
     1140                )
    10551141                # TODO: fill the null value
    1056                 dstile = mem_driver.Create('', tile_job_info.tile_size, tile_job_info.tile_size,
    1057                                            tilebands)
     1142                dstile = mem_driver.Create(
     1143                    '', tile_job_info.tile_size, tile_job_info.tile_size,
     1144                    tilebands
     1145                )
    10581146
    10591147                # TODO: Implement more clever walking on the tiles with cache functionality
    … …  
    10671155                        minx, miny, maxx, maxy = tile_job_info.tminmax[tz + 1]
    10681156                        if x >= minx and x <= maxx and y >= miny and y <= maxy:
    1069                             base_tile_path = os.path.join(output_folder, str(tz + 1), str(x),
    1070                                                           "%s.%s" % (y, tile_job_info.tile_extension))
     1157                            base_tile_path = os.path.join(
     1158                                output_folder, str(tz + 1), str(x),
     1159                                "%s.%s" % (y, tile_job_info.tile_extension)
     1160                            )
    10711161                            if not os.path.isfile(base_tile_path):
    10721162                                continue
    10731163
    10741164                            dsquerytile = gdal.Open(
    1075                                 base_tile_path,
    1076                                 gdal.GA_ReadOnly)
    1077                             if (ty == 0 and y == 1) or (ty != 0 and (y % (2 * ty)) != 0):
     1165                                base_tile_path, gdal.GA_ReadOnly
     1166                            )
     1167                            if (ty == 0 and
     1168                                y == 1) or (ty != 0 and (y % (2 * ty)) != 0):
    10781169                                tileposy = 0
    10791170                            else:
    10801171                                tileposy = tile_job_info.tile_size
    10811172                            if tx:
    1082                                 tileposx = x % (2 * tx) * tile_job_info.tile_size
     1173                                tileposx = x % (
     1174                                    2 * tx
     1175                                ) * tile_job_info.tile_size
    10831176                            elif tx == 0 and x == 1:
    10841177                                tileposx = tile_job_info.tile_size
    … …  
    10861179                                tileposx = 0
    10871180                            dsquery.WriteRaster(
    1088                                 tileposx, tileposy, tile_job_info.tile_size,
     1181                                tileposx,
     1182                                tileposy,
    10891183                                tile_job_info.tile_size,
    1090                                 dsquerytile.ReadRaster(0, 0,
    1091                                                        tile_job_info.tile_size,
    1092                                                        tile_job_info.tile_size),
    1093                                 band_list=list(range(1, tilebands + 1)))
     1184                                tile_job_info.tile_size,
     1185                                dsquerytile.ReadRaster(
     1186                                    0, 0, tile_job_info.tile_size,
     1187                                    tile_job_info.tile_size
     1188                                ),
     1189                                band_list=list(range(1, tilebands + 1))
     1190                            )
    10941191                            children.append([x, y, tz + 1])
    10951192
    10961193                if children:
    1097                     scale_query_to_tile(dsquery, dstile, tile_driver, options,
    1098                                         tilefilename=tilefilename)
     1194                    scale_query_to_tile(
     1195                        dsquery,
     1196                        dstile,
     1197                        tile_driver,
     1198                        options,
     1199                        tilefilename=tilefilename
     1200                    )
    10991201                    # Write a copy of tile to png/jpg
    11001202                    if options.resampling != 'antialias':
    … …  
    11031205
    11041206                    if options.verbose:
    1105                         print("\tbuild from zoom", tz + 1,
    1106                               " tiles:", (2 * tx, 2 * ty), (2 * tx + 1, 2 * ty),
    1107                               (2 * tx, 2 * ty + 1), (2 * tx + 1, 2 * ty + 1))
     1207                        print(
     1208                            "\tbuild from zoom", tz + 1, " tiles:",
     1209                            (2 * tx, 2 * ty), (2 * tx + 1, 2 * ty),
     1210                            (2 * tx, 2 * ty + 1), (2 * tx + 1, 2 * ty + 1)
     1211                        )
    11081212
    11091213                    # Create a KML file for this tile.
    11101214                    if tile_job_info.kml:
    1111                         with open(os.path.join(
    1112                             output_folder,
    1113                             '%d/%d/%d.kml' % (tz, tx, ty)
    1114                         ), 'wb') as f:
    1115                             f.write(generate_kml(
    1116                                 tx, ty, tz, tile_job_info.tile_extension, tile_job_info.tile_size,
    1117                                 get_tile_swne(tile_job_info, options), options, children
    1118                             ).encode('utf-8'))
     1215                        with open(
     1216                            os.path.join(
     1217                                output_folder, '%d/%d/%d.kml' % (tz, tx, ty)
     1218                            ), 'wb'
     1219                        ) as f:
     1220                            f.write(
     1221                                generate_kml(
     1222                                    tx, ty, tz, tile_job_info.tile_extension,
     1223                                    tile_job_info.tile_size,
     1224                                    get_tile_swne(tile_job_info,
     1225                                                  options), options, children
     1226                                ).encode('utf-8')
     1227                            )
    11191228
    11201229                if not options.verbose and not options.quiet:
    … …  
    11281237    usage = "Usage: %prog [options] input_file [output]"
    11291238    p = OptionParser(usage, version="%prog " + __version__)
    1130     p.add_option("-p", "--profile", dest='profile',
    1131                  type='choice', choices=profile_list,
    1132                  help=("Tile cutting profile (%s) - default 'mercator' "
    1133                        "(Google Maps compatible)" % ",".join(profile_list)))
    1134     p.add_option("-r", "--resampling", dest="resampling",
    1135                  type='choice', choices=resampling_list,
    1136                  help="Resampling method (%s) - default 'average'" % ",".join(resampling_list))
    1137     p.add_option('-s', '--s_srs', dest="s_srs", metavar="SRS",
    1138                  help="The spatial reference system used for the source input data")
    1139     p.add_option('-z', '--zoom', dest="zoom",
    1140                  help="Zoom levels to render (format:'2-5' or '10').")
    1141     p.add_option('-e', '--resume', dest="resume", action="store_true",
    1142                  help="Resume mode. Generate only missing files.")
    1143     p.add_option('-a', '--srcnodata', dest="srcnodata", metavar="NODATA",
    1144                  help="NODATA transparency value to assign to the input data")
    1145     p.add_option('-d', '--tmscompatible', dest="tmscompatible", action="store_true",
    1146                  help=("When using the geodetic profile, specifies the base resolution "
    1147                        "as 0.703125 or 2 tiles at zoom level 0."))
    1148     p.add_option("-v", "--verbose",
    1149                  action="store_true", dest="verbose",
    1150                  help="Print status messages to stdout")
    1151     p.add_option("-x", "--exclude",
    1152                  action="store_true", dest="exclude_transparent",
    1153                  help="Exclude transparent tiles from result tileset")
    1154     p.add_option("-q", "--quiet",
    1155                  action="store_true", dest="quiet",
    1156                  help="Disable messages and status to stdout")
    1157     p.add_option("--processes",
    1158                  dest="nb_processes",
    1159                  type='int',
    1160                  help="Number of processes to use for tiling")
    1161     p.add_option("--tilesize", dest="tilesize", default=256,
    1162                  type='int',
    1163                  help="Tile size in pixel of a tile")
     1239    p.add_option(
     1240        "-p",
     1241        "--profile",
     1242        dest='profile',
     1243        type='choice',
     1244        choices=profile_list,
     1245        help=(
     1246            "Tile cutting profile (%s) - default 'mercator' "
     1247            "(Google Maps compatible)" % ",".join(profile_list)
     1248        )
     1249    )
     1250    p.add_option(
     1251        "-r",
     1252        "--resampling",
     1253        dest="resampling",
     1254        type='choice',
     1255        choices=resampling_list,
     1256        help="Resampling method (%s) - default 'average'" %
     1257        ",".join(resampling_list)
     1258    )
     1259    p.add_option(
     1260        '-s',
     1261        '--s_srs',
     1262        dest="s_srs",
     1263        metavar="SRS",
     1264        help="The spatial reference system used for the source input data"
     1265    )
     1266    p.add_option(
     1267        '-z',
     1268        '--zoom',
     1269        dest="zoom",
     1270        help="Zoom levels to render (format:'2-5' or '10')."
     1271    )
     1272    p.add_option(
     1273        '-e',
     1274        '--resume',
     1275        dest="resume",
     1276        action="store_true",
     1277        help="Resume mode. Generate only missing files."
     1278    )
     1279    p.add_option(
     1280        '-a',
     1281        '--srcnodata',
     1282        dest="srcnodata",
     1283        metavar="NODATA",
     1284        help="NODATA transparency value to assign to the input data"
     1285    )
     1286    p.add_option(
     1287        '-d',
     1288        '--tmscompatible',
     1289        dest="tmscompatible",
     1290        action="store_true",
     1291        help=(
     1292            "When using the geodetic profile, specifies the base resolution "
     1293            "as 0.703125 or 2 tiles at zoom level 0."
     1294        )
     1295    )
     1296    p.add_option(
     1297        "-v",
     1298        "--verbose",
     1299        action="store_true",
     1300        dest="verbose",
     1301        help="Print status messages to stdout"
     1302    )
     1303    p.add_option(
     1304        "-x",
     1305        "--exclude",
     1306        action="store_true",
     1307        dest="exclude_transparent",
     1308        help="Exclude transparent tiles from result tileset"
     1309    )
     1310    p.add_option(
     1311        "-q",
     1312        "--quiet",
     1313        action="store_true",
     1314        dest="quiet",
     1315        help="Disable messages and status to stdout"
     1316    )
     1317    p.add_option(
     1318        "--processes",
     1319        dest="nb_processes",
     1320        type='int',
     1321        help="Number of processes to use for tiling"
     1322    )
     1323    p.add_option(
     1324        "--tilesize",
     1325        dest="tilesize",
     1326        default=256,
     1327        type='int',
     1328        help="Tile size in pixel of a tile"
     1329    )
    11641330
    11651331    # KML options
    1166     g = OptionGroup(p, "KML (Google Earth) options",
    1167                     "Options for generated Google Earth SuperOverlay metadata")
    1168     g.add_option("-k", "--force-kml", dest='kml', action="store_true",
    1169                  help=("Generate KML for Google Earth - default for 'geodetic' profile and "
    1170                        "'raster' in EPSG:4326. For a dataset with different projection use "
    1171                        "with caution!"))
    1172     g.add_option("-n", "--no-kml", dest='kml', action="store_false",
    1173                  help="Avoid automatic generation of KML files for EPSG:4326")
    1174     g.add_option("-u", "--url", dest='url',
    1175                  help="URL address where the generated tiles are going to be published")
     1332    g = OptionGroup(
     1333        p, "KML (Google Earth) options",
     1334        "Options for generated Google Earth SuperOverlay metadata"
     1335    )
     1336    g.add_option(
     1337        "-k",
     1338        "--force-kml",
     1339        dest='kml',
     1340        action="store_true",
     1341        help=(
     1342            "Generate KML for Google Earth - default for 'geodetic' profile and "
     1343            "'raster' in EPSG:4326. For a dataset with different projection use "
     1344            "with caution!"
     1345        )
     1346    )
     1347    g.add_option(
     1348        "-n",
     1349        "--no-kml",
     1350        dest='kml',
     1351        action="store_false",
     1352        help="Avoid automatic generation of KML files for EPSG:4326"
     1353    )
     1354    g.add_option(
     1355        "-u",
     1356        "--url",
     1357        dest='url',
     1358        help="URL address where the generated tiles are going to be published"
     1359    )
    11761360    p.add_option_group(g)
    11771361
    11781362    # HTML options
    1179     g = OptionGroup(p, "Web viewer options",
    1180                     "Options for generated HTML viewers a la Google Maps")
    1181     g.add_option("-w", "--webviewer", dest='webviewer', type='choice', choices=webviewer_list,
    1182                  help="Web viewer to generate (%s) - default 'all'" % ",".join(webviewer_list))
    1183     g.add_option("-t", "--title", dest='title',
    1184                  help="Title of the map")
    1185     g.add_option("-c", "--copyright", dest='copyright',
    1186                  help="Copyright for the map")
    1187     g.add_option("-g", "--googlekey", dest='googlekey',
    1188                  help="Google Maps API key from http://code.google.com/apis/maps/signup.html")
    1189     g.add_option("-b", "--bingkey", dest='bingkey',
    1190                  help="Bing Maps API key from https://www.bingmapsportal.com/")
     1363    g = OptionGroup(
     1364        p, "Web viewer options",
     1365        "Options for generated HTML viewers a la Google Maps"
     1366    )
     1367    g.add_option(
     1368        "-w",
     1369        "--webviewer",
     1370        dest='webviewer',
     1371        type='choice',
     1372        choices=webviewer_list,
     1373        help="Web viewer to generate (%s) - default 'all'" %
     1374        ",".join(webviewer_list)
     1375    )
     1376    g.add_option("-t", "--title", dest='title', help="Title of the map")
     1377    g.add_option(
     1378        "-c", "--copyright", dest='copyright', help="Copyright for the map"
     1379    )
     1380    g.add_option(
     1381        "-g",
     1382        "--googlekey",
     1383        dest='googlekey',
     1384        help=
     1385        "Google Maps API key from http://code.google.com/apis/maps/signup.html"
     1386    )
     1387    g.add_option(
     1388        "-b",
     1389        "--bingkey",
     1390        dest='bingkey',
     1391        help="Bing Maps API key from https://www.bingmapsportal.com/"
     1392    )
    11911393    p.add_option_group(g)
    11921394
    1193     p.set_defaults(verbose=False, profile="mercator", kml=False, url='',
    1194                    webviewer='all', copyright='', resampling='average', resume=False,
    1195                    googlekey='INSERT_YOUR_KEY_HERE', bingkey='INSERT_YOUR_KEY_HERE',
    1196                    processes=1)
     1395    p.set_defaults(
     1396        verbose=False,
     1397        profile="mercator",
     1398        kml=False,
     1399        url='',
     1400        webviewer='all',
     1401        copyright='',
     1402        resampling='average',
     1403        resume=False,
     1404        googlekey='INSERT_YOUR_KEY_HERE',
     1405        bingkey='INSERT_YOUR_KEY_HERE',
     1406        processes=1
     1407    )
    11971408
    11981409    return p
    … …  
    12051416    # Args should be either an input file OR an input file and an output folder
    12061417    if not args:
    1207         exit_with_error("You need to specify at least an input file as argument to the script")
     1418        exit_with_error(
     1419            "You need to specify at least an input file as argument to the script"
     1420        )
    12081421    if len(args) > 2:
    1209         exit_with_error("Processing of several input files is not supported.",
    1210                         "Please first use a tool like gdal_vrtmerge.py or gdal_merge.py on the "
    1211                         "files: gdal_vrtmerge.py -o merged.vrt %s" % " ".join(args))
     1422        exit_with_error(
     1423            "Processing of several input files is not supported.",
     1424            "Please first use a tool like gdal_vrtmerge.py or gdal_merge.py on the "
     1425            "files: gdal_vrtmerge.py -o merged.vrt %s" % " ".join(args)
     1426        )
    12121427
    12131428    input_file = args[0]
    12141429    if not os.path.isfile(input_file):
    1215         exit_with_error("The provided input file %s does not exist or is not a file" % input_file)
     1430        exit_with_error(
     1431            "The provided input file %s does not exist or is not a file" %
     1432            input_file
     1433        )
    12161434
    12171435    if len(args) == 2:
    … …  
    12401458    # Supported options
    12411459    if options.resampling == 'antialias' and not numpy_available:
    1242         exit_with_error("'antialias' resampling algorithm is not available.",
    1243                         "Install PIL (Python Imaging Library) and numpy.")
     1460        exit_with_error(
     1461            "'antialias' resampling algorithm is not available.",
     1462            "Install PIL (Python Imaging Library) and numpy."
     1463        )
    12441464
    12451465    try:
    … …  
    12531473    if not full_ascii and 'UTF-8' not in os.environ.get("LC_CTYPE", ""):
    12541474        if not options.quiet:
    1255             print("\nWARNING: "
    1256                   "You are running gdal2tiles.py with a LC_CTYPE environment variable that is "
    1257                   "not UTF-8 compatible, and your input file contains non-ascii characters. "
    1258                   "The generated sample googlemaps, openlayers or "
    1259                   "leaflet files might contain some invalid characters as a result\n")
     1475            print(
     1476                "\nWARNING: "
     1477                "You are running gdal2tiles.py with a LC_CTYPE environment variable that is "
     1478                "not UTF-8 compatible, and your input file contains non-ascii characters. "
     1479                "The generated sample googlemaps, openlayers or "
     1480                "leaflet files might contain some invalid characters as a result\n"
     1481            )
    12601482
    12611483    # Output the results
    … …  
    13401562
    13411563class GDAL2Tiles(object):
    1342 
    13431564    def __init__(self, input_file, output_folder, options):
    13441565        """Constructor function - initialization"""
    … …  
    13751596        self.tileext = 'png'
    13761597        self.tmp_dir = tempfile.mkdtemp()
    1377         self.tmp_vrt_filename = os.path.join(self.tmp_dir, str(uuid4()) + '.vrt')
     1598        self.tmp_vrt_filename = os.path.join(
     1599            self.tmp_dir,
     1600            str(uuid4()) + '.vrt'
     1601        )
    13781602
    13791603        # Should we read bigger window of the input raster and scale it down?
    … …  
    14271651
    14281652        if not self.out_drv:
    1429             raise Exception("The '%s' driver was not found, is it available in this GDAL build?" %
    1430                             self.tiledriver)
     1653            raise Exception(
     1654                "The '%s' driver was not found, is it available in this GDAL build?"
     1655                % self.tiledriver
     1656            )
    14311657        if not self.mem_drv:
    1432             raise Exception("The 'MEM' driver was not found, is it available in this GDAL build?")
     1658            raise Exception(
     1659                "The 'MEM' driver was not found, is it available in this GDAL build?"
     1660            )
    14331661
    14341662        # Open the input file
    … …  
    14401668
    14411669        if self.options.verbose:
    1442             print("Input file:",
    1443                   "( %sP x %sL - %s bands)" % (input_dataset.RasterXSize,
    1444                                                input_dataset.RasterYSize,
    1445                                                input_dataset.RasterCount))
     1670            print(
     1671                "Input file:", "( %sP x %sL - %s bands)" % (
     1672                    input_dataset.RasterXSize, input_dataset.RasterYSize,
     1673                    input_dataset.RasterCount
     1674                )
     1675            )
    14461676
    14471677        if not input_dataset:
    14481678            # Note: GDAL prints the ERROR message too
    1449             exit_with_error("It is not possible to open the input file '%s'." % self.input_file)
     1679            exit_with_error(
     1680                "It is not possible to open the input file '%s'." %
     1681                self.input_file
     1682            )
    14501683
    14511684        # Read metadata from the input file
    14521685        if input_dataset.RasterCount == 0:
    1453             exit_with_error("Input file '%s' has no raster band" % self.input_file)
     1686            exit_with_error(
     1687                "Input file '%s' has no raster band" % self.input_file
     1688            )
    14541689
    14551690        if input_dataset.GetRasterBand(1).GetRasterColorTable():
    … …  
    14651700
    14661701        if self.options.verbose:
    1467             print("Preprocessed file:",
    1468                   "( %sP x %sL - %s bands)" % (input_dataset.RasterXSize,
    1469                                                input_dataset.RasterYSize,
    1470                                                input_dataset.RasterCount))
     1702            print(
     1703                "Preprocessed file:", "( %sP x %sL - %s bands)" % (
     1704                    input_dataset.RasterXSize, input_dataset.RasterYSize,
     1705                    input_dataset.RasterCount
     1706                )
     1707            )
    14711708
    14721709        in_srs, self.in_srs_wkt = setup_input_srs(input_dataset, self.options)
    … …  
    14841721                exit_with_error(
    14851722                    "Input file has unknown SRS.",
    1486                     "Use --s_srs ESPG:xyz (or similar) to provide source reference system.")
     1723                    "Use --s_srs ESPG:xyz (or similar) to provide source reference system."
     1724                )
    14871725
    14881726            if not has_georeference(input_dataset):
    … …  
    14941732                )
    14951733
    1496             if ((in_srs.ExportToProj4() != self.out_srs.ExportToProj4()) or
    1497                     (input_dataset.GetGCPCount() != 0)):
     1734            if ((in_srs.ExportToProj4() != self.out_srs.ExportToProj4())
     1735                or (input_dataset.GetGCPCount() != 0)):
    14981736                self.warped_input_dataset = reproject_dataset(
    1499                     input_dataset, in_srs, self.out_srs)
     1737                    input_dataset, in_srs, self.out_srs
     1738                )
    15001739
    15011740                if in_nodata:
    15021741                    self.warped_input_dataset = update_no_data_values(
    1503                         self.warped_input_dataset, in_nodata, options=self.options)
     1742                        self.warped_input_dataset,
     1743                        in_nodata,
     1744                        options=self.options
     1745                    )
    15041746                else:
    15051747                    self.warped_input_dataset = update_alpha_value_for_non_alpha_inputs(
    1506                         self.warped_input_dataset, options=self.options)
     1748                        self.warped_input_dataset, options=self.options
     1749                    )
    15071750
    15081751            if self.warped_input_dataset and self.options.verbose:
    1509                 print("Projected file:", "tiles.vrt", "( %sP x %sL - %s bands)" % (
    1510                     self.warped_input_dataset.RasterXSize,
    1511                     self.warped_input_dataset.RasterYSize,
    1512                     self.warped_input_dataset.RasterCount))
     1752                print(
     1753                    "Projected file:", "tiles.vrt",
     1754                    "( %sP x %sL - %s bands)" % (
     1755                        self.warped_input_dataset.RasterXSize,
     1756                        self.warped_input_dataset.RasterYSize,
     1757                        self.warped_input_dataset.RasterCount
     1758                    )
     1759                )
    15131760
    15141761        if not self.warped_input_dataset:
    15151762            self.warped_input_dataset = input_dataset
    15161763
    1517         gdal.GetDriverByName('VRT').CreateCopy(self.tmp_vrt_filename,
    1518                                                self.warped_input_dataset)
     1764        gdal.GetDriverByName('VRT').CreateCopy(
     1765            self.tmp_vrt_filename, self.warped_input_dataset
     1766        )
    15191767
    15201768        # Get alpha band (either directly or from NODATA value)
    1521         self.alphaband = self.warped_input_dataset.GetRasterBand(1).GetMaskBand()
     1769        self.alphaband = self.warped_input_dataset.GetRasterBand(
     1770            1
     1771        ).GetMaskBand()
    15221772        self.dataBandsCount = nb_data_bands(self.warped_input_dataset)
    15231773
    … …  
    15261776        srs4326 = osr.SpatialReference()
    15271777        srs4326.ImportFromEPSG(4326)
    1528         if self.out_srs and srs4326.ExportToProj4() == self.out_srs.ExportToProj4():
     1778        if self.out_srs and srs4326.ExportToProj4(
     1779        ) == self.out_srs.ExportToProj4():
    15291780            self.kml = True
    15301781            self.isepsg4326 = True
    … …  
    15391790        # Report error in case rotation/skew is in geotransform (possible only in 'raster' profile)
    15401791        if (self.out_gt[2], self.out_gt[4]) != (0, 0):
    1541             exit_with_error("Georeference of the raster contains rotation or skew. "
    1542                             "Such raster is not supported. Please use gdalwarp first.")
     1792            exit_with_error(
     1793                "Georeference of the raster contains rotation or skew. "
     1794                "Such raster is not supported. Please use gdalwarp first."
     1795            )
    15431796
    15441797        # Here we expect: pixel is square, no rotation on the raster
    … …  
    15461799        # Output Bounds - coordinates in the output SRS
    15471800        self.ominx = self.out_gt[0]
    1548         self.omaxx = self.out_gt[0] + self.warped_input_dataset.RasterXSize * self.out_gt[1]
     1801        self.omaxx = self.out_gt[
     1802            0] + self.warped_input_dataset.RasterXSize * self.out_gt[1]
    15491803        self.omaxy = self.out_gt[3]
    1550         self.ominy = self.out_gt[3] - self.warped_input_dataset.RasterYSize * self.out_gt[1]
     1804        self.ominy = self.out_gt[
     1805            3] - self.warped_input_dataset.RasterYSize * self.out_gt[1]
    15511806        # Note: maybe round(x, 14) to avoid the gdal_translate behaviour, when 0 becomes -1e-15
    15521807
    15531808        if self.options.verbose:
    1554             print("Bounds (output srs):", round(self.ominx, 13), self.ominy, self.omaxx, self.omaxy)
     1809            print(
     1810                "Bounds (output srs):", round(self.ominx, 13), self.ominy,
     1811                self.omaxx, self.omaxy
     1812            )
    15551813
    15561814        # Calculating ranges for tiles in different zoom levels
    … …  
    15651823            self.tminmax = list(range(0, 32))
    15661824            for tz in range(0, 32):
    1567                 tminx, tminy = self.mercator.MetersToTile(self.ominx, self.ominy, tz)
    1568                 tmaxx, tmaxy = self.mercator.MetersToTile(self.omaxx, self.omaxy, tz)
     1825                tminx, tminy = self.mercator.MetersToTile(
     1826                    self.ominx, self.ominy, tz
     1827                )
     1828                tmaxx, tmaxy = self.mercator.MetersToTile(
     1829                    self.omaxx, self.omaxy, tz
     1830                )
    15691831                # crop tiles extending world limits (+-180,+-90)
    15701832                tminx, tminy = max(0, tminx), max(0, tminy)
    … …  
    15771839            if self.tminz is None:
    15781840                self.tminz = self.mercator.ZoomForPixelSize(
    1579                     self.out_gt[1] *
    1580                     max(self.warped_input_dataset.RasterXSize,
    1581                         self.warped_input_dataset.RasterYSize) /
    1582                     float(self.tile_size))
     1841                    self.out_gt[1] * max(
     1842                        self.warped_input_dataset.RasterXSize,
     1843                        self.warped_input_dataset.RasterYSize
     1844                    ) / float(self.tile_size)
     1845                )
    15831846
    15841847            # Get the maximal zoom level
    … …  
    15881851
    15891852            if self.options.verbose:
    1590                 print("Bounds (latlong):",
    1591                       self.mercator.MetersToLatLon(self.ominx, self.ominy),
    1592                       self.mercator.MetersToLatLon(self.omaxx, self.omaxy))
     1853                print(
     1854                    "Bounds (latlong):",
     1855                    self.mercator.MetersToLatLon(self.ominx, self.ominy),
     1856                    self.mercator.MetersToLatLon(self.omaxx, self.omaxy)
     1857                )
    15931858                print('MinZoomLevel:', self.tminz)
    1594                 print("MaxZoomLevel:",
    1595                       self.tmaxz,
    1596                       "(",
    1597                       self.mercator.Resolution(self.tmaxz),
    1598                       ")")
     1859                print(
     1860                    "MaxZoomLevel:", self.tmaxz, "(",
     1861                    self.mercator.Resolution(self.tmaxz), ")"
     1862                )
    15991863
    16001864        if self.options.profile == 'geodetic':
    16011865
    1602             self.geodetic = GlobalGeodetic(self.options.tmscompatible, tile_size=self.tile_size)
     1866            self.geodetic = GlobalGeodetic(
     1867                self.options.tmscompatible, tile_size=self.tile_size
     1868            )
    16031869
    16041870            # Function which generates SWNE in LatLong for given tile
    … …  
    16081874            self.tminmax = list(range(0, 32))
    16091875            for tz in range(0, 32):
    1610                 tminx, tminy = self.geodetic.LonLatToTile(self.ominx, self.ominy, tz)
    1611                 tmaxx, tmaxy = self.geodetic.LonLatToTile(self.omaxx, self.omaxy, tz)
     1876                tminx, tminy = self.geodetic.LonLatToTile(
     1877                    self.ominx, self.ominy, tz
     1878                )
     1879                tmaxx, tmaxy = self.geodetic.LonLatToTile(
     1880                    self.omaxx, self.omaxy, tz
     1881                )
    16121882                # crop tiles extending world limits (+-180,+-90)
    16131883                tminx, tminy = max(0, tminx), max(0, tminy)
    1614                 tmaxx, tmaxy = min(2**(tz + 1) - 1, tmaxx), min(2**tz - 1, tmaxy)
     1884                tmaxx, tmaxy = min(2**(tz + 1) - 1,
     1885                                   tmaxx), min(2**tz - 1, tmaxy)
    16151886                self.tminmax[tz] = (tminx, tminy, tmaxx, tmaxy)
    16161887
    … …  
    16211892            if self.tminz is None:
    16221893                self.tminz = self.geodetic.ZoomForPixelSize(
    1623                     self.out_gt[1] *
    1624                     max(self.warped_input_dataset.RasterXSize,
    1625                         self.warped_input_dataset.RasterYSize) /
    1626                     float(self.tile_size))
     1894                    self.out_gt[1] * max(
     1895                        self.warped_input_dataset.RasterXSize,
     1896                        self.warped_input_dataset.RasterYSize
     1897                    ) / float(self.tile_size)
     1898                )
    16271899
    16281900            # Get the maximal zoom level
    … …  
    16321904
    16331905            if self.options.verbose:
    1634                 print("Bounds (latlong):", self.ominx, self.ominy, self.omaxx, self.omaxy)
     1906                print(
     1907                    "Bounds (latlong):", self.ominx, self.ominy, self.omaxx,
     1908                    self.omaxy
     1909                )
    16351910
    16361911        if self.options.profile == 'raster':
    … …  
    16401915
    16411916            self.nativezoom = int(
    1642                 max(math.ceil(log2(self.warped_input_dataset.RasterXSize / float(self.tile_size))),
    1643                     math.ceil(log2(self.warped_input_dataset.RasterYSize / float(self.tile_size)))))
     1917                max(
     1918                    math.ceil(
     1919                        log2(
     1920                            self.warped_input_dataset.RasterXSize /
     1921                            float(self.tile_size)
     1922                        )
     1923                    ),
     1924                    math.ceil(
     1925                        log2(
     1926                            self.warped_input_dataset.RasterYSize /
     1927                            float(self.tile_size)
     1928                        )
     1929                    )
     1930                )
     1931            )
    16441932
    16451933            if self.options.verbose:
    … …  
    16601948                tsize = 2.0**(self.nativezoom - tz) * self.tile_size
    16611949                tminx, tminy = 0, 0
    1662                 tmaxx = int(math.ceil(self.warped_input_dataset.RasterXSize / tsize)) - 1
    1663                 tmaxy = int(math.ceil(self.warped_input_dataset.RasterYSize / tsize)) - 1
     1950                tmaxx = int(
     1951                    math.ceil(self.warped_input_dataset.RasterXSize / tsize)
     1952                ) - 1
     1953                tmaxy = int(
     1954                    math.ceil(self.warped_input_dataset.RasterYSize / tsize)
     1955                ) - 1
    16641956                self.tsize[tz] = math.ceil(tsize)
    16651957                self.tminmax[tz] = (tminx, tminy, tmaxx, tmaxy)
    … …  
    16701962
    16711963                def rastertileswne(x, y, z):
    1672                     pixelsizex = (2**(self.tmaxz - z) * self.out_gt[1])       # X-pixel size in level
     1964                    pixelsizex = (
     1965                        2**(self.tmaxz - z) * self.out_gt[1]
     1966                    )  # X-pixel size in level
    16731967                    west = self.out_gt[0] + x * self.tile_size * pixelsizex
    16741968                    east = west + self.tile_size * pixelsizex
    … …  
    16831977                self.tileswne = rastertileswne
    16841978            else:
    1685                 self.tileswne = lambda x, y, z: (0, 0, 0, 0)   # noqa
     1979                self.tileswne = lambda x, y, z: (0, 0, 0, 0)  # noqa
    16861980
    16871981    def generate_metadata(self):
    … …  
    17031997
    17041998            # Generate googlemaps.html
    1705             if self.options.webviewer in ('all', 'google') and self.options.profile == 'mercator':
    1706                 if (not self.options.resume or not
    1707                         os.path.exists(os.path.join(self.output_folder, 'googlemaps.html'))):
    1708                     with open(os.path.join(self.output_folder, 'googlemaps.html'), 'wb') as f:
     1999            if self.options.webviewer in (
     2000                'all', 'google'
     2001            ) and self.options.profile == 'mercator':
     2002                if (
     2003                    not self.options.resume or not os.path.exists(
     2004                        os.path.join(self.output_folder, 'googlemaps.html')
     2005                    )
     2006                ):
     2007                    with open(
     2008                        os.path.join(self.output_folder, 'googlemaps.html'),
     2009                        'wb'
     2010                    ) as f:
    17092011                        f.write(self.generate_googlemaps().encode('utf-8'))
    17102012
    17112013            # Generate openlayers.html
    17122014            if self.options.webviewer in ('all', 'openlayers'):
    1713                 if (not self.options.resume or not
    1714                         os.path.exists(os.path.join(self.output_folder, 'openlayers.html'))):
    1715                     with open(os.path.join(self.output_folder, 'openlayers.html'), 'wb') as f:
     2015                if (
     2016                    not self.options.resume or not os.path.exists(
     2017                        os.path.join(self.output_folder, 'openlayers.html')
     2018                    )
     2019                ):
     2020                    with open(
     2021                        os.path.join(self.output_folder, 'openlayers.html'),
     2022                        'wb'
     2023                    ) as f:
    17162024                        f.write(self.generate_openlayers().encode('utf-8'))
    17172025
    17182026            # Generate leaflet.html
    17192027            if self.options.webviewer in ('all', 'leaflet'):
    1720                 if (not self.options.resume or not
    1721                         os.path.exists(os.path.join(self.output_folder, 'leaflet.html'))):
    1722                     with open(os.path.join(self.output_folder, 'leaflet.html'), 'wb') as f:
     2028                if (
     2029                    not self.options.resume or not os.path.exists(
     2030                        os.path.join(self.output_folder, 'leaflet.html')
     2031                    )
     2032                ):
     2033                    with open(
     2034                        os.path.join(self.output_folder, 'leaflet.html'), 'wb'
     2035                    ) as f:
    17232036                        f.write(self.generate_leaflet().encode('utf-8'))
    17242037
    … …  
    17332046            # Generate openlayers.html
    17342047            if self.options.webviewer in ('all', 'openlayers'):
    1735                 if (not self.options.resume or not
    1736                         os.path.exists(os.path.join(self.output_folder, 'openlayers.html'))):
    1737                     with open(os.path.join(self.output_folder, 'openlayers.html'), 'wb') as f:
     2048                if (
     2049                    not self.options.resume or not os.path.exists(
     2050                        os.path.join(self.output_folder, 'openlayers.html')
     2051                    )
     2052                ):
     2053                    with open(
     2054                        os.path.join(self.output_folder, 'openlayers.html'),
     2055                        'wb'
     2056                    ) as f:
    17382057                        f.write(self.generate_openlayers().encode('utf-8'))
    17392058
    … …  
    17472066            # Generate openlayers.html
    17482067            if self.options.webviewer in ('all', 'openlayers'):
    1749                 if (not self.options.resume or not
    1750                         os.path.exists(os.path.join(self.output_folder, 'openlayers.html'))):
    1751                     with open(os.path.join(self.output_folder, 'openlayers.html'), 'wb') as f:
     2068                if (
     2069                    not self.options.resume or not os.path.exists(
     2070                        os.path.join(self.output_folder, 'openlayers.html')
     2071                    )
     2072                ):
     2073                    with open(
     2074                        os.path.join(self.output_folder, 'openlayers.html'),
     2075                        'wb'
     2076                    ) as f:
    17522077                        f.write(self.generate_openlayers().encode('utf-8'))
    17532078
    17542079        # Generate tilemapresource.xml.
    1755         if not self.options.resume or not os.path.exists(os.path.join(self.output_folder, 'tilemapresource.xml')):
    1756             with open(os.path.join(self.output_folder, 'tilemapresource.xml'), 'wb') as f:
     2080        if not self.options.resume or not os.path.exists(
     2081            os.path.join(self.output_folder, 'tilemapresource.xml')
     2082        ):
     2083            with open(
     2084                os.path.join(self.output_folder, 'tilemapresource.xml'), 'wb'
     2085            ) as f:
    17572086                f.write(self.generate_tilemapresource().encode('utf-8'))
    17582087
    … …  
    17672096            # Generate Root KML
    17682097            if self.kml:
    1769                 if (not self.options.resume or not
    1770                         os.path.exists(os.path.join(self.output_folder, 'doc.kml'))):
    1771                     with open(os.path.join(self.output_folder, 'doc.kml'), 'wb') as f:
    1772                         f.write(generate_kml(
    1773                             None, None, None, self.tileext, self.tile_size, self.tileswne,
    1774                             self.options, children
    1775                         ).encode('utf-8'))
     2098                if (
     2099                    not self.options.resume or not os.path.exists(
     2100                        os.path.join(self.output_folder, 'doc.kml')
     2101                    )
     2102                ):
     2103                    with open(
     2104                        os.path.join(self.output_folder, 'doc.kml'), 'wb'
     2105                    ) as f:
     2106                        f.write(
     2107                            generate_kml(
     2108                                None, None, None, self.tileext, self.tile_size,
     2109                                self.tileswne, self.options, children
     2110                            ).encode('utf-8')
     2111                        )
    17762112
    17772113    def generate_base_tiles(self):
    … …  
    18112147                ti += 1
    18122148                tilefilename = os.path.join(
    1813                     self.output_folder, str(tz), str(tx), "%s.%s" % (ty, self.tileext))
     2149                    self.output_folder, str(tz), str(tx),
     2150                    "%s.%s" % (ty, self.tileext)
     2151                )
    18142152                if self.options.verbose:
    18152153                    print(ti, '/', tcount, tilefilename)
    … …  
    18392177                    nativesize = wb[0] + wb[2]
    18402178                    if self.options.verbose:
    1841                         print("\tNative Extent (querysize", nativesize, "): ", rb, wb)
     2179                        print(
     2180                            "\tNative Extent (querysize", nativesize, "): ",
     2181                            rb, wb
     2182                        )
    18422183
    18432184                    # Tile bounds in raster coordinates for ReadRaster query
    1844                     rb, wb = self.geo_query(ds, b[0], b[3], b[2], b[1], querysize=querysize)
     2185                    rb, wb = self.geo_query(
     2186                        ds, b[0], b[3], b[2], b[1], querysize=querysize
     2187                    )
    18452188
    18462189                    rx, ry, rxsize, rysize = rb
    18472190                    wx, wy, wxsize, wysize = wb
    18482191
    1849                 else:     # 'raster' profile:
    1850 
    1851                     tsize = int(self.tsize[tz])   # tile_size in raster coordinates for actual zoom
    1852                     xsize = self.warped_input_dataset.RasterXSize     # size of the raster in pixels
     2192                else:  # 'raster' profile:
     2193
     2194                    tsize = int(
     2195                        self.tsize[tz]
     2196                    )  # tile_size in raster coordinates for actual zoom
     2197                    xsize = self.warped_input_dataset.RasterXSize  # size of the raster in pixels
    18532198                    ysize = self.warped_input_dataset.RasterYSize
    18542199                    if tz >= self.nativezoom:
    … …  
    18792224                tile_details.append(
    18802225                    TileDetail(
    1881                         tx=tx, ty=ty, tz=tz, rx=rx, ry=ry, rxsize=rxsize, rysize=rysize, wx=wx,
    1882                         wy=wy, wxsize=wxsize, wysize=wysize, querysize=querysize,
     2226                        tx=tx,
     2227                        ty=ty,
     2228                        tz=tz,
     2229                        rx=rx,
     2230                        ry=ry,
     2231                        rxsize=rxsize,
     2232                        rysize=rysize,
     2233                        wx=wx,
     2234                        wy=wy,
     2235                        wxsize=wxsize,
     2236                        wysize=wysize,
     2237                        querysize=querysize,
    18832238                    )
    18842239                )
    … …  
    19842339      <TileFormat width="%(tile_size)d" height="%(tile_size)d" mime-type="image/%(tileformat)s" extension="%(tileformat)s"/>
    19852340      <TileSets profile="%(profile)s">
    1986 """ % args    # noqa
     2341""" % args  # noqa
    19872342        for z in range(self.tminz, self.tmaxz + 1):
    19882343            if self.options.profile == 'raster':
    19892344                s += """        <TileSet href="%s%d" units-per-pixel="%.14f" order="%d"/>\n""" % (
    1990                     args['publishurl'], z, (2**(self.nativezoom - z) * self.out_gt[1]), z)
     2345                    args['publishurl'], z,
     2346                    (2**(self.nativezoom - z) * self.out_gt[1]), z
     2347                )
    19912348            elif self.options.profile == 'mercator':
    19922349                s += """        <TileSet href="%s%d" units-per-pixel="%.14f" order="%d"/>\n""" % (
    1993                     args['publishurl'], z, 156543.0339 / 2**z, z)
     2350                    args['publishurl'], z, 156543.0339 / 2**z, z
     2351                )
    19942352            elif self.options.profile == 'geodetic':
    19952353                s += """        <TileSet href="%s%d" units-per-pixel="%.14f" order="%d"/>\n""" % (
    1996                     args['publishurl'], z, 0.703125 / 2**z, z)
     2354                    args['publishurl'], z, 0.703125 / 2**z, z
     2355                )
    19972356        s += """      </TileSets>
    19982357    </TileMap>
    … …  
    22412600                      map.addControl(new GHierarchicalMapTypeControl());
    22422601                      map.addControl(new CTransparencyControl( overlay ));
    2243         """ % args    # noqa
     2602        """ % args  # noqa
    22442603        if self.kml:
    22452604            s += """
    … …  
    22782637                   }
    22792638                }
    2280         """ % args    # noqa
     2639        """ % args  # noqa
    22812640        s += """
    22822641                onresize=function(){ resize(); };
    … …  
    22932652              </body>
    22942653            </html>
    2295         """ % args    # noqa
     2654        """ % args  # noqa
    22962655
    22972656        return s
    … …  
    24242783        </html>
    24252784
    2426         """ % args    # noqa
     2785        """ % args  # noqa
    24272786
    24282787        return s
    … …  
    24682827            .olImageLoadError { display: none; }
    24692828            .olControlLayerSwitcher .layersDiv { border-radius: 10px 0 0 10px; }
    2470         </style>""" % args    # noqa
     2829        </style>""" % args  # noqa
    24712830
    24722831        if self.options.profile == 'mercator':
    … …  
    25662925
    25672926                  map.zoomToExtent(mapBounds.transform(map.displayProjection, map.projection));
    2568           """ % args    # noqa
     2927          """ % args  # noqa
    25692928
    25702929        elif self.options.profile == 'geodetic':
    … …  
    26042963
    26052964                  map.zoomToExtent(mapBounds);
    2606            """ % args   # noqa
     2965           """ % args  # noqa
    26072966
    26082967        elif self.options.profile == 'raster':
    … …  
    26282987                  map.addLayer(layer);
    26292988                  map.zoomToExtent(mapBounds);
    2630         """ % args    # noqa
     2989        """ % args  # noqa
    26312990
    26322991        s += """
    … …  
    26613020                  }
    26623021              }
    2663             """ % args    # noqa
     3022            """ % args  # noqa
    26643023
    26653024        elif self.options.profile == 'geodetic':
    … …  
    26823041                  }
    26833042              }
    2684             """ % args    # noqa
     3043            """ % args  # noqa
    26853044
    26863045        elif self.options.profile == 'raster':
    … …  
    27033062                  }
    27043063              }
    2705             """ % args    # noqa
     3064            """ % args  # noqa
    27063065
    27073066        s += """
    … …  
    27453104                <script type="text/javascript" >resize()</script>
    27463105              </body>
    2747             </html>""" % args   # noqa
     3106            </html>""" % args  # noqa
    27483107
    27493108        return s
    … …  
    27753134
    27763135class ProgressBar(object):
    2777 
    27783136    def __init__(self, total_items):
    27793137        self.total_items = total_items
    … …  
    28203178
    28213179            def rastertileswne(x, y, z):
    2822                 pixelsizex = (2 ** (tile_job_info.tmaxz - z) * tile_job_info.out_geo_trans[1])
    2823                 west = tile_job_info.out_geo_trans[0] + x * tile_job_info.tile_size * pixelsizex
     3180                pixelsizex = (
     3181                    2**(tile_job_info.tmaxz - z) *
     3182                    tile_job_info.out_geo_trans[1]
     3183                )
     3184                west = tile_job_info.out_geo_trans[
     3185                    0] + x * tile_job_info.tile_size * pixelsizex
    28243186                east = west + tile_job_info.tile_size * pixelsizex
    28253187                south = tile_job_info.ominy + y * tile_job_info.tile_size * pixelsizex
    … …  
    28333195            tile_swne = rastertileswne
    28343196        else:
    2835             tile_swne = lambda x, y, z: (0, 0, 0, 0)   # noqa
     3197            tile_swne = lambda x, y, z: (0, 0, 0, 0)  # noqa
    28363198    else:
    2837         tile_swne = lambda x, y, z: (0, 0, 0, 0)   # noqa
     3199        tile_swne = lambda x, y, z: (0, 0, 0, 0)  # noqa
    28383200
    28393201    return tile_swne
    … …  
    28473209    if options.verbose:
    28483210        print("Begin tiles details calc")
    2849     conf, tile_details = worker_tile_details(input_file, output_folder, options)
     3211    conf, tile_details = worker_tile_details(
     3212        input_file, output_folder, options
     3213    )
    28503214
    28513215    if options.verbose:
    … …  
    28803244    if options.verbose:
    28813245        print("Begin tiles details calc")
    2882     p = Process(target=worker_tile_details,
    2883                 args=[input_file, output_folder, options],
    2884                 kwargs={"send_pipe": conf_sender})
     3246    p = Process(
     3247        target=worker_tile_details,
     3248        args=[input_file, output_folder, options],
     3249        kwargs={"send_pipe": conf_sender}
     3250    )
    28853251    p.start()
    28863252    # Make sure to consume the queue before joining. If the payload is too big, it won't be put in
    … …  
    28993265    # TODO: gbataille - assign an ID to each job for print in verbose mode "ReadRaster Extent ..."
    29003266    for tile_detail in tile_details:
    2901         pool.apply_async(create_base_tile, (conf, tile_detail), {"queue": queue})
     3267        pool.apply_async(
     3268            create_base_tile, (conf, tile_detail), {"queue": queue}
     3269        )
    29023270
    29033271    if not options.verbose and not options.quiet:
    2904         p = Process(target=progress_printer_thread, args=[queue, len(tile_details)])
     3272        p = Process(
     3273            target=progress_printer_thread, args=[queue,
     3274                                                  len(tile_details)]
     3275        )
    29053276        p.start()
    29063277
    29073278    pool.close()
    2908     pool.join()     # Jobs finished
     3279    pool.join()  # Jobs finished
    29093280    if not options.verbose and not options.quiet:
    2910         p.join()        # Traces done
     3281        p.join()  # Traces done
    29113282
    29123283    create_overview_tiles(conf, output_folder, options)
  • src/gnuboat/common/bin/gnuboat-log-analyser

    r77cd9cf r43fd35c  
    22# -*- coding: utf-8 -*-
    33'''
    4     Copyright (C) 2018 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     4    Copyright (C) 2018 - 2020 EngSaS - Langenbach. All rights reserved.
    55
    66    This program is free software: you can redistribute it and/or modify
  • src/gnuboat/common/bin/gnuboat-log-converter

    r77cd9cf r43fd35c  
    22# -*- coding: utf-8 -*-
    33'''
    4     Copyright (C) 2016 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     4    Copyright (C) 2016 - 2020 EngSaS - Langenbach. All rights reserved.
    55
    66    This program is free software: you can redistribute it and/or modify
  • src/gnuboat/common/bin/gnuboat-log-uploader

    r77cd9cf r43fd35c  
    22# -*- coding: utf-8 -*-
    33'''
    4     Copyright (C) 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     4    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
    55
    66    This program is free software: you can redistribute it and/or modify
  • src/gnuboat/common/css/GnuBoat.Colors.css

    r77cd9cf r43fd35c  
    11/*
    2     Copyright (C) 2018 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2018 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
  • src/gnuboat/common/css/side-menu.css

    r77cd9cf r43fd35c  
    11/*
    2     Copyright (C) 2017 - 2019 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2017 - 2019 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
  • src/gnuboat/common/datahandler/__init__.py

    r77cd9cf r43fd35c  
    11# -*- coding: utf-8 -*-
    22'''
    3     Copyright (C) 2018 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     3    Copyright (C) 2018 - 2020 EngSaS - Langenbach. All rights reserved.
    44
    55    This program is free software: you can redistribute it and/or modify
  • src/gnuboat/common/datahandler/logdataset.py

    r77cd9cf r43fd35c  
    11# -*- coding: utf-8 -*-
    22'''
    3     Copyright (C) 2016 - 2018 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     3    Copyright (C) 2016 - 2018 EngSaS - Langenbach. All rights reserved.
    44
    55    This program is free software: you can redistribute it and/or modify
  • src/gnuboat/common/datahandler/loghandler.py

    r77cd9cf r43fd35c  
    11# -*- coding: utf-8 -*-
    22'''
    3     Copyright (C) 2016 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     3    Copyright (C) 2016 - 2020 EngSaS - Langenbach. All rights reserved.
    44
    55    This program is free software: you can redistribute it and/or modify
    … …  
    2525import math
    2626
    27 from gnuboat_common.datahandler import logdataset
     27from gnuboat.common.datahandler import logdataset
    2828
    2929
  • src/gnuboat/common/js/GnuBoat.js

    r77cd9cf r43fd35c  
    11/*
    22
    3     Copyright (C) 2016 - 2018 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     3    Copyright (C) 2016 - 2018 EngSaS - Langenbach. All rights reserved.
    44
    55    This library is free software; you can redistribute it and/or
  • src/gnuboat/common/spatial/__init__.py

    r77cd9cf r43fd35c  
    11# -*- coding: utf-8 -*-
    22'''
    3     Copyright (C) 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     3    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
    44
    55    This program is free software: you can redistribute it and/or modify
  • src/gnuboat/common/spatial/tilegenerator.py

    r77cd9cf r43fd35c  
    11# -*- coding: utf-8 -*-
    22'''
    3     Copyright (C) 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     3    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
    44
    55    This program is free software: you can redistribute it and/or modify
  • src/gnuboat/common/tests/__init__.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
  • src/gnuboat/common/tests/test_tilegenerator.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    2828from osgeo import osr
    2929
    30 from gnuboat_common.spatial import tilegenerator
     30from gnuboat.common.spatial import tilegenerator
    3131
    3232
  • src/gnuboat/device/bin/gnuboat

    r77cd9cf r43fd35c  
    22# -*- coding: utf-8 -*-
    33'''
    4     Copyright (C) 2016 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     4    Copyright (C) 2016 - 2020 EngSaS - Langenbach. All rights reserved.
    55
    66    This program is free software: you can redistribute it and/or modify
    … …  
    3333import math
    3434
    35 from gnuboat import daemon
    36 from gnuboat_common.datahandler import loghandler, logdataset
     35from gnuboat.device.daemon import (
     36    n2kdpoller as n2kdpoller,
     37    gpsdpoller as gpsdpoller,
     38    displayhandler as displayhandler,
     39    rrdhandler as rrdhandler
     40)
     41from gnuboat.common.datahandler import loghandler, logdataset
    3742
    3843WHITE = 1
    … …  
    6974            os.system("sudo shutdown -h now")
    7075
     76
    7177def main(argv):
    7278    global rrdfile
    … …  
    7985    global log_handler
    8086
    81     parser = argparse.ArgumentParser(description='Collects the data from canboat and gpsd and writes them to the rrd database and the nmea log file')
    82     parser.add_argument('-r', '--rrdfile', dest='rrd_file', metavar='rrd_file', type=str,
    83                         help='Path to the rrd database used by the webservice to serve the clients', default=rrdfile)
    84     parser.add_argument('-s', '--shutdownfile', dest='shutdown_file', metavar='shutdown_file', type=str,
    85                         help='Path to the shutdown request file, used by the webservice to request a shutdown of the system running gnuboat', default=shutdownfile)
    86     parser.add_argument('-lp', '--logperiod', dest='log_period', metavar='log_period', type=int,
    87                         help='Time in seconds to update the logs', default=logperiod)
    88     parser.add_argument('-lv', '--log-verbose', action='store_true', dest='log_verbose',
    89                         help='Log verbose information to nmea log file (Enables -ls and adds RMC sentences, with invalid GPS state, on non fixes (Default off)')
    90     parser.add_argument('-ls', '--log-system-time', action='store_true', dest='log_system_time',
    91                         help='Add to enable prefixing every logline with the system time (Default off)')
    92     parser.add_argument('-d', '--displayperiod', dest='display_period', metavar='display_period', type=int,
    93                         help='Time in seconds to update the display', default=displayperiod)
    94     parser.add_argument('-o', '--output', dest='output', metavar='output', type=str,
    95                         help='Directory where the log files are stored (e.g. the NMEA0183 log files)', default=logdir)
     87    parser = argparse.ArgumentParser(
     88        description=
     89        'Collects the data from canboat and gpsd and writes them to the rrd database and the nmea log file'
     90    )
     91    parser.add_argument(
     92        '-r',
     93        '--rrdfile',
     94        dest='rrd_file',
     95        metavar='rrd_file',
     96        type=str,
     97        help=
     98        'Path to the rrd database used by the webservice to serve the clients',
     99        default=rrdfile
     100    )
     101    parser.add_argument(
     102        '-s',
     103        '--shutdownfile',
     104        dest='shutdown_file',
     105        metavar='shutdown_file',
     106        type=str,
     107        help=
     108        'Path to the shutdown request file, used by the webservice to request a shutdown of the system running gnuboat',
     109        default=shutdownfile
     110    )
     111    parser.add_argument(
     112        '-lp',
     113        '--logperiod',
     114        dest='log_period',
     115        metavar='log_period',
     116        type=int,
     117        help='Time in seconds to update the logs',
     118        default=logperiod
     119    )
     120    parser.add_argument(
     121        '-lv',
     122        '--log-verbose',
     123        action='store_true',
     124        dest='log_verbose',
     125        help=
     126        'Log verbose information to nmea log file (Enables -ls and adds RMC sentences, with invalid GPS state, on non fixes (Default off)'
     127    )
     128    parser.add_argument(
     129        '-ls',
     130        '--log-system-time',
     131        action='store_true',
     132        dest='log_system_time',
     133        help=
     134        'Add to enable prefixing every logline with the system time (Default off)'
     135    )
     136    parser.add_argument(
     137        '-d',
     138        '--displayperiod',
     139        dest='display_period',
     140        metavar='display_period',
     141        type=int,
     142        help='Time in seconds to update the display',
     143        default=displayperiod
     144    )
     145    parser.add_argument(
     146        '-o',
     147        '--output',
     148        dest='output',
     149        metavar='output',
     150        type=str,
     151        help=
     152        'Directory where the log files are stored (e.g. the NMEA0183 log files)',
     153        default=logdir
     154    )
    96155    arguments = parser.parse_args(argv)
    97    
     156
    98157    if arguments.rrd_file is not None:
    99158        rrdfile = arguments.rrd_file
    … …  
    101160        shutdownfile = arguments.shutdown_file
    102161    if arguments.log_period is not None:
    103         logperiod = arguments.log_period   
     162        logperiod = arguments.log_period
    104163    if arguments.log_verbose is not None:
    105164        logverbose = arguments.log_verbose
    … …  
    113172
    114173    if not os.path.exists(os.path.dirname(rrdfile)):
    115         print('rrd database directory not found {}'.format(os.path.dirname(rrdfile)))
     174        print(
     175            'rrd database directory not found {}'.format(
     176                os.path.dirname(rrdfile)
     177            )
     178        )
    116179        parser.print_help()
    117180        sys.exit(2)
    118181
    119182    if not os.path.exists(os.path.dirname(shutdownfile)):
    120         print('Shutdown request directory not found {}'.format(os.path.dirname(shutdownfile)))
     183        print(
     184            'Shutdown request directory not found {}'.format(
     185                os.path.dirname(shutdownfile)
     186            )
     187        )
    121188        parser.print_help()
    122189        sys.exit(2)
    … …  
    128195
    129196    if displayperiod < 1 or displayperiod < logperiod:
    130         print('Display period must be >= 1 and could not be faster than log period')
    131         parser.print_help()
    132         sys.exit(2)
    133 
    134     daemon.rrd_create_database(rrdfile, logperiod)
     197        print(
     198            'Display period must be >= 1 and could not be faster than log period'
     199        )
     200        parser.print_help()
     201        sys.exit(2)
     202
     203    rrdhandler.rrd_create_database(rrdfile, logperiod)
    135204
    136205    if os.path.isfile(shutdownfile):
    137206        os.remove(shutdownfile)
    138207
    139     displayHandler = daemon.DisplayHandler(displayperiod)
     208    displayHandler = displayhandler.DisplayHandler(displayperiod)
    140209    log_handler = loghandler.LogHandler(logdir)
    141210
    142     gpsp = daemon.GpsdPoller(logperiod)
    143     n2kd = daemon.N2kdPoller(logperiod)
     211    gpsp = gpsdpoller.GpsdPoller(logperiod)
     212    n2kd = n2kdpoller.N2kdPoller(logperiod)
    144213    try:
    145214        gpsp.start()
    … …  
    159228
    160229            # update rrd database for the webservice
    161             daemon.rrd_update(rrdfile, 'N:{}:{}:{}:{}:{}:{}:{}:{}'.format(
    162                 latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix))
     230            rrdhandler.rrd_update(
     231                rrdfile, 'N:{}:{}:{}:{}:{}:{}:{}:{}'.format(
     232                    latitude, longitude, speedThroughWater, speedOverGround,
     233                    courseOverGround, waterDepth, waterTemperature, gpsFix
     234                )
     235            )
    163236
    164237            # append to log
    165             dataset = logdataset.LogDataset(None, gpsp.status(), latitude, gpsp.latitudeDirection(),
    166                 longitude, gpsp.longitudeDirection(), courseOverGround, speedOverGround,
    167                 waterDepth, waterTemperature)
    168             if not log_handler.gnuboat_write(gpsFix, gpsp.timeUtc(), dataset, n2kd.waterDepthValid(), logverbose, logsystemtime):
     238            dataset = logdataset.LogDataset(
     239                None, gpsp.status(),
     240                latitude, gpsp.latitudeDirection(), longitude,
     241                gpsp.longitudeDirection(), courseOverGround, speedOverGround,
     242                waterDepth, waterTemperature
     243            )
     244            if not log_handler.gnuboat_write(
     245                gpsFix, gpsp.timeUtc(), dataset, n2kd.waterDepthValid(),
     246                logverbose, logsystemtime
     247            ):
    169248                sys.exit(2)
    170            
     249
    171250            # display data
    172251            displayHandler.setValues(
    173                 speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix)
     252                speedThroughWater, speedOverGround, courseOverGround,
     253                waterDepth, waterTemperature, gpsFix
     254            )
    174255
    175256            # check for shutdown request
    … …  
    190271            displayHandler.join()
    191272
     273
    192274if __name__ == "__main__":
    193275    main(sys.argv[1:])
  • src/gnuboat/device/bin/gnuboat-data-generator

    r77cd9cf r43fd35c  
    22# -*- coding: utf-8 -*-
    33'''
    4     Copyright (C) 2017 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     4    Copyright (C) 2017 EngSaS - Langenbach. All rights reserved.
    55
    66    This program is free software: you can redistribute it and/or modify
    … …  
    2525import os
    2626
    27 from gnuboat import daemon
     27from gnuboat.device.daemon import rrdhandler as rrdhandler
    2828
    2929# default values for command line arguments
    … …  
    3737longitude_max = 180
    3838
     39
    3940def main(argv):
    4041    global rrdfile
    … …  
    4647    global logperiod
    4748
    48     parser = argparse.ArgumentParser(description='Generates test data for gnuboat webservice and fills the rrd database')
    49     parser.add_argument('-f', '--file', dest='rrd_database', metavar='rrd_database', type=str,
    50                         help='File path of the rrd database to fill', default="/var/lib/gnuboat/gnuboat.rrd")
    51     parser.add_argument('-lat-min', '--latitude-min', dest='lat_min', metavar='lat_min', type=float,
    52                         help='Minimum latitude generated', default=latitude_min)
    53     parser.add_argument('-lat-max', '--latitude-max', dest='lat_max', metavar='lat_max', type=float,
    54                         help='Maximum latitude generated', default=latitude_max)
    55     parser.add_argument('-lon-min', '--longitude-min', dest='lon_min', metavar='lon_min', type=float,
    56                         help='Minimum longitude generated', default=longitude_min)
    57     parser.add_argument('-lon-max', '--longitude-max', dest='lon_max', metavar='lon_max', type=float,
    58                         help='Maximum longitude generated', default=longitude_max)
    59     parser.add_argument('-l', '--logperiod', dest='logperiod', metavar='logperiod', type=int,
    60                         help='Period of data generation (seconds between two values)', default=logperiod)
     49    parser = argparse.ArgumentParser(
     50        description=
     51        'Generates test data for gnuboat webservice and fills the rrd database'
     52    )
     53    parser.add_argument(
     54        '-f',
     55        '--file',
     56        dest='rrd_database',
     57        metavar='rrd_database',
     58        type=str,
     59        help='File path of the rrd database to fill',
     60        default="/var/lib/gnuboat/gnuboat.rrd"
     61    )
     62    parser.add_argument(
     63        '-lat-min',
     64        '--latitude-min',
     65        dest='lat_min',
     66        metavar='lat_min',
     67        type=float,
     68        help='Minimum latitude generated',
     69        default=latitude_min
     70    )
     71    parser.add_argument(
     72        '-lat-max',
     73        '--latitude-max',
     74        dest='lat_max',
     75        metavar='lat_max',
     76        type=float,
     77        help='Maximum latitude generated',
     78        default=latitude_max
     79    )
     80    parser.add_argument(
     81        '-lon-min',
     82        '--longitude-min',
     83        dest='lon_min',
     84        metavar='lon_min',
     85        type=float,
     86        help='Minimum longitude generated',
     87        default=longitude_min
     88    )
     89    parser.add_argument(
     90        '-lon-max',
     91        '--longitude-max',
     92        dest='lon_max',
     93        metavar='lon_max',
     94        type=float,
     95        help='Maximum longitude generated',
     96        default=longitude_max
     97    )
     98    parser.add_argument(
     99        '-l',
     100        '--logperiod',
     101        dest='logperiod',
     102        metavar='logperiod',
     103        type=int,
     104        help='Period of data generation (seconds between two values)',
     105        default=logperiod
     106    )
    61107    arguments = parser.parse_args(argv)
    62    
     108
    63109    if arguments.rrd_database is not None:
    64110        rrdfile = arguments.rrd_database
    … …  
    78124
    79125    if not os.path.exists(os.path.dirname(rrdfile)):
    80         print('rrd database directory not found {}'.format(os.path.dirname(rrdfile)))
     126        print(
     127            'rrd database directory not found {}'.format(
     128                os.path.dirname(rrdfile)
     129            )
     130        )
    81131        parser.print_help()
    82132        sys.exit(2)
    … …  
    84134    timestamp = int(time.time())
    85135    start_time = timestamp - duration - logperiod
    86        
     136
    87137    if os.path.isfile(rrdfile):
    88138        print('Removing old database {}'.format(rrdfile))
    … …  
    90140
    91141    print('Creating {}'.format(rrdfile))
    92     daemon.rrd_create_database(rrdfile, logperiod, str(start_time))
    93    
    94     print('Filling database inside [{}, {}] --> [{}, {}]...'.format(latitude_min, longitude_min, latitude_max, longitude_max))
     142    rrdhandler.rrd_create_database(rrdfile, logperiod, str(start_time))
     143
     144    print(
     145        'Filling database inside [{}, {}] --> [{}, {}]...'.format(
     146            latitude_min, longitude_min, latitude_max, longitude_max
     147        )
     148    )
    95149    for current_time in xrange(timestamp - duration, timestamp, logperiod):
    96150        latitude = random.uniform(latitude_min, latitude_max)
    … …  
    103157        gpsFix = 3
    104158        # update rrd database for the webservice
    105         daemon.rrd_update(rrdfile, '{}:{}:{}:{}:{}:{}:{}:{}:{}'.format(
    106                        current_time, latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix))
     159        rrdhandler.rrd_update(
     160            rrdfile, '{}:{}:{}:{}:{}:{}:{}:{}:{}'.format(
     161                current_time, latitude, longitude, speedThroughWater,
     162                speedOverGround, courseOverGround, waterDepth,
     163                waterTemperature, gpsFix
     164            )
     165        )
     166
    107167
    108168if __name__ == "__main__":
  • src/gnuboat/device/bin/gnuboat-splashscreen

    r77cd9cf r43fd35c  
    11#!/usr/bin/python
    22'''
    3     Copyright (C) 2016 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     3    Copyright (C) 2016 EngSaS - Langenbach. All rights reserved.
    44
    55    This program is free software: you can redistribute it and/or modify
    … …  
    7777    displayImage(epd, image)
    7878
     79
    7980if __name__ == "__main__":
    8081    main(sys.argv[1:])
  • src/gnuboat/device/daemon/displayhandler.py

    r77cd9cf r43fd35c  
    11# -*- coding: utf-8 -*-
    22'''
    3     Copyright (C) 2016 - 2017 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     3    Copyright (C) 2016 - 2017 EngSaS - Langenbach. All rights reserved.
    44
    55    This program is free software: you can redistribute it and/or modify
    … …  
    2929    epdEnabled = False
    3030
    31 """@class DisplayHandler
    32 """
    33 
    3431
    3532class DisplayHandler(threading.Thread):
    36 
    3733    def __init__(self, displayperiod):
    3834        threading.Thread.__init__(self)
    … …  
    7066        self._gpsFix = fix
    7167
    72     def setValues(self, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix):
     68    def setValues(
     69        self, speedThroughWater, speedOverGround, courseOverGround, waterDepth,
     70        waterTemperature, gpsFix
     71    ):
    7372        self.setSpeedThroughWater(speedThroughWater)
    7473        self.setSpeedOverGround(speedOverGround)
    … …  
    8685        try:
    8786            while self._running:
    88                 self.displayValues(self._epd, self._speedThroughWater, self._speedOverGround, self._courseOverGround,
    89                                    self._waterDepth, self._waterTemperature, self._gpsFix)
     87                self.displayValues(
     88                    self._epd, self._speedThroughWater, self._speedOverGround,
     89                    self._courseOverGround, self._waterDepth,
     90                    self._waterTemperature, self._gpsFix
     91                )
    9092                time.sleep(self._updatePeriod)
    9193        except StopIteration:
    9294            pass
    9395
    94     def displayValues(self, epd, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix):
     96    def displayValues(
     97        self, epd, speedThroughWater, speedOverGround, courseOverGround,
     98        waterDepth, waterTemperature, gpsFix
     99    ):
    95100        if not epdEnabled:
    96101            return
    … …  
    98103        # requires dejavu package!!!!
    99104        fontValues = ImageFont.truetype(
    100             '/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', 34)
     105            '/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', 34
     106        )
    101107        fontTitles = ImageFont.truetype(
    102             '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 24)
     108            '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 24
     109        )
    103110
    104111        # initially set all white background
    … …  
    108115        rowHeightTitles = 25
    109116        rowHeightValues = float(
    110             height - 2 * rowHeightTitles - 3 * marginVertical) / 2.0
     117            height - 2 * rowHeightTitles - 3 * marginVertical
     118        ) / 2.0
    111119        columnWidthUnit = 30
    112120        columnWidthValues = int(
    113             float(width - 3 * marginHorizontal - 2 * columnWidthUnit) / 2.0)
     121            float(width - 3 * marginHorizontal - 2 * columnWidthUnit) / 2.0
     122        )
    114123
    115124        draw = ImageDraw.Draw(image)
    … …  
    120129        draw.text((x, y), "STW", fill=BLACK, font=fontTitles)
    121130        if speedThroughWater is not None:
    122             draw.text(
    123                 (x, y + rowHeightTitles), str(speedThroughWater), fill=BLACK, font=fontValues)
     131            draw.text((x, y + rowHeightTitles),
     132                      str(speedThroughWater),
     133                      fill=BLACK,
     134                      font=fontValues)
    124135        draw.text((x + columnWidthValues, y + rowHeightTitles * 1.4),
    125                   "kts", fill=BLACK, font=fontTitles)
     136                  "kts",
     137                  fill=BLACK,
     138                  font=fontTitles)
    126139
    127140        x = x + marginHorizontal + columnWidthValues + columnWidthUnit
    128141        draw.text((x, y), "SOG", fill=BLACK, font=fontTitles)
    129142        if speedOverGround is not None:
    130             draw.text((x, y + rowHeightTitles), str(speedOverGround),
    131                       fill=BLACK, font=fontValues)
     143            draw.text((x, y + rowHeightTitles),
     144                      str(speedOverGround),
     145                      fill=BLACK,
     146                      font=fontValues)
    132147        draw.text((x + columnWidthValues, y + rowHeightTitles * 1.4),
    133                   "kts", fill=BLACK, font=fontTitles)
     148                  "kts",
     149                  fill=BLACK,
     150                  font=fontTitles)
    134151
    135152        x = marginHorizontal
    … …  
    137154        draw.text((x, y), "Depth", fill=BLACK, font=fontTitles)
    138155        if waterDepth is not None:
    139             draw.text(
    140                 (x, y + rowHeightTitles), str(waterDepth), fill=BLACK, font=fontValues)
    141         draw.text((x + int(float(columnWidthValues) / 1.5),
    142                    y + rowHeightTitles * 1.4), "m", fill=BLACK, font=fontTitles)
     156            draw.text((x, y + rowHeightTitles),
     157                      str(waterDepth),
     158                      fill=BLACK,
     159                      font=fontValues)
     160        draw.text((
     161            x + int(float(columnWidthValues) / 1.5), y + rowHeightTitles * 1.4
     162        ),
     163                  "m",
     164                  fill=BLACK,
     165                  font=fontTitles)
    143166
    144167        x = x + marginHorizontal + columnWidthValues + columnWidthUnit
    145168        draw.text((x, y), "Water", fill=BLACK, font=fontTitles)
    146169        if waterTemperature is not None:
    147             draw.text(
    148                 (x, y + rowHeightTitles), str(waterTemperature), fill=BLACK, font=fontValues)
    149         draw.text((x + int(float(columnWidthValues) / 1.5),
    150                    y + rowHeightTitles * 1.4), "C", fill=BLACK, font=fontTitles)
     170            draw.text((x, y + rowHeightTitles),
     171                      str(waterTemperature),
     172                      fill=BLACK,
     173                      font=fontValues)
     174        draw.text((
     175            x + int(float(columnWidthValues) / 1.5), y + rowHeightTitles * 1.4
     176        ),
     177                  "C",
     178                  fill=BLACK,
     179                  font=fontTitles)
    151180
    152181        x = int((x + marginHorizontal + columnWidthValues) * 0.93)
    153182        draw.text((x, y), "Fix", fill=BLACK, font=fontTitles)
    154183        if gpsFix is not None:
    155             draw.text(
    156                 (x, y + rowHeightTitles), str(gpsFix), fill=BLACK, font=fontValues)
     184            draw.text((x, y + rowHeightTitles),
     185                      str(gpsFix),
     186                      fill=BLACK,
     187                      font=fontValues)
    157188
    158189        epd.display(image)
    159190        epd.update()
    160191
     192
    161193if __name__ == "__main__":
    162194    import sys
  • src/gnuboat/device/daemon/gpsdpoller.py

    r77cd9cf r43fd35c  
    11# -*- coding: utf-8 -*-
    22'''
    3     Copyright (C) 2016 - 2017 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     3    Copyright (C) 2016 - 2017 EngSaS - Langenbach. All rights reserved.
    44
    55    This program is free software: you can redistribute it and/or modify
    … …  
    2828
    2929class GpsdPoller(threading.Thread):
    30 
    3130    def __init__(self, logperiod):
    3231        threading.Thread.__init__(self)
    … …  
    3837
    3938    def latitude(self):
    40         if self._currentValue is None or self.gpsFix() < 2 or 'lat' not in self._currentValue:
     39        if self._currentValue is None or self.gpsFix(
     40        ) < 2 or 'lat' not in self._currentValue:
    4141            return 0
    4242        return self._currentValue.lat
    … …  
    4646
    4747    def longitude(self):
    48         if self._currentValue is None or self.gpsFix() < 2 or 'lon' not in self._currentValue:
     48        if self._currentValue is None or self.gpsFix(
     49        ) < 2 or 'lon' not in self._currentValue:
    4950            return 0
    5051        return self._currentValue.lon
    … …  
    5455
    5556    def speedOverGround(self):
    56         if self._currentValue is None or self.gpsFix() < 2 or 'speed' not in self._currentValue:
     57        if self._currentValue is None or self.gpsFix(
     58        ) < 2 or 'speed' not in self._currentValue:
    5759            return 0
    5860        return self._currentValue.speed
    5961
    6062    def courseOverGround(self):
    61         if self._currentValue is None or self.gpsFix() < 2 or 'track' not in self._currentValue:
     63        if self._currentValue is None or self.gpsFix(
     64        ) < 2 or 'track' not in self._currentValue:
    6265            return 0
    6366        return self._currentValue.track
    … …  
    7477
    7578    def timeUtc(self):
    76         if self._currentValue is None or self.gpsFix() < 2 or 'time' not in self._currentValue:
     79        if self._currentValue is None or self.gpsFix(
     80        ) < 2 or 'time' not in self._currentValue:
    7781            return None
    7882        currentTime = self._currentValue.time
    … …  
    105109            pass
    106110
     111
    107112if __name__ == "__main__":
    108113    import sys
  • src/gnuboat/device/daemon/n2kdpoller.py

    r77cd9cf r43fd35c  
    11# -*- coding: utf-8 -*-
    22'''
    3     Copyright (C) 2016 - 2017 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     3    Copyright (C) 2016 - 2017 EngSaS - Langenbach. All rights reserved.
    44
    55    This program is free software: you can redistribute it and/or modify
    … …  
    2323import traceback
    2424
    25 """@class N2kdPoller
    26 """
    27 
    2825
    2926class N2kdPoller(threading.Thread):
    30 
     27    """
     28        N2kdPoller
     29    """
    3130    def __init__(self, logperiod):
    3231        threading.Thread.__init__(self)
    … …  
    6968        except socket.error as error:
    7069            if not self._connectErrorPrinted:
    71                 print('Failed to connect to n2kd server at {}:{}: {}'.format(self._serverHost, self._serverPort, error))
     70                print(
     71                    'Failed to connect to n2kd server at {}:{}: {}'.format(
     72                        self._serverHost, self._serverPort, error
     73                    )
     74                )
    7275                self._connectErrorPrinted = True
    7376            self._waterDepthValid = False
    7477            return
    7578        if self._connectErrorPrinted:
    76             print('Connected to n2kd server at {}:{}'.format(self._serverHost, self._serverPort))
     79            print(
     80                'Connected to n2kd server at {}:{}'.format(
     81                    self._serverHost, self._serverPort
     82                )
     83            )
    7784            self._connectErrorPrinted = False
    7885
    … …  
    95102
    96103        descriptions = [
    97             "Water Depth", "Speed", "Environmental Parameters", "Distance Log"]
     104            "Water Depth", "Speed", "Environmental Parameters", "Distance Log"
     105        ]
    98106
    99107        for key in data:
    … …  
    106114                    lineKeys = data[key][entryKey].keys()
    107115                    if "fields" not in lineKeys:
    108                         print('No fields entry. Malformed json n2kd response in {}'.format(data[key][entryKey]))
     116                        print(
     117                            ('No fields entry. Malformed json n2kd response '
     118                             'in {}').format(data[key][entryKey])
     119                        )
    109120                    else:
    110121                        fields = data[key][entryKey]["fields"]
    111122                        # try water depth (NEED TO APPLY OFFSET?)
    112123                        if "Depth" in fields:
    113                             if data[key][entryKey]["description"] == "Water Depth":
     124                            if data[key][entryKey]["description"
     125                                                   ] == "Water Depth":
    114126                                self._waterDepth = fields["Depth"]
    115127                                self._waterDepthValid = True
    116128                        # try speed
    117129                        if "Speed Water Referenced" in fields:
    118                             self._speedThroughWater = fields["Speed Water Referenced"]
     130                            self._speedThroughWater = fields[
     131                                "Speed Water Referenced"]
    119132                        # try sea temperature
    120                         if "Temperature Source" in fields and "Temperature" in fields:
    121                             if fields["Temperature Source"] == "Sea Temperature":
     133                        if ("Temperature Source" in fields and
     134                                "Temperature" in fields):
     135                            if fields["Temperature Source"
     136                                      ] == "Sea Temperature":
    122137                                self._waterTemperature = fields["Temperature"]
    123138                        # try log
    … …  
    141156            pass
    142157
     158
    143159if __name__ == "__main__":
    144160    import sys
  • src/gnuboat/mapservice.yaml

    r77cd9cf r43fd35c  
    748748      type: http
    749749      scheme: basic
    750       x-basicInfoFunc: gnuboat_mapservice.server_impl.security.Security.auth_basic
     750      x-basicInfoFunc: gnuboat.mapservice_impl.security.Security.auth_basic
    751751    apiKeyAuth:
    752752      type: apiKey
    753753      in: header
    754754      name: X-API-KEY
    755       x-apikeyInfoFunc: gnuboat_mapservice.server_impl.security.Security.auth_api
     755      x-apikeyInfoFunc: gnuboat.mapservice_impl.security.Security.auth_api
    756756  schemas:
    757757    username:
  • src/gnuboat/mapservice_impl/CeleryWorker.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    1919from sqlalchemy import event
    2020
    21 from . import config_object, app, application, celery, setup_app
    22 from .database.Model import db
    23 from .tasks import tasks
     21from gnuboat.mapservice_impl import (
     22    config_object, app, application, celery, setup_app
     23)
     24from gnuboat.mapservice_impl.database.Model import db
     25from gnuboat.mapservice_impl.tasks import tasks
    2426
    2527
    … …  
    3840                def load_spatialite(dbapi_conn, connection_record):
    3941                    if 'sqlite' in flask.current_app.config[
    40                         'SQLALCHEMY_DATABASE_URI']:
    41                         # From https://geoalchemy-2.readthedocs.io/en/latest/spatialite_tutorial.html
     42                            'SQLALCHEMY_DATABASE_URI']:
     43                        # From https://geoalchemy-2.readthedocs.io/en/
     44                        # latest/spatialite_tutorial.html
    4245                        dbapi_conn.enable_load_extension(True)
    4346                        dbapi_conn.load_extension(
    … …  
    5053
    5154    with flask_app.app_context():
    52         if not 'TILES_LITTLE_ZOOM_SCHEDULE' in flask.current_app.config:
     55        if 'TILES_LITTLE_ZOOM_SCHEDULE' not in flask.current_app.config:
    5356            flask.current_app.logger.error(
    5457                'TILES_LITTLE_ZOOM_SCHEDULE not configured'
    … …  
    6164            'add-log_little_zoom_slice': {
    6265                'task':
    63                     'gnuboat_mapservice.server_impl.tasks.tasks.log_little_zoom_slice',
     66                    ('gnuboat.mapservice_impl.tasks.'
     67                     'tasks.log_little_zoom_slice'),
    6468                'schedule':
    6569                    tiles_little_zoom_schedule
  • src/gnuboat/mapservice_impl/Config.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    4242    MAPSERVICE_WEBCLIENT = '/'
    4343    CELERY_BROKER_URL = 'pyamqp://guest@localhost//'
    44     CELERY_IMPORTS = ("gnuboat_mapservice.server_impl.tasks")
     44    CELERY_IMPORTS = ("gnuboat.mapservice_impl.tasks")
    4545    CELERY_RESULT_BACKEND = "cache"
    4646    CELERY_CACHE_BACKEND = 'memcached://127.0.0.1:11211'
    … …  
    5050    TILES_DENSITIES = [10, 100]
    5151    TILES_DENSITY_BASEE = 100
    52     # How many years are data points allowed to be old, before they are excluded from calculations
     52    # How many years are data points allowed to be old,
     53    # before they are excluded from calculations
    5354    TILES_POINT_AGE_MAX = 10
    54     # log_process generates tiles for this zoom range. all lower zoomlevels (0 - x) are generated by a periodic task (s. TILES_LITTLE_ZOOM_SCHEDULE option).
    55     # Those zoomlevels are not rendered by log_process(), because they contain few details, but large areas
     55    # log_process generates tiles for this zoom range. all lower
     56    # zoomlevels (0 - x) are generated by a periodic task
     57    # (s. TILES_LITTLE_ZOOM_SCHEDULE option).
     58    # Those zoomlevels are not rendered by log_process(),
     59    # because they contain few details, but large areas
    5660    TILES_ZOOM_RANGE = {'minimum': 10, 'maximum': 19}
    57     # schedule, when to run the job to generate tiles for low zoomlevels (0 - TILES_ZOOM_RANGE['minimum']),
    58     # As format see https://docs.celeryproject.org/en/stable/userguide/periodic-tasks.html#crontab-schedules
    59     # If TILES_ZOOM_RANGE['minimum'] = 10 it might need up to 4097 slice jobs per tile_size and density
     61    # schedule, when to run the job to generate tiles for low
     62    # zoomlevels (0 - TILES_ZOOM_RANGE['minimum']),
     63    # As format see https://docs.celeryproject.org/en/
     64    # stable/userguide/periodic-tasks.html#crontab-schedules
     65    # If TILES_ZOOM_RANGE['minimum'] = 10 it might need up to
     66    # 4097 slice jobs per tile_size and density
    6067    TILES_LITTLE_ZOOM_SCHEDULE = crontab(
    6168        0, 0, day_of_month='2'
    … …  
    6774
    6875class ProductionConfig(Config):
    69     SQLALCHEMY_DATABASE_URI = 'mysql+mysqldb://gnuboat:gnuboat@localhost/gnuboat_mapservice'
    70     # TEMPLATE_FOLDER could be used to use own templates residing in TEMPLATE_FOLDER
     76    SQLALCHEMY_DATABASE_URI = ('mysql+mysqldb://gnuboat:gnuboat@localhost/'
     77                               'gnuboat_mapservice')
     78    # TEMPLATE_FOLDER could be used to use own templates residing in
     79    # TEMPLATE_FOLDER
    7180    TEMPLATE_FOLDER = '/usr/share/gnuboat/templates'
    7281
    … …  
    7786    SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/test.db'
    7887    MAPSERVICE_WEBCLIENT = 'http://localhost:8081'
    79     #SERVER_NAME = 'gnuboat-mapservice:8080'
     88    # SERVER_NAME = 'gnuboat-mapservice:8080'
    8089    HOST = 'localhost'
    8190    SERVER_NAME = 'localhost:8080'
    … …  
    8695class TestingConfig(DevelopmentConfig):
    8796    """
    88                 Configuration for testing purposes only (like tox/nosetests)
    89         """
     97        Configuration for testing purposes only (like tox/nosetests)
     98    """
    9099    TESTING = True
    91100    DEBUG = False
  • src/gnuboat/mapservice_impl/HttpErrors.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    1616'''
    1717
    18 from werkzeug.exceptions import BadRequest, Unauthorized, NotFound, InternalServerError
     18from werkzeug.exceptions import (
     19    BadRequest, Unauthorized, NotFound, InternalServerError
     20)
    1921from connexion.exceptions import ProblemException
    2022
  • src/gnuboat/mapservice_impl/ValidatorWorkaround.py

    r77cd9cf r43fd35c  
    1313from connexion.decorators.response import ResponseValidator
    1414from connexion import problem
    15 from connexion.exceptions import NonConformingResponseBody, NonConformingResponseHeaders
     15from connexion.exceptions import (
     16    NonConformingResponseBody, NonConformingResponseHeaders
     17)
    1618from connexion.utils import has_coroutine
    1719
    … …  
    3032    def __call__(self, function):
    3133        """
    32                 :type function: types.FunctionType
    33                 :rtype: types.FunctionType
    34                 """
     34            :type function: types.FunctionType
     35            :rtype: types.FunctionType
     36        """
    3537        def _wrapper(request, response):
    3638            connexion_response = \
  • src/gnuboat/mapservice_impl/__init__.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    2525import os
    2626
    27 from .. import encoder
    28 from .database.Model import db, User, ApiKey, db_setup, load_spatialite
    29 from .ValidatorWorkaround import ValidatorWorkaround
     27from gnuboat.mapservice import encoder
     28from gnuboat.mapservice_impl.database.Model import (
     29    db, User, ApiKey,
     30    db_setup, load_spatialite
     31)
     32from gnuboat.mapservice_impl.ValidatorWorkaround import ValidatorWorkaround
    3033
    3134
    3235def load_config_object(config_name):
    3336    return import_string(
    34         'gnuboat_mapservice.server_impl.Config.{}Config'.format(config_name)
     37        'gnuboat.mapservice_impl.Config.{}Config'.format(config_name)
    3538    )
    3639
    … …  
    5962        load_spatialite(dbapi_conn, connection_record)
    6063
    61     if flask.current_app.config['CREATE_TEST_DATABASE'] == True:
     64    if flask.current_app.config['CREATE_TEST_DATABASE'] is True:
    6265        from .demo import DbSetup as demoDbSetup
    6366        demoDbSetup.setup()
  • src/gnuboat/mapservice_impl/controllers/DevicesController.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    1717import connexion
    1818
    19 from ..database.Model import User, Device, db
    20 from ..HttpErrors import MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
     19from gnuboat.mapservice_impl.database.Model import User, Device, db
     20from gnuboat.mapservice_impl.HttpErrors import (
     21    MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
     22)
    2123
    2224
  • src/gnuboat/mapservice_impl/controllers/LogsController.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    1717import connexion
    1818
    19 from ..database.Model import User, Log, LogEntry, Water, Device, Gauge, ProcessingStatus, Queue, db
    20 from ..HttpErrors import MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
    21 from ..tasks.tasks import log_process
     19from gnuboat.mapservice_impl.database.Model import (
     20    User, Log, LogEntry,
     21    Water, Device, Gauge, ProcessingStatus, Queue, db
     22)
     23from gnuboat.mapservice_impl.HttpErrors import (
     24    MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
     25)
     26from gnuboat.mapservice_impl.tasks.tasks import log_process
    2227
    2328
  • src/gnuboat/mapservice_impl/controllers/TilesController.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    2020import os
    2121
    22 from ..HttpErrors import MapserviceInternalServerError, MapserviceBadRequest, MapserviceNotFound
     22from gnuboat.mapservice_impl.HttpErrors import (
     23    MapserviceInternalServerError, MapserviceBadRequest, MapserviceNotFound
     24)
    2325
    2426
    2527def tiles_tile_get(accuracy, resolution, zoom, x_tile, y_tile):
    26     if not 'TILES_CACHE_PATH' in flask.current_app.config or not os.access(
     28    if 'TILES_CACHE_PATH' not in flask.current_app.config or not os.access(
    2729        flask.current_app.config['TILES_CACHE_PATH'], os.R_OK
    2830    ):
    … …  
    3234    tiles_cache_path = flask.current_app.config['TILES_CACHE_PATH']
    3335
    34     if not 'TILES_DENSITIES' in flask.current_app.config:
     36    if 'TILES_DENSITIES' not in flask.current_app.config:
    3537        raise MapserviceInternalServerError(
    3638            details='TILES_DENSITIES not configured'
    … …  
    3840    tiles_densities = flask.current_app.config['TILES_DENSITIES']
    3941
    40     if not 'TILES_DENSITY_BASEE' in flask.current_app.config:
     42    if 'TILES_DENSITY_BASEE' not in flask.current_app.config:
    4143        raise MapserviceInternalServerError(
    4244            details='TILES_DENSITY_BASEE not configured'
    … …  
    4446    tiles_densitiy_base = flask.current_app.config['TILES_DENSITY_BASEE']
    4547
    46     if not 'TILES_SKIP_EMPTY' in flask.current_app.config:
     48    if 'TILES_SKIP_EMPTY' not in flask.current_app.config:
    4749        raise MapserviceInternalServerError(
    4850            details='TILES_SKIP_EMPTY not configured'
    … …  
    5658    else:
    5759        raise MapserviceBadRequest(
    58             details=
    59             'No valid accuracy requested. Valid are high, low. Requested was: {}'
     60            details=('No valid accuracy requested. '
     61                     'Valid are high, low. Requested was: {}')
    6062            .format(accuracy)
    6163        )
    … …  
    7274        if not tiles_skip_empty or not os.path.isfile(tile__empty_path):
    7375            raise MapserviceNotFound(
    74                 detail=
    75                 'Tile ({}, {}) for accuracy {} with resolution {} at zoomlevel {} not found'
     76                detail=('Tile ({}, {}) for accuracy {} with resolution {} '
     77                        'at zoomlevel {} not found')
    7678                .format(x_tile, y_tile, accuracy, resolution, zoom)
    7779            )
    … …  
    8587    )
    8688    response.direct_passthrough = False
    87     #response.headers['Content-Transfer-Encoding']='base64'
    8889    return response
  • src/gnuboat/mapservice_impl/controllers/UsersController.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    2424from flask_mail import Message
    2525
    26 from .. import mail
    27 from ..database.Model import User, ApiKey, db
    28 from ..HttpErrors import MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
     26from gnuboat.mapservice_impl import mail
     27from gnuboat.mapservice_impl.database.Model import User, ApiKey, db
     28from gnuboat.mapservice_impl.HttpErrors import (
     29    MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
     30)
    2931
    30 mail_regex = re.compile('[^@]+@[^@]+\.[^@]+')
     32mail_regex = re.compile('[^@]+@[^@]+\\.[^@]+')
    3133
    3234
    … …  
    107109            detail='Email contains more than one @, no @ or no .'
    108110        )
    109     if user_creation.license_accepted is None or not user_creation.license_accepted:
     111    if (user_creation.license_accepted is None or
     112            not user_creation.license_accepted):
    110113        raise MapserviceBadRequest(
    111114            detail='You must accept the license to register an account'
    … …  
    128131
    129132    message = Message("Activate your GNUBoat account", recipients=[user.email])
    130     message.body = 'Hello {},\nthank you for support the project with your own measurings. To activate your GNUBoat account, visit {}.\nKind regards,\nYour GNUBoat team'.format(
    131         user.first_name, activation_url
     133    message.body = ('Hello {},\nthank you for support the project with your '
     134                    'own measurings. To activate your GNUBoat account, '
     135                    'visit {}.\nKind regards,\nYour GNUBoat team').format(
     136            user.first_name, activation_url
    132137    )
    133138    message.html = render_template(
  • src/gnuboat/mapservice_impl/controllers/WatersController.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    1717import connexion
    1818
    19 from ..database.Model import User, Water, Gauge, Log, db
    20 from ..HttpErrors import MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
     19from gnuboat.mapservice_impl.database.Model import User, Water, Gauge, Log, db
     20from gnuboat.mapservice_impl.HttpErrors import (
     21    MapserviceBadRequest,
     22    MapserviceUnauthorized, MapserviceNotFound
     23)
    2124
    2225
  • src/gnuboat/mapservice_impl/database/Model.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    5656    activated = db.Column(db.Boolean(), default=False)
    5757    activation_code = db.Column(db.String(255), default='1234')
    58     #activation_code = db.Column(db.String(255), server_default=text('LEFT(MD5(NOW()), 50)'))
     58    # activation_code = db.Column(db.String(255),
     59    #     server_default=text('LEFT(MD5(NOW()), 50)'))
    5960    license_accepted = db.Column(db.Boolean(), default=False)
    6061
    … …  
    107108    @staticmethod
    108109    def loggedin_username():
    109         if not 'user' in connexion.context:
     110        if 'user' not in connexion.context:
    110111            return None
    111112        return connexion.context['user']
    … …  
    174175    reference_water_level_gauge_height = db.Column(db.Float, nullable=False)
    175176    comment = db.Column(db.String(255))
    176     #osm_id = db.Column(db.Integer)
    177     #osm_type = db.Column(db.String(255))
    178     #osm_class = db.Column(db.String(255))
     177    # osm_id = db.Column(db.Integer)
     178    # osm_type = db.Column(db.String(255))
     179    # osm_class = db.Column(db.String(255))
    179180    manager = db.relationship("User", backref=db.backref("gauges"), lazy=True)
    180181    water = db.relationship("Water", backref=db.backref("gauges"), lazy=True)
    … …  
    430431        if 'sqlite' in flask.current_app.config['SQLALCHEMY_DATABASE_URI']:
    431432            result = db.engine.execute(
    432                 'SELECT count(name) FROM sqlite_master WHERE type="table" AND name="spatial_ref_sys"'
     433                ('SELECT count(name) FROM sqlite_master '
     434                 'WHERE type="table" AND name="spatial_ref_sys"')
    433435            )
    434436            if result.fetchone()[0] == 1:
    … …  
    443445
    444446def load_spatialite(dbapi_conn, connection_record):
    445     if not 'sqlite' in flask.current_app.config['SQLALCHEMY_DATABASE_URI']:
     447    if 'sqlite' not in flask.current_app.config['SQLALCHEMY_DATABASE_URI']:
    446448        return
    447449
    … …  
    462464        if os.path.exists(path):
    463465            if flask.current_app.config['DEBUG'] and (
    464                 not 'TESTING' in flask.current_app.config
    465                 or not flask.current_app.config['TESTING']
     466                'TESTING' not in flask.current_app.config or
     467                not flask.current_app.config['TESTING']
    466468            ):
    467469                print('Enabling spatial lite extension. This may take a while')
    468             # From https://geoalchemy-2.readthedocs.io/en/latest/spatialite_tutorial.html
     470            # From https://geoalchemy-2.readthedocs.io/en/latest/
     471            # spatialite_tutorial.html
    469472            dbapi_conn.enable_load_extension(True)
    470473            dbapi_conn.load_extension(str(path.resolve()))
  • src/gnuboat/mapservice_impl/demo/DbSetup.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    2020import flask
    2121
    22 from ..database.Model import db, User, ApiKey, Water, OsmType, Gauge, Device, Log, Queue, ProcessingStatus, db_setup
    23 from ..tasks.tasks import log_process
     22from gnuboat.mapservice_impl.database.Model import (
     23    db, User, ApiKey, Water,
     24    OsmType, Gauge, Device, Log, Queue, ProcessingStatus, db_setup
     25)
     26from gnuboat.mapservice_impl.tasks.tasks import log_process
    2427
    2528
    … …  
    127130                location='SRID=4326;POINT(10.0427 48.4275)',
    128131                reference_water_level_gauge_height=0.4,
    129                 comment=
    130                 'Level zero is the level of the step where the handrail is fixed.'
     132                comment=('Level zero is the level of the step '
     133                         'where the handrail is fixed.')
    131134            )
    132135            db.session.add(pfuhlersee_gauge)
    … …  
    184187    db.session.commit()
    185188
    186     if not 'CELERY_BROKER_URL' in flask.current_app.config or not flask.current_app.config[
    187         'CELERY_BROKER_URL']:
     189    if ('CELERY_BROKER_URL' not in flask.current_app.config or
     190        not flask.current_app.config[
     191           'CELERY_BROKER_URL']):
    188192        print('Do not add log, since their is no CELERY_BROKER_URL configured')
    189193        return log
  • src/gnuboat/mapservice_impl/security/Security.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
  • src/gnuboat/mapservice_impl/tasks/__init__.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
  • src/gnuboat/mapservice_impl/tasks/tasks.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    3434import mercantile
    3535
    36 from gnuboat_common.datahandler import loghandler
    37 from gnuboat_common.spatial import tilegenerator
    38 from gnuboat_common.spatial.tilegenerator import RasterSlice, LngLatBbox, ZoomRange
    39 
    40 from .. import mail, celery as celery_app
    41 from ..database.Model import User, Log, LogEntry, Water, ProcessingStatus, Queue, db
    42 from .tileconfig import TileConfig
     36from gnuboat.common.datahandler import loghandler
     37from gnuboat.common.spatial import tilegenerator
     38from gnuboat.common.spatial.tilegenerator import (
     39    RasterSlice, LngLatBbox, ZoomRange
     40)
     41
     42from gnuboat.mapservice_impl import mail, celery as celery_app
     43from gnuboat.mapservice_impl.database.Model import (
     44    User, Log, LogEntry, Water, ProcessingStatus, Queue, db
     45)
     46from gnuboat.mapservice_impl.tasks.tileconfig import TileConfig
    4347
    4448
    … …  
    8488class SliceJob(dict):
    8589    """
    86                 Summarize all data needed to generate the tiles for a slice
    87                 and also to cleanup the whole generation chain afterwards
    88                
    89                 tile_slice: The slice, which should be rastered
    90                 query: query used in the vrt source file
    91                 log_id: Id of the log, initiating the job (before slicing)
    92                 envelope: Enlarged envelope of the complete job (TileGenerator.LngLatBbox)
    93                
    94                 It's derived from dict to be json serialisable
    95         """
     90        Summarize all data needed to generate the tiles for a slice
     91        and also to cleanup the whole generation chain afterwards
     92
     93        tile_slice: The slice, which should be rastered
     94        query: query used in the vrt source file
     95        log_id: Id of the log, initiating the job (before slicing)
     96        envelope: Enlarged envelope of the complete job
     97            (TileGenerator.LngLatBbox)
     98
     99        It's derived from dict to be json serialisable
     100    """
    96101    def __init__(self, tile_slice, query, log_id, envelope, epsg_code):
    97102        super(SliceJob, self).__init__({
    … …  
    130135
    131136# query to get all logentries in the enlarged envelope, younger than age_date
    132 query = """SELECT MakePointZ(ST_x(entries.location), ST_y(entries.location), (entries.water_depth + (logs.gauge_height - gauges.reference_water_level_gauge_height)), ST_srid(entries.location))
     137query = """SELECT MakePointZ(ST_x(entries.location), ST_y(entries.location),
     138  (entries.water_depth +
     139    (logs.gauge_height - gauges.reference_water_level_gauge_height)),
     140  ST_srid(entries.location))
    133141FROM logentries as entries, logs, gauges
    134142WHERE entries.log_id=logs.id AND gauges.id=logs.gauge_id
    135         AND ST_Within(entries.location, Envelope(MakeLine(PointFromText("POINT({longitude_west} {latitude_south})", {epsg_code}), PointFromText("POINT({longitude_east} {latitude_north})", {epsg_code}))))
    136         AND entries.datetime > \"{age_date}\""""
     143  AND ST_Within(entries.location, Envelope(MakeLine(PointFromText(
     144    "POINT({longitude_west} {latitude_south})", {epsg_code}),
     145    PointFromText("POINT({longitude_east} {latitude_north})", {epsg_code}))))
     146  AND entries.datetime > \"{age_date}\""""
    137147
    138148# query for retrieving processing state of affected logentries
    139149query_select_processing_state = """SELECT COUNT(id) FROM logs
    140150WHERE processing_state={processing_state} AND id IN (
    141         SELECT log_id FROM logentries WHERE
    142                 ST_Within(logentries.location, Envelope(MakeLine(PointFromText("POINT({longitude_west} {latitude_south})", {epsg_code}), PointFromText("POINT({longitude_east} {latitude_north})", {epsg_code}))))
    143                 AND datetime {age_condition} \"{age_date}\"
    144                 GROUP BY log_id)"""
     151  SELECT log_id FROM logentries WHERE
     152    ST_Within(logentries.location, Envelope(MakeLine(PointFromText(
     153      "POINT({longitude_west} {latitude_south})", {epsg_code}),
     154      PointFromText("POINT({longitude_east} {latitude_north})", {epsg_code}))))
     155    AND datetime {age_condition} \"{age_date}\"
     156  GROUP BY log_id)"""
    145157
    146158# query for updateting processing state of all affected logentries
    147 query_update_processing_state = """UPDATE logs SET processing_state={processing_state}
     159query_update_processing_state = """UPDATE logs SET
     160  processing_state={processing_state}
    148161WHERE id IN (
    149         SELECT log_id FROM logentries WHERE
    150                 ST_Within(logentries.location, Envelope(MakeLine(PointFromText("POINT({longitude_west} {latitude_south})", {epsg_code}), PointFromText("POINT({longitude_east} {latitude_north})", {epsg_code}))))
    151                 AND datetime {age_condition} \"{age_date}\"
    152                 GROUP BY log_id)"""
     162  SELECT log_id FROM logentries WHERE
     163    ST_Within(logentries.location, Envelope(MakeLine(PointFromText(
     164      "POINT({longitude_west} {latitude_south})", {epsg_code}),
     165      PointFromText("POINT({longitude_east} {latitude_north})", {epsg_code}))))
     166    AND datetime {age_condition} \"{age_date}\"
     167  GROUP BY log_id)"""
    153168
    154169query_logs = """SELECT logentries.log_id, COUNT(logentries.id) as entries
    155170FROM logentries
    156 WHERE ST_Within(logentries.location, Envelope(MakeLine(PointFromText("POINT({longitude_west} {latitude_south})", {epsg_code}), PointFromText("POINT({longitude_east} {latitude_north})", {epsg_code}))))
    157         AND logentries.datetime > \"{age_date}\" GROUP BY log_id"""
     171WHERE ST_Within(logentries.location, Envelope(MakeLine(PointFromText(
     172    "POINT({longitude_west} {latitude_south})", {epsg_code}),
     173    PointFromText("POINT({longitude_east} {latitude_north})", {epsg_code}))))
     174  AND logentries.datetime > \"{age_date}\" GROUP BY log_id"""
    158175
    159176
    … …  
    161178def log_process(log_id, log_content):
    162179    """
    163                 Chain for processing a new log
    164                 1. Parse the log and add it to the datapase (s. log_parse)
    165                 2. Generate tiles out of the new and old data (s. log_slice)
    166         """
     180        Chain for processing a new log
     181        1. Parse the log and add it to the datapase (s. log_parse)
     182        2. Generate tiles out of the new and old data (s. log_slice)
     183    """
    167184    chain = log_parse.s(log_id, log_content) | log_slice.s()
    168185    chain()
    … …  
    247264def log_slice(log_id):
    248265    """
    249                 Background task to process new logs
    250                 If another job is already processing the same logs, a LogsLocked Exception
    251                 is raised and an auto retry after 30 minutes is triggered.
    252         """
     266        Background task to process new logs
     267        If another job is already processing the same logs, a LogsLocked
     268        Exception is raised and an auto retry after 30 minutes is triggered.
     269    """
    253270    try:
    254271        tiles_config = _get_tile_config()
    … …  
    303320    )
    304321
    305     # Check that none of the affected logs are currently processed by another job
     322    # Check that none of the affected logs are currently processed by
     323    # another job
    306324    result = db.engine.execute(
    307325        query_select_processing_state.format(
    … …  
    341359            count_logentries += rows[1]
    342360        flask.current_app.logger.info(
    343             'Processing log {}, found {} datasets from {} logs in enlarged envelope younger than {}'
     361            ('Processing log {}, found {} datasets from {} logs in enlarged '
     362             'envelope younger than {}')
    344363            .format(log_id, count_logentries, logs, newer_than.isoformat('T'))
    345364        )
    … …  
    388407    except Exception as error:
    389408        flask.current_app.logger.error(
    390             'Could not open the output file for the ogr data source description: {}'
    391             .format(error)
     409            ('Could not open the output file for the ogr data '
     410             'source description: {}').format(error)
    392411        )
    393412        db.engine.execute(
    … …  
    461480    except Exception as error:
    462481        flask.current_app.logger.error(
    463             'Could not open the output file for the ogr data source description: {}'
    464             .format(error)
     482            ('Could not open the output file for the ogr data '
     483             'source description: {}').format(error)
    465484        )
    466485        os.remove(datasource_file)
    … …  
    603622def log_little_zoom_slice():
    604623    """
    605                 Generate all little zoomlevels, which are not process per log with log_process
    606         """
     624        Generate all little zoomlevels, which are not process per
     625        log with log_process
     626    """
    607627    flask.current_app.logger.info('Recreating tiles for little zoomlevels')
    608628    try:
    … …  
    629649    )
    630650
    631     ## query to get all logentries in the world, younger than age_date
    632     query = """SELECT MakePointZ(ST_x(entries.location), ST_y(entries.location), (entries.water_depth + (logs.gauge_height - gauges.reference_water_level_gauge_height)), ST_srid(entries.location))
     651    # query to get all logentries in the world, younger than age_date
     652    query = """SELECT MakePointZ(ST_x(entries.location), ST_y(entries.location),
     653    (entries.water_depth + (logs.gauge_height -
     654        gauges.reference_water_level_gauge_height)), ST_srid(entries.location))
    633655FROM logentries as entries, logs, gauges
    634 WHERE entries.log_id=logs.id AND gauges.id=logs.gauge_id AND entries.datetime > \"{age_date}\"""".format(
     656WHERE entries.log_id=logs.id AND gauges.id=logs.gauge_id
     657    AND entries.datetime > \"{age_date}\"""".format(
    635658        age_date=newer_than.isoformat('T')
    636659    )
    … …  
    640663    except Exception as error:
    641664        flask.current_app.logger.error(
    642             'Could not open the output file for the ogr data source description: {}'
    643             .format(error)
     665            ('Could not open the output file for the ogr data '
     666             'source description: {}').format(error)
    644667        )
    645668        os.remove(datasource_file)
    … …  
    675698            )
    676699        )
    677     # cleanup is not needed, because the processing state is not changed and also no mails are send
     700    # cleanup is not needed, because the processing state
     701    # is not changed and also no mails are send
    678702    celery.group((log_generate_tiles.s(slice_job)
    679703                  for slice_job in slice_jobs)).delay()
    … …  
    745769
    746770def _get_database_uri():
    747     if not 'SQLALCHEMY_DATABASE_URI' in flask.current_app.config:
     771    if 'SQLALCHEMY_DATABASE_URI' not in flask.current_app.config:
    748772        raise ImportError('SQLALCHEMY_DATABASE_URI not configured')
    749773    return flask.current_app.config['SQLALCHEMY_DATABASE_URI']
    … …  
    751775
    752776def _get_tile_config():
    753     if not 'TILES_CACHE_PATH' in flask.current_app.config:
     777    if 'TILES_CACHE_PATH' not in flask.current_app.config:
    754778        flask.current_app.logger.error('TILES_CACHE_PATH not configured')
    755779        raise ImportError('TILES_CACHE_PATH not configured')
    756780
    757     if not 'TILES_SIZES' in flask.current_app.config:
     781    if 'TILES_SIZES' not in flask.current_app.config:
    758782        flask.current_app.logger.error('TILES_SIZES not configured')
    759783        raise ImportError('TILES_SIZES not configured')
    760784
    761     if not 'TILES_DENSITIES' in flask.current_app.config:
     785    if 'TILES_DENSITIES' not in flask.current_app.config:
    762786        flask.current_app.logger.error('TILES_DENSITIES not configured')
    763787        raise ImportError('TILES_DENSITIES not configured')
    764788
    765     if not 'TILES_DENSITY_BASEE' in flask.current_app.config:
     789    if 'TILES_DENSITY_BASEE' not in flask.current_app.config:
    766790        flask.current_app.logger.error('TILES_DENSITY_BASEE not configured')
    767791        raise ImportError('TILES_DENSITY_BASEE not configured')
    768792
    769     if not 'TILES_POINT_AGE_MAX' in flask.current_app.config:
     793    if 'TILES_POINT_AGE_MAX' not in flask.current_app.config:
    770794        flask.current_app.logger.error('TILES_POINT_AGE_MAX not configured')
    771795        raise ImportError('TILES_POINT_AGE_MAX not configured')
    772796
    773     if not 'TILES_ZOOM_RANGE' in flask.current_app.config:
     797    if 'TILES_ZOOM_RANGE' not in flask.current_app.config:
    774798        flask.current_app.logger.error('TILES_ZOOM_RANGE not configured')
    775799        raise ImportError('TILES_ZOOM_RANGE not configured')
    776800
    777     if not 'TILES_SKIP_EMPTY' in flask.current_app.config:
     801    if 'TILES_SKIP_EMPTY' not in flask.current_app.config:
    778802        flask.current_app.logger.error('TILES_SKIP_EMPTY not configured')
    779803        raise ImportError('TILES_SKIP_EMPTY not configured')
    780804
    781     if not 'TILES_RASTER_FILE_SIZE_MAX' in flask.current_app.config:
     805    if 'TILES_RASTER_FILE_SIZE_MAX' not in flask.current_app.config:
    782806        flask.current_app.logger.error(
    783807            'TILES_RASTER_FILE_SIZE_MAX not configured'
    … …  
    834858def _water_link(log_id):
    835859    webclient_url = ''
    836     if not 'MAPSERVICE_WEBCLIENT' in flask.current_app.config:
     860    if 'MAPSERVICE_WEBCLIENT' not in flask.current_app.config:
    837861        flask.current_app.logger.error('MAPSERVICE_WEBCLIENT not configured')
    838862    else:
  • src/gnuboat/mapservice_impl/tasks/tileconfig.py

    r77cd9cf r43fd35c  
    11# -*- coding: utf-8 -*-
    22'''
    3     Copyright (C) 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     3    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
    44
    55    This program is free software: you can redistribute it and/or modify
    … …  
    3535    class TileConfig:
    3636        """
    37                         Workaround for @dataclass, until python 3.7 is available in main distros
    38                 """
     37            Workaround for @dataclass, until python 3.7 is available
     38            in main distros
     39        """
    3940        def __init__(
    4041            self, cache_path, sizes, densities, densitiy_base, points_age_max,
  • src/gnuboat/mapservice_impl/tests/db_test_setup.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    2020import flask
    2121
    22 from ..server_impl.database.Model import db, User, ApiKey, Water, OsmType, Gauge, Device, Log, Queue, ProcessingStatus, db_setup
    23 from ..server_impl.demo import DbSetup as demoDbSetup
    24 from ..server_impl.tasks.tasks import log_process
     22from gnuboat.mapservice_impl.database.Model import (
     23    db, User, ApiKey, Water,
     24    OsmType, Gauge, Device, Log, Queue, ProcessingStatus, db_setup
     25)
     26from gnuboat.mapservice_impl.demo import DbSetup as demoDbSetup
     27from gnuboat.mapservice_impl.tasks.tasks import log_process
    2528
    2629
    … …  
    5255            )
    5356            user_activation.activated = False
    54             user_activation.activation_code = 'dac9630aec642a428cd73f4be0a03569'
     57            user_activation.activation_code = ('dac9630aec642a428cd73f4be0a'
     58                                               '03569')
    5559            user_activation.first_name = 'Autotests'
    5660            user_activation.license_accepted = True
  • src/gnuboat/mapservice_impl/tests/test_config.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    2121import os
    2222
    23 from gnuboat_mapservice.server_impl import Config
     23from gnuboat.mapservice_impl import Config
    2424
    2525
    … …  
    2727    def test_config_from_file(self):
    2828        """Test case load config from file
    29                 """
     29        """
    3030        new_config = {'TESTING': True, 'DOES_NOT_EXISTS': 1234}
    3131
    3232        config = Config.Config()
    33         assert config.TESTING == False
     33        assert config.TESTING is False
    3434
    3535        config_file = tempfile.NamedTemporaryFile(
    … …  
    4646
    4747        config = Config.load_from_file(config_file)
    48         assert config.TESTING == True
     48        assert config.TESTING is True
    4949        assert config.DOES_NOT_EXISTS == 1234
    5050        os.remove(config_file)
  • src/gnuboat/mapservice_impl/tests/test_logs.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    2020import os
    2121
    22 from . import BaseTestCase
     22from gnuboat.mapservice.test import BaseTestCase
    2323
    2424
    … …  
    3030    def test_get(self):
    3131        """Test case getting log (src)
    32                 """
     32        """
    3333        headers = {'Accept': 'application/json'}
    3434        response = self.client.open(
    … …  
    7474    def test_get_by_manager(self):
    7575        """Test case getting log by submitter (src)
    76                 """
     76        """
    7777        headers = {'Accept': 'application/json'}
    7878
    … …  
    123123    def test_create_log(self):
    124124        """Test case create log (src)
    125                 """
     125        """
    126126        headers = {
    127127            'X-API-KEY': 'test_key',
    … …  
    158158
    159159        # could not be tested without running CELERY_BROKER
    160         #filename = '{}/data/nmea0183-2017-12-09.log'.format(os.path.dirname(os.path.abspath(__file__)))
    161         #fileContent = open(filename, 'rb')
     160        # filename = '{}/data/nmea0183-2017-12-09.log'.format(
     161        #   os.path.dirname(os.path.abspath(__file__)))
     162        # fileContent = open(filename, 'rb')
    162163        # headers["Accept"] = "application/geo+json"
    163         #response = self.client.post(
    164         #"{}/{}".format(self.base_url, data["logId"]),
    165         #data = fileContent,
    166         #headers = headers
    167         #)
    168         #assert response.status_code == 200
     164        # response = self.client.post(
     165        # "{}/{}".format(self.base_url, data["logId"]),
     166        # data = fileContent,
     167        # headers = headers
     168        # )
     169        # assert response.status_code == 200
    169170
    170171
  • src/gnuboat/mapservice_impl/tests/test_users.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    1919import json
    2020
    21 from . import BaseTestCase
     21from gnuboat.mapservice.test import BaseTestCase
    2222
    2323
    … …  
    2929    def test_users_get(self):
    3030        """Test case for getting users (src)
    31                 """
     31        """
    3232        headers = {}
    3333        response = self.client.open(
    … …  
    5858    def test_users_register(self):
    5959        """Test case for users_register (Src)
    60                         Register a new user
    61                 """
     60           Register a new user
     61        """
    6262        user_creation = {
    6363            "username": "jane_doe",
  • src/gnuboat/mapservice_impl/tests/test_waters.py

    r77cd9cf r43fd35c  
    11'''
    2     Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     2    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
    33
    44    This program is free software: you can redistribute it and/or modify
    … …  
    1919import json
    2020
    21 from . import BaseTestCase
     21from gnuboat.mapservice.test import BaseTestCase
    2222
    2323
    … …  
    2929    def test_get(self):
    3030        """Test case getting waters (src)
    31                 """
     31        """
    3232        headers = {}
    3333        response = self.client.open(
    … …  
    5050    def test_get_by_name(self):
    5151        """Test case getting waters by name (src)
    52                 """
     52        """
    5353        headers = {}
    5454
    … …  
    8383    def test_get_by_manager(self):
    8484        """Test case getting waters by manager (src)
    85                 """
     85        """
    8686        headers = {}
    8787
    … …  
    118118    def test_get_by_name_manager(self):
    119119        """Test case getting waters by manager and water name (src)
    120                 """
     120        """
    121121        headers = {}
    122122
  • src/mapservice-webclient/package.json

    r77cd9cf r43fd35c  
    11{
    22  "name": "gnuboat-mapservice-webclient",
    3   "version": "0.1.0",
     3  "version": "0.5.90",
    44  "scripts": {
    55    "ng": "ng",
  • test-requirements.txt

    r77cd9cf r43fd35c  
    66pytest-cov
    77pytest-pep8
    8 Pillow
Note: See TracChangeset for help on using the changeset viewer.