##########################################################################################
 # mask non-AU polygons
 nonmask = [0, 2, 3, 4, 6, 7, 11, 13, 16, 17] # polygon number
 landpolys = []
 for pidx, polygon in enumerate(m.landpolygons):
     maskPoly = True
     for nmidx in nonmask:
         if pidx == nmidx:
             maskPoly = False 
     if maskPoly == True:
         poly = polygon.get_coords()
         plt.fill(poly[:,0], poly[:,1], 'w')
     
 #mask_outside_polygon(polys[1][::-1], ax=None)
 polys = get_map_polygons(m)
 mask_outside_polygons(polys, '0.9', plt)
 
 # get lake ploygons
 polygons = []
 for polygon in m.lakepolygons:
     poly = polygon.get_coords()
     plt.fill(poly[:,0], poly[:,1], '0.9')
     polygons.append(poly)
 
 '''
 ###########################################################################################
 annotate cities
 ###########################################################################################
 '''
 
 pe = [PathEffects.withStroke(linewidth=2.5, foreground="w")]
Beispiel #2
0
# get scale position and length
slon = m.llcrnrlon + 0.15*(m.urcrnrlon - m.llcrnrlon)
slat = m.llcrnrlat + 0.06*(m.urcrnrlat - m.llcrnrlat)
slon0 = mean([m.urcrnrlon, m.llcrnrlon])
slat0 = mean([m.urcrnrlat, m.llcrnrlat])

m.drawmapscale(slon, slat, slon0, slat0, scaleLength, fontsize = 14, barstyle='fancy', zorder=1000)

##########################################################################################
# get land & lake polygons for masking
##########################################################################################

polys = get_map_polygons(m)

mask_outside_polygons(polys, 'lightskyblue', plt)

# get lake ploygons and mask
polygons = []
for polygon in m.lakepolygons:
    poly = polygon.get_coords()
    plt.fill(poly[:,0], poly[:,1], 'lightskyblue')
    polygons.append(poly)

##########################################################################################
# get cmap
##########################################################################################
# get colormap
if getcwd().startswith('/nas'):
    cptfile = '/nas/active/ops/community_safety/ehp/georisk_earthquake/hazard/DATA/cpt/mi_pop.cpt'
else: