def get_weather_icons(ww, time): #from matplotlib._png import read_png """ Get the path to a png given the weather representation """ weather = [] for w in ww.values: if w.astype(int).astype(str) in WMO_GLYPH_LOOKUP_PNG: weather.append(WMO_GLYPH_LOOKUP_PNG[w.astype(int).astype(str)]) else: weather.append('empty') weather_icons = [] for date, weath in zip(time, weather): if date.hour >= 6 and date.hour <= 18: add_string = 'd' elif date.hour >= 0 and date.hour < 6: add_string = 'n' elif date.hour > 18 and date.hour < 24: add_string = 'n' pngfile = folder_glyph + '%s.png' % (weath + add_string) if os.path.isfile(pngfile): weather_icons.append(read_png(pngfile)) else: pngfile = folder_glyph + '%s.png' % weath weather_icons.append(read_png(pngfile)) return (weather_icons)
def add_logo_on_map(ax, logo=home_folder+'/plotting/meteoindiretta_logo.png', zoom=0.15, pos=(0.92, 0.1)): '''Add a logo on the map given a pnd image, a zoom and a position relative to the axis ax.''' img_logo = OffsetImage(read_png(logo), zoom=zoom) logo_ann = AnnotationBbox( img_logo, pos, xycoords='axes fraction', frameon=False) logo_ann.set_zorder(10) at = ax.add_artist(logo_ann) return at
def add_logo_on_map(ax, logo, zoom=0.15, pos=(0.92, 0.1)): '''Add a logo on the map given a pnd image, a zoom and a position relative to the axis ax.''' img_logo = OffsetImage(read_png(logo), zoom=zoom) logo_ann = AnnotationBbox(img_logo, pos, xycoords='axes fraction', frameon=False) at = ax.add_artist(logo_ann) return at