vspace = 0.015 # y-space between subplots left = 0.125 # right space on page right = 0.9 # right space on page bottom = 0.25 # right space on page # bottom = 0.55 # only 5 catchments top = 0.9 # right space on page textsize = 10 # standard text size dxabc = 0.99 # % of (max-min) shift to the right from left y-axis for a,b,c,... labels dyabc = 0.90 # % of (max-min) shift up from lower x-axis for a,b,c,... labels lwidth = 1.0 # linewidth elwidth = 1.0 # errorbar line width alwidth = 1.0 # axis line width msize = 2.5 # marker size mwidth = 1.0 # marker edge width mcol1 = color.get_brewer('rdylbu4').colors[1] # observation --> orange mcol2 = color.get_brewer('rdylbu4').colors[3] # optimal simulation --> light blue mcol3 = color.get_brewer('rdylbu4').colors[2] # initial simulation --> dark blue mcol = color.colours(['blue','red','darkblue','gray','yellow', 'green', 'darkgreen', 'darkblue','darkgrey','black']) lcol1 = color.colours('gray') lcol2 = color.colours('black') lcol3 = '0.0' textbox_x = 0.5 textbox_y = 1.1 # Legend llxbbox = 1.0 # x-anchor legend bounding box llybbox = 0.95 # y-anchor legend bounding box llrspace = -0.02 # spacing between rows in legend llcspace = 0.05 # spacing between columns in legend
vspace = 0.010 # y-space between subplots left = 0.125 # right space on page right = 0.9 # right space on page bottom = 0.25 # right space on page # bottom = 0.55 # only 5 catchments top = 0.9 # right space on page textsize = 10 # standard text size dxabc = 0.98 # % of (max-min) shift to the right from left y-axis for a,b,c,... labels dyabc = 0.85 # % of (max-min) shift up from lower x-axis for a,b,c,... labels lwidth = 1.0 # linewidth elwidth = 1.0 # errorbar line width alwidth = 1.0 # axis line width msize = 2.5 # marker size mwidth = 1.0 # marker edge width mcol1 = color.get_brewer('rdylbu4').colors[1] # observation --> orange mcol2 = color.get_brewer('rdylbu4').colors[3] # optimal simulation --> light blue mcol3 = color.get_brewer('rdylbu4').colors[2] # initial simulation --> dark blue mcol = color.colours(['blue','red','darkblue','gray','yellow', 'green', 'darkgreen', 'darkblue','darkgrey','black']) lcol1 = color.colours('gray') lcol2 = '0.0' lcol3 = '0.0' textbox_x = 0.5 textbox_y = 1.1 # Legend llxbbox = 1.0 # x-anchor legend bounding box llybbox = 0.95 # y-anchor legend bounding box llrspace = 0. # spacing between rows in legend llcspace = 1.0 # spacing between columns in legend
# colors if dobw: c = np.linspace(0.2, 0.85, nmod) c = np.ones(nmod) * 0.7 c = [str(i) for i in c] ocean_color = '0.1' else: c = get_brewer('rdylbu11', rgb=True) tmp = c.pop(5) # rm yellow np.random.shuffle(c) #c.insert(2,c[2]) # same colour for both soil moistures ocean_color = (151 / 256., 183 / 256., 224 / 256.) # ocean_color = color.get_brewer('accent5', rgb=True)[-1] cc = color.get_brewer('dark_rainbow_256', rgb=True) cc = cc[::-1] # reverse colors cmap = mpl.colors.ListedColormap(cc) # colors for each sub-basin from uwyellow4 (228,180,42) to gray graylevel = 0.2 uwyellow = [251, 213, 79] cc = [((uwyellow[0] + ii / (22. - 1) * (256 * graylevel - uwyellow[0])) / 256., (uwyellow[1] + ii / (22. - 1) * (256 * graylevel - uwyellow[1])) / 256., (uwyellow[2] + ii / (22. - 1) * (256 * graylevel - uwyellow[2])) / 256.) for ii in range(22)] cmap = mpl.colors.ListedColormap(cc) cc = color.get_brewer('Paired8', rgb=True) cmap = mpl.colors.ListedColormap(cc)
textbox = False # if true: additional information is set as text box within plot textbox_x = 0.95 textbox_y = 0.85 # ------------------------------------------------------------------------- # Setup Calculations # if dowhite: fgcolor = 'white' bgcolor = 'black' else: fgcolor = 'black' bgcolor = 'white' # colors cols1 = color.get_brewer('YlOrRd9', rgb=True) cols1 = color.get_brewer('WhiteYellowOrangeRed', rgb=True)[30:] cols1 = color.get_brewer('dark_rainbow_256', rgb=True) # blue to red cols2 = color.get_brewer('YlOrRd9', rgb=True)[::-1] cols2 = color.get_brewer('WhiteYellowOrangeRed', rgb=True)[30:][::-1] cols2 = color.get_brewer('dark_rainbow_256', rgb=True)[::-1] # red to blue cols3 = [cols2[0], cols2[95], cols2[-1]] # red, yellow, blue cols3 = [color.colours('gray'), cols2[0], color.colours('white')] # gray red white # ------------------------------------------------------------------------- # Colors # ------------------------------------------------------------------------- colors_benchmark = ( #color.get_brewer( 'WhiteBlueGreenYellowRed',rgb=True)[20],
diff_T_2_corrected += [ np.abs(inflows_obs_corrected[-3] - inflows_sim_corrected[-3]) ] # ------------------------------------------ # (D) Plot # ------------------------------------------ outtype = 'pdf' usetex = False serif = False dowhite = False alphamod = 0.7 # Brewer sequential cols_para = color.get_brewer('YlOrRd9', rgb=True) # need to be at least 9 colors cols_para = color.get_brewer('Paired9', rgb=True) # need to be at least 9 colors cols_basin = color.get_brewer('YlOrRd4', rgb=True) # need to be at least 4 colors cols_basin = color.get_brewer('Paired4', rgb=True) # need to be at least 4 colors cols = color.get_brewer('RdBu8', rgb=True) cols_category = color.get_brewer('RdYlBu8', rgb=True) # need to be at least 8 colors cols_dense = color.get_brewer('BlueWhiteOrangeRed', rgb=True) # add same alpha as for categories def add_alpha(col, alpha): icol = list(col)
mpl.rc('font', size=textsize) mpl.rc('lines', linewidth=lwidth, color='black') mpl.rc('axes', linewidth=alwidth, labelcolor='black') mpl.rc('path', simplify=False) # do not remove from matplotlib.patches import Rectangle, Circle, Polygon from mpl_toolkits.basemap import Basemap # colors if dobw: c = np.linspace(0.2, 0.85, nmod) c = np.ones(nmod)*0.7 c = [ str(i) for i in c ] ocean_color = '0.1' else: c = color.get_brewer('dark_rainbow_256', rgb=True) c = c[::-1] # reverse colors ocean_color = (151/256., 183/256., 224/256.) cmap = mpl.colors.ListedColormap(c) # use a colormap from Brewer module cc = color.get_brewer('gsdtol', rgb=True)[10:] cmap_gray = mpl.colors.ListedColormap(cc) if (True): # Latlon fname = inputfile ds = xr.open_dataset(fname)