"pplt" → "plt"

This commit is contained in:
heyarne 2021-03-02 14:31:16 +00:00
commit 1ff1d972d5
7 changed files with 126 additions and 136 deletions

View file

@ -214,7 +214,7 @@
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as pplt\n",
"import matplotlib.pyplot as plt\n",
"from sentinel_helpers import scihub_band_paths, scihub_band_date, RasterReaderList\n",
"import rasterio as r\n",
"import rasterio.plot as rplt\n",
@ -224,7 +224,7 @@
"\n",
"def plot_nbrs(products, geom):\n",
" with RasterReaderList(products) as readers:\n",
" fig, axes = pplt.subplots(nrows=1, ncols=3, figsize=(20, 20))\n",
" fig, axes = plt.subplots(nrows=1, ncols=3, figsize=(20, 20))\n",
"\n",
" # we need to reproject from WGS84 so the geometry can be correctly plotted on the map\n",
" _geom = geom.to_crs(readers[0].crs)\n",
@ -252,7 +252,7 @@
" _geom.plot(ax=ax, facecolor='none', edgecolor='red')\n",
" \n",
" # increase horizontal whitespace between subplots\n",
" pplt.subplots_adjust(wspace=0.32)\n",
" plt.subplots_adjust(wspace=0.32)\n",
" \n",
" # add colorbar using the last image\n",
" img = axes[-1].get_images()[0]\n",
@ -385,7 +385,7 @@
"dnbr_norm = BoundaryNorm(boundaries, dnbr_cmap.N, clip=True)\n",
"\n",
"def plot_dnbr(dnbr, dnbr_crs, dnbr_transform, geom):\n",
" fig, (ax1, ax2) = pplt.subplots(ncols=2, figsize=(16, 8))\n",
" fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(16, 8))\n",
" _geom = geom.to_crs(dnbr_crs)\n",
"\n",
" # plot black and white image\n",
@ -451,8 +451,8 @@
"\n",
"potsdam_mittelmark_extract = dnbr[0,500:800,420:810]\n",
"\n",
"img = pplt.imshow(potsdam_mittelmark_extract, cmap='Greys')\n",
"pplt.colorbar(img)"
"img = plt.imshow(potsdam_mittelmark_extract, cmap='Greys')\n",
"plt.colorbar(img)"
]
},
{
@ -622,8 +622,8 @@
" out_shape=(window.height, window.width),\n",
" transform=window_transform)\n",
"\n",
"pplt.figure(figsize=(10, 10))\n",
"pplt.imshow(nature_reserve_mask)"
"plt.figure(figsize=(10, 10))\n",
"plt.imshow(nature_reserve_mask)"
]
},
{
@ -635,8 +635,8 @@
"burned_in_nature_reserve = dnbr.copy()\n",
"burned_in_nature_reserve.mask = burned_in_nature_reserve.mask | nature_reserve_mask\n",
"\n",
"pplt.figure(figsize=(10, 10))\n",
"pplt.imshow(burned_in_nature_reserve[0], cmap=dnbr_cmap, norm=dnbr_norm)"
"plt.figure(figsize=(10, 10))\n",
"plt.imshow(burned_in_nature_reserve[0], cmap=dnbr_cmap, norm=dnbr_norm)"
]
},
{
@ -653,8 +653,8 @@
"outputs": [],
"source": [
"burned_in_nature_reserve.mask = burned_in_nature_reserve.mask | (burned_in_nature_reserve.data < 0.1)\n",
"pplt.figure(figsize=(10, 10))\n",
"pplt.imshow(burned_in_nature_reserve[0], cmap=dnbr_cmap, norm=dnbr_norm)"
"plt.figure(figsize=(10, 10))\n",
"plt.imshow(burned_in_nature_reserve[0], cmap=dnbr_cmap, norm=dnbr_norm)"
]
},
{
@ -743,7 +743,7 @@
" tci_paths = map(lambda p: scihub_band_paths(p, ['TCI'], '60m')[0], products)\n",
" \n",
" with RasterReaderList(tci_paths) as readers:\n",
" fig, axes = pplt.subplots(ncols=len(readers), figsize=(20,10))\n",
" fig, axes = plt.subplots(ncols=len(readers), figsize=(20,10))\n",
" _geom = geometry.to_crs(readers[0].crs)\n",
" \n",
" window = geometry_window(readers[0], _geom.buffer(5000))\n",
@ -869,8 +869,8 @@
" out_shape=(window.height, window.width),\n",
" transform=window_transform)\n",
"\n",
"pplt.figure(figsize=(10, 10))\n",
"pplt.imshow(luebtheen_military_site_mask)"
"plt.figure(figsize=(10, 10))\n",
"plt.imshow(luebtheen_military_site_mask)"
]
},
{
@ -882,8 +882,8 @@
"burned_in_military_site = dnbr.copy()\n",
"burned_in_military_site.mask = burned_in_military_site.mask | luebtheen_military_site_mask\n",
"\n",
"pplt.figure(figsize=(10, 10))\n",
"pplt.imshow(burned_in_military_site[0], cmap=dnbr_cmap, norm=dnbr_norm)"
"plt.figure(figsize=(10, 10))\n",
"plt.imshow(burned_in_military_site[0], cmap=dnbr_cmap, norm=dnbr_norm)"
]
},
{
@ -895,8 +895,8 @@
"# keep only the pixels with a burn serverity of at least 0.1\n",
"burned_in_military_site.mask = burned_in_military_site.mask | (burned_in_military_site.data < 0.1)\n",
"\n",
"pplt.figure(figsize=(10, 10))\n",
"pplt.imshow(burned_in_military_site[0], cmap=dnbr_cmap, norm=dnbr_norm)"
"plt.figure(figsize=(10, 10))\n",
"plt.imshow(burned_in_military_site[0], cmap=dnbr_cmap, norm=dnbr_norm)"
]
},
{