-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
078b44e
commit 1cd6d3e
Showing
7 changed files
with
2,232 additions
and
419 deletions.
There are no files selected for viewing
2,524 changes: 2,125 additions & 399 deletions
2,524
notebooks/manuscript_figures_master-revision.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,58 @@ | ||
#! /usr/bin/env python | ||
import matplotlib | ||
matplotlib.use('Agg') | ||
|
||
import numpy as np | ||
import pandas as pd | ||
import geopandas as gpd | ||
from imview import pltlib | ||
import matplotlib.pyplot as plt | ||
from pygeotools.lib import iolib,warplib | ||
|
||
def shp_merger(shplist): | ||
""" | ||
merge multiple geopandas shapefiles into 1 multi-row shapefile | ||
Parameters | ||
---------- | ||
------------ | ||
shplist: list | ||
list of geopandas shapefiles | ||
Returns | ||
---------- | ||
------------ | ||
gpd_merged: geopandas geodataframe | ||
merged multirow shapefile | ||
""" | ||
#Taken from here: "https://stackoverflow.com/questions/48874113/concat-multiple-shapefiles-via-geopandas" | ||
gpd_merged = pd.concat([shp for shp in shplist]).pipe(gpd.GeoDataFrame) | ||
return gpd_merged | ||
|
||
def plot_composite_fig(ortho,dem,count,nmad,outfn,product='triplet'): | ||
""" | ||
Plot the gallery figure for final DEM products | ||
Parameters | ||
------------ | ||
ortho: str | ||
path to orthoimage | ||
dem: str | ||
path to dem | ||
count: str | ||
path to count map | ||
nmad: str | ||
path to NMAD | ||
outfn: str | ||
path to save output figure | ||
ortho: str | ||
product to plot (triplet/video) | ||
""" | ||
if product == 'triplet': | ||
figsize=(10,8) | ||
else: | ||
figsize=(10,3) | ||
f,ax = plt.subplots(1,4,figsize=figsize) | ||
ds_list = warplib.memwarp_multi_fn([ortho,dem,count,nmad],res='max') | ||
ortho,dem,count,nmad = [iolib.ds_getma(x) for x in ds_list] | ||
pltlib.iv(ortho,ax=ax[0],cmap='gray',scalebar=True,cbar=False,ds=ds_list[0],skinny=False) | ||
pltlib.iv(dem,ax=ax[1],hillshade=True,scalebar=False,ds=ds_list[1],label='Elevation (m WGS84)',skinny=False) | ||
pltlib.iv(count,ax=ax[2],cmap='YlOrRd',label='DEM count',skinny=False) | ||
pltlib.iv(nmad,ax=ax[3],cmap='inferno',clim=(0,10),label='Elevation NMAD (m)',skinny=False) | ||
plt.tight_layout() | ||
f.savefig(outfn,dpi=300,bbox_inches='tight',pad_inches=0.1) |