if __name__ == '__main__': params = loader.parseArgs(sys.argv[1:]) inputs = loader.getInputs() inputFile = inputs[0]["path"][0] df_madrid = filewriter.jsonToObj(inputFile) itemCursor = 0 postalCode = df_madrid["features"][itemCursor]["properties"]["COD_POSTAL"] formType = df_madrid["features"][itemCursor]["geometry"]["type"] # Polygon geometryListPoints = df_madrid["features"][itemCursor]["geometry"][ "coordinates"][0] SVG_PATH1 = loader.getOutputPath()["path"] + 'radar.svg' PNG_PATH1 = loader.getOutputPath()["path"] + 'radar.png' imageWidth = 800 imageHeight = 800 imagePadding = 200 limitSize = 200 dwg = svgwrite.Drawing(SVG_PATH1, profile='tiny', size=(imageWidth, imageHeight)) # CIRCLE = dwg.circle( [400, 400 ] , 50 , fill="none", stroke="#000") # dwg.add( CIRCLE ) #dwg.add(dwg.text( itemText , insert= topPos , fill='black'))
} } geometryListPoints.append(regionData) else: regionData = { "coordinates": region["geometry"]["coordinates"][0], "properties": { "postalcode": region["properties"]["COD_POSTAL"], "region": "madrid" } } geometryListPoints.append(regionData) # .......................................................................... block: Translate coordinates to pixels SVG_PATH = loader.getOutputPath()["path"] + 'all.svg' PNG_PATH = loader.getOutputPath()["path"] + 'all.png' mapservice = MapService(SVG_PATH, PNG_PATH, 800, 800, geometryListPoints) mapservice.run() #Get colors pallete _colors = mapservice.getColors() # .......................................................................... block: Locate sensor values #com: Get a column with normalized values CO_min = df_year2018['CO'].min() CO_max = df_year2018['CO'].max() CO_norm = (df_year2018['CO'] - CO_min) / (CO_max - CO_min) df_year2018['CO_norm'] = CO_norm
} } geometryListPoints.append( regionData ) else: regionData = { "coordinates": region["geometry"]["coordinates"][0], "properties": { "postalcode": region["properties"]["COD_POSTAL"], "region":"madrid" } } geometryListPoints.append( regionData ) #___________________________________________________________________________ SVG_PATH = loader.getOutputPath( )["path"] + 'separate.svg' PNG_PATH = loader.getOutputPath( )["path"] + 'separate.png' mapservice = MapService( SVG_PATH, PNG_PATH, 800, 800, geometryListPoints ) # mapservice.run() stationsFile = inputs[1]["path"][ 0 ] df_stations = filewriter.csvToDF( stationsFile ) idStation = 15 _lon = df_stations["lon"][ idStation ] _lat = df_stations["lat"][ idStation ] xyStacion = ( 1,1 ) # mapservice.mapCoorToXY( ( _lon, _lat ) ) print mapservice.isPointInPolygon( xyStacion, [( 450,450 ),( 460, 450 ),( 470 ,450 )] ) # print mapservice.getPostalcodeByCoors( xyStacion)
from lib.reporter import Reporter reporter = Reporter( ROUTES ) #Extend the Reporter with the desired Report-Class # from lib.reporters.MultiLayerTimeSerie import MultiLayerTimeSerie # multilayer = MultiLayerTimeSerie() # reporter.builder = multilayer.builder #...................... sys.path.append( currentFullRoute ) # --------------------------------------------------- CUSTOM LIBS import zipfile # ---------------------------------------------------------------------- MAIN if __name__ == '__main__': params = loader.parseArgs( sys.argv[1:] ) inputs = loader.getInputs() inputFile = inputs[0]["path"][0] zip_ref = zipfile.ZipFile( inputFile, 'r') zip_ref.extractall( loader.getOutputPath( )["path"] ) zip_ref.close() loader.saveMetas();