|
| | parser = argparse.ArgumentParser(description="add overlays to mapped PNG images output from mapgen (or l3mapgen)") |
| |
| | type |
| |
| | str |
| |
| | help |
| |
| | default |
| |
| | None |
| |
| | action |
| |
| | float |
| |
| | choices |
| |
| | args = parser.parse_args() |
| |
| | ofile = args.ofile |
| |
| | ofilePath = Path(args.ifile) |
| |
| | pinfofile = args.projinfo |
| |
| dictionary | pinfo = {} |
| |
| list | asString = ['proj','scale_type'] |
| |
| | key |
| |
| | value |
| |
| list | pinfokeys = ['minX','maxX','minY','maxY','north','south','east','west','datamin','datamax','scale_type','proj'] |
| |
| tuple | img_extent_meters = (pinfo['minX'],pinfo['maxX'],pinfo['minY'],pinfo['maxY']) |
| |
| tuple | img_extent = (pinfo['west'],pinfo['east'],pinfo['south'],pinfo['north']) |
| |
| | img = plt.imread(args.ifile) |
| |
| int | dpi = 72 |
| |
| | imgwidth = img.shape[1]/float(dpi) |
| |
| | imgheight = img.shape[0]/float(dpi) |
| |
| | padheight = np.ceil(imgwidth*0.3) |
| |
| | padwidth = np.ceil(imgheight*0.3) |
| |
| | figwidth = np.round(imgwidth + padwidth, decimals=2) |
| |
| | figheight = np.round(imgheight + padheight, decimals=2) |
| |
| | figrows = int(np.ceil(4*figheight)) |
| |
| | fig = plt.figure(figsize=(figwidth, figheight), dpi=dpi) |
| |
| def | crs = get_crs_from_proj(pinfo['proj']) |
| |
| | bottom = int(np.floor(0.025*figrows)) |
| |
| | ax = plt.subplot2grid((figrows,7),(0,0),rowspan=figrows-bottom, colspan=7, fig=fig,projection=crs) |
| |
| | extent |
| |
| | origin |
| |
| | transform |
| |
| | label |
| |
| | fontsize |
| |
| | resolution |
| |
| | color |
| |
| | linewidth |
| |
| int | labelsize = 14 * (figheight / 14.0) |
| |
| bool | labelgrid = True |
| |
| | gl |
| |
| | bottom_labels |
| |
| | xlines |
| |
| | ylines |
| |
| | xlabel_style |
| |
| | ylabel_style |
| |
| def | lons = calculate_gridline_increments(pinfo['west'],pinfo['east']) |
| |
| def | lats = calculate_gridline_increments(pinfo['south'],pinfo['north']) |
| |
| | xlocator |
| |
| | ylocator |
| |
| | cbax = plt.subplot2grid((figrows,7),(figrows-bottom,2),fig=fig,rowspan=bottom,colspan=3) |
| |
| def | cmap = get_palette(args.palfile) |
| |
| | norm = mpl.colors.Normalize(vmin=pinfo['datamin'], vmax=pinfo['datamax']) |
| |
| | formatter = None |
| |
| | cb |
| |
| | cbartitle |
| |
| | size |
| |
| | left |
| |
| | right |
| |
| | top |
| |
| | bbox_inches |
| |
| | pad_inches |
| |
| | transparent |
| |