Пример #1
0
gdal_data = lbm.GdalRasterData(geotiff_filespec, band_nr=0, down_sampling=1)
style = lbm.GridImageStyle()
layer = lbm.MapLayer(gdal_data, style)
#layers.append(layer)

## WCS / GeoTiff raster
#geotiff_filespec = "E:\\Home\\_kris\\Projects\\2015 - RegionWallonne\\Figures\\Hazard maps\\rock\\HazardMap_T=0.000s_2.5E+03yr.TIF"
geotiff_filespec = "D:\\seismo-gis\\collections\\ASTER_GDEM\\GEOTIFF\\ASTGTM_N50E006.tif"
gdal_data = lbm.GdalRasterData(geotiff_filespec, band_nr=1, down_sampling=3)
"""
url = 'http://seishaz.oma.be:8080/geoserver/wcs'
layer_name, resolution, bbox = 'ngi:DTM10k', 1000, []
#layer_name, resolution, bbox = 'nasa:ASTER_GDEM_V2', 0.02, region[::2]+region[1::2]
wcs_data = lbm.WCSData(url, layer_name, resolution=resolution, bbox=bbox)
"""
colorbar_style = lbm.ColorbarStyle("Elevation (m)")
#colorbar_style = None
#hillshade_style = lbm.HillshadeStyle(azimuth=45,elevation_angle=30, scale=0.1, color_map="copper")
hillshade_style = None
cmap, norm = lbm.cm.from_cpt_city(r"td/DEM_poster")
#cmap = "gist_earth"
tsc = lbm.ThematicStyleColormap(color_map=cmap, vmin=0, vmax=700)
#tsc.color_map = None
style = lbm.GridStyle(color_map_theme=tsc,
                      colorbar_style=colorbar_style,
                      line_style=None,
                      pixelated=True,
                      hillshade_style=hillshade_style)
#layer = lbm.MapLayer(wcs_data, style)
layer = lbm.MapLayer(gdal_data, style)
layers.append(layer)
Пример #2
0
thematic_size = lbm.ThematicStyleGradient([1, 3, 5, 6.3], [1, 4, 10, 15],
                                          labels=["1.0", "3.0", "5.0", "6.3"],
                                          value_key="magnitude")

## Color scale for depth
#colorbar_style = lbm.ColorbarStyle(title="Depth (km)", location="bottom", format="%d", label_size=18, tick_label_size=18)
#thematic_color = lbm.ThematicStyleColormap(value_key="depth")
#thematic_color = lbm.ThematicStyleRanges([0,1,10,25,50], ['red', 'orange', 'yellow', 'green'], value_key="depth", colorbar_style=colorbar_style)

## Color scale for time
## Discontinuous color scale
#cb_title = u"Jaar - Année - Year"
cb_title = "Year"
colorbar_style = lbm.ColorbarStyle(title=cb_title,
                                   location="bottom",
                                   format="%d",
                                   label_size=15,
                                   tick_label_size=8,
                                   spacing="uniform")
thematic_color = lbm.ThematicStyleRanges(
    [1350, 1910, 1985, 2000, 2015, 2018],
    ['blue', 'green', 'yellow', 'orange', 'red'],
    value_key="year",
    colorbar_style=colorbar_style)
file_name_ext = "_discont_colorscale"

## Continuous color scale
"""
colorbar_style = lbm.ColorbarStyle(title=cb_title, location="bottom", format="%d",
					label_size=15, tick_label_size=8, spacing="uniform",
					ticks=[1350, 1910, 1985,2018])
cmap = pylab.get_cmap("rainbow", 6)
label_style = lbm.TextStyle(font_size=6,
                            background_color=(1, 1, 1, 0.67),
                            border_pad=0)
line_style = lbm.LineStyle(line_width=0.5,
                           line_pattern=None,
                           dash_pattern=[3, 3],
                           label_style=label_style)
contour_levels = np.arange(0.02, 0.17, 0.02)
contour_labels = contour_levels[::2]
tick_labels = [
    "%.2f" % contour_levels[i] if i % 2 == 0 else ''
    for i in range(len(contour_levels))
]
colorbar_style = lbm.ColorbarStyle(
    'PGA (g), 10% probability of exceedance in 50 yr',
    format='%.2f',
    spacing='uniform',
    ticks=contour_levels,
    tick_labels=tick_labels)
grd_style = lbm.GridStyle(color_map_theme,
                          contour_levels=contour_levels,
                          contour_labels=contour_labels,
                          line_style=line_style,
                          colorbar_style=colorbar_style)
layer = lbm.MapLayer(grd_data, grd_style)
layers.append(layer)

## Coastlines
coastline_style = lbm.LineStyle(line_color="k", line_width=1)
data = lbm.BuiltinData("coastlines")
layer = lbm.MapLayer(data, coastline_style)
layers.append(layer)
Пример #4
0
    else:
        sof = "Strike slip"
    values["sof"].append(sof)
    values["rake"].append(rec.rake)
focmec_data = lbm.FocmecData(lons, lats, sdr, values=values)
focmec_data.sort(value_key="ML", ascending=False)
thematic_size = lbm.ThematicStyleGradient([1, 3, 5], [5, 15, 30],
                                          value_key="ML")

#colorbar_style = lbm.ColorbarStyle(title="Style of faulting", format="%s", spacing="uniform")
#colorbar_style = None
#thematic_color = lbm.ThematicStyleIndividual(["Normal", "Strike slip", "Reverse"], ['green', "yellow", "red"], value_key="sof", colorbar_style=colorbar_style)
#thematic_legend_style = lbm.LegendStyle(title="Focal mechanisms", location=1, label_spacing=1)

colorbar_style = lbm.ColorbarStyle(title="Rake",
                                   format="%s",
                                   ticks=None,
                                   spacing="proportional")
thematic_color = lbm.ThematicStyleRanges(
    [-180, -135, -45, 45, 135, 180],
    ['yellow', "green", "yellow", "red", "yellow"],
    value_key="rake",
    colorbar_style=colorbar_style)
#thematic_color = lbm.ThematicStyleGradient([-180, -90, 0, 90, 180], ['yellow', "green", "yellow", "red", "yellow"], labels=["RL", "Nf", "LL", "Tf", "RL"], value_key="rake", colorbar_style=colorbar_style)
thematic_legend_style = None

focmec_style = lbm.FocmecStyle(size=thematic_size,
                               fill_color=thematic_color,
                               thematic_legend_style=thematic_legend_style)
layer = lbm.MapLayer(focmec_data, focmec_style)
layers.append(layer)
Пример #5
0
               for rec in db_records}
}

## Commune layer
gis_data = lbm.GisData(gis_filespec, joined_attributes=joined_attributes)
if attribute == "language":
    tsi = lbm.ThematicStyleIndividual(["FR", "NL", "DE"], ['r', 'y', 'b'],
                                      value_key=attribute)
    thematic_legend_style = lbm.LegendStyle(title=attribute, location=3)
elif attribute == "id_province":
    tsi = lbm.ThematicStyleGradient(values=[1, 6, 11],
                                    styles=["r", "g", "b"],
                                    value_key=attribute)
    thematic_legend_style = None
    colorbar_style = lbm.ColorbarStyle(title=attribute,
                                       ticks=range(1, 11),
                                       spacing="proportional")
    tsi.colorbar_style = colorbar_style
elif attribute == "id_main":
    values = joined_attributes[attribute]['values'].values()
    vmin, vmax = np.min(values), np.max(values)
    tsi = lbm.ThematicStyleColormap(value_key=attribute, vmin=vmin, vmax=vmax)
    thematic_legend_style = None
    colorbar_style = lbm.ColorbarStyle(title=attribute)
    tsi.colorbar_style = colorbar_style
polygon_style = lbm.PolygonStyle(fill_color=tsi,
                                 line_width=0.1,
                                 thematic_legend_style=thematic_legend_style)
style = lbm.CompositeStyle(polygon_style=polygon_style)
commune_layer = lbm.MapLayer(gis_data, style, legend_label={"polygons": ""})
layers.append(commune_layer)