Last active
July 2, 2021 11:02
-
-
Save drnextgis/d5d2561da5ae85cad74a22e31185ced7 to your computer and use it in GitHub Desktop.
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import rasterio\n", | |
"from rasterio.plot import show\n", | |
"from rasterio.vrt import WarpedVRT" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"([<MaskFlags.per_dataset: 2>], [<MaskFlags.per_dataset: 2>], [<MaskFlags.per_dataset: 2>])\n", | |
"0.0\n" | |
] | |
} | |
], | |
"source": [ | |
"with rasterio.open(\"masked.tif\") as src:\n", | |
" print(src.mask_flag_enums)\n", | |
" print(src.nodata)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 15, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAVEAAAD5CAYAAACeTgZ1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAPBUlEQVR4nO3db4ylZXnH8e+vdFgUNLiKmy1LClVaQowMyXSL0Re4FrulpmBijLQxvCBdm0iiiWmLNqmatAkmFcqLxmQVyppQkYIGQmh1u5JsTBpkwGVZ/hSQYmS7shogQJsuu3D1xXlIRpjZOTP3OXP+zPeTnMx57nNmn+sOZ37c57nOc55UFZKk1fm1URcgSZPMEJWkBoaoJDUwRCWpgSEqSQ0MUUlq8Ostv5xkO3AdcALwjaq6+njPPzEb6iRObtmlJtBvv/d/R13CcT22/82jLkFj7v/4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vttzN9cyzg+0nuS7KjGxv4a9Vvtl8jVVVJpuLzZElOAW4DPltVL/QWMT3TMM+qegWYTXIq8F3gnNFWNFhJPgIcrqr7klw44nKG6QNVdTDJO4HdSR5d+OCgXqtrvRI9CJyxYHtLNzatnkmyGaD7eXjE9TRLMkMvQG+qqu90w1M3T4Cqeh64G3gfcGqS1xYdk/66fT/wx0meondIbRtwHdM1R6rqYPfzML3/GW5lCK/VtQ7Re4Gzuy7gicAngDvWuIa1dAdweXf/cuD2EdbSrDtudj3wSFVds+ChqZlnktO6FShJ3gRcRO/Y793Ax7qnTfQcq+rzVbWlqs6k9zf4g6r6U6ZojklOTvKW1+4DHwYOMIzXalWt6Q24GHiM3nGmv17r/Q9xXt8CDgFH6R1PuoLecaY9wOPAvwMbR11n4xw/QO84035gX3e7eJrmCbwX+HE3xwPA33TjvwX8CHgC+Bdgw6hrHdB8LwTunLY5dnN5oLs99FrWDOO16mmfktTAM5YkqYEhKkkNDFFJamCISlIDQ1SSGhiiktTAEJWkBv8PoZqtwMRcftwAAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"with rasterio.open(\"masked.tif\") as src:\n", | |
" show(src.dataset_mask())" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAVEAAAD5CAYAAACeTgZ1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAObElEQVR4nO3db4hl9X3H8fenk020UVA3G9m6SzdNpEFCHWG6GMwDs6nJ1oZqIITYEnwgbAoJKEhbk0KbQAsGGm0ehMAmWveBV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BvdPPrmbw+FvCjJA8l2dG1DXxf7eeRyRqAqqokE/F7siRnAN8Hrquql3sHMT2T0M+qmgOmk5wF/BD44OpWNFhJPgkcq6qHkly6yuUM00eq6kiS9wK7kzwxf+Gg9tWVPhI9AmyeN7+pa5tUzyfZCNC9H1vlepolWUcvQG+vqh90zRPXT4CqegnYC3wYOCvJmwcd477fXgL8cZJn6J1S2wZ8g8nqI1V1pHs/Ru9/hlsZwr660iH6U+D8bhTwncBngXtWuIaVdA9wdTd9NXD3KtbSrDtvdgtwuKpumrdoYvqZZEN3BEqS04HL6J373Qt8ulttrPtYVV+qqk1VtYXev8EfV9WfMkF9TPLuJGe+OQ18HDjIMPbVqlrRF3A58DN655n+aqW3P8R+3QEcBf6P3vmka+idZ9oDPAn8G3DOatfZ2MeP0DvPdADY370un6R+Ar8HPNL18SDw11377wAPAk8B/wy8a7VrHVB/LwXunbQ+dn15tHsdejNrhrGvetmnJDXwiiVJamCISlIDQ1SSGhiiktTAEJWkBoaoJDUwRCWpwf8DCuUwyzBK934AAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"with rasterio.Env(GDAL_DISABLE_READDIR_ON_OPEN=\"FALSE\"):\n", | |
" with rasterio.open(\"masked.tif\") as src:\n", | |
" with WarpedVRT(src, add_alpha=True) as vrt:\n", | |
" show(vrt.dataset_mask())" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Creating output file that is 53P x 38L.\r\n", | |
"Processing input file masked.tif.\r\n", | |
"Using internal nodata values (e.g. 0) for image masked.tif.\r\n", | |
"Copying nodata values from source masked.tif to destination warped.tif.\r\n", | |
"0...10...20...30...40...50...60...70...80...90...100 - done.\r\n" | |
] | |
} | |
], | |
"source": [ | |
"!gdalwarp -dstalpha masked.tif warped.tif" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"/home/denis/satellogic/env/lib/python3.6/site-packages/ipykernel_launcher.py:2: NodataShadowWarning: The dataset's nodata attribute is shadowing the alpha band. All masks will be determined by the nodata attribute\n", | |
" \n" | |
] | |
}, | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAVEAAAD5CAYAAACeTgZ1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAPBUlEQVR4nO3db4ylZXnH8e+vdFgUNLiKmy1LClVaQowMyXSL0Re4FrulpmBijLQxvCBdm0iiiWmLNqmatAkmFcqLxmQVyppQkYIGQmh1u5JsTBpkwGVZ/hSQYmS7shogQJsuu3D1xXlIRpjZOTP3OXP+zPeTnMx57nNmn+sOZ37c57nOc55UFZKk1fm1URcgSZPMEJWkBoaoJDUwRCWpgSEqSQ0MUUlq8Ostv5xkO3AdcALwjaq6+njPPzEb6iRObtmlJtBvv/d/R13CcT22/82jLkFj7v/4H16uI1nssaz2c6JJTgAeAy4CngbuBS6rqoeX+p23ZmP9Xj60qv1pcn3vv/eNuoTj+oPfmB11CRpz99QeXqhnFw3RlrfzW4EnqurJqnoZuBm4pOHfk6SJ0xKipwM/W7D9dDf2K5LsSDKfZP4oRxp2J0njZ+iNparaWVVzVTU3w4Zh706S1lRLiB4EzliwvaUbk6R1o6U7fy9wdpKz6IXnJ4A/GUhVE2zcmyh6o6X+m9lwUj9WHaJVdSzJlcD36H3E6YaqemhglUnSBGj6nGhV3QXcNaBaJGnieMaSJDUwRCWpQdPb+fXOJtJ0s+GkfrgSlaQGhqgkNTBEJamBISpJDQxRS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klOTvKW1+4DHwYOMIzXalWt6Q24GHiM3nGmv17r/Q9xXt8CDgFH6R1PuoLecaY9wOPAvwMbR11n4xw/QO84035gX3e7eJrmCbwX+HE3xwPA33TjvwX8CHgC+Bdgw6hrHdB8LwTunLY5dnN5oLs99FrWDOO16mmfktTAM5YkqYEhKkkNDFFJamCISlIDQ1SSGhiiktTAEJWkBv8PoZqtwMRcftwAAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"with rasterio.open(\"warped.tif\") as src:\n", | |
" show(src.dataset_mask())" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.6" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment