Move pip installs from notebooks to Dockerfile and configure sentinelhub auth in .netrc

This commit is contained in:
heyarne 2020-08-12 10:52:03 +00:00
commit 39b70e21dc
10 changed files with 1222 additions and 451 deletions

View file

@ -1,4 +1,8 @@
# don't send downloaded artefacts to the docker build daemon # don't send downloaded artefacts to the docker build daemon
*.zip
*.tiff
*.jp2
**/input/**/*.zip **/input/**/*.zip
**/input/**/*.SAFE* **/input/**/*.SAFE*
**/input/**/*.jp2 **/input/**/*.jp2

7
.gitignore vendored
View file

@ -1,8 +1,15 @@
# avoid exposing secrets
.netrc
# ignore any raster files # ignore any raster files
*.jp2
*.tiff *.tiff
*.zip *.zip
*.SAFE *.SAFE
.jupyter
.local
# Created by https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks # Created by https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks
# Edit at https://www.toptal.com/developers/gitignore?templates=python,jupyternotebooks # Edit at https://www.toptal.com/developers/gitignore?templates=python,jupyternotebooks

3
.netrc.example Normal file
View file

@ -0,0 +1,3 @@
machine scihub.copernicus.eu
login your_username
password your_password

View file

@ -7,40 +7,6 @@
"Flutungsbeginn war der 12.4.2019. Wir versuchen mit Daten der Sentinel-1- und -2-Satelliten nachzuvollziehen, wie hoch der Wasserstand zum jeweiligen Zeitpunkt war." "Flutungsbeginn war der 12.4.2019. Wir versuchen mit Daten der Sentinel-1- und -2-Satelliten nachzuvollziehen, wie hoch der Wasserstand zum jeweiligen Zeitpunkt war."
] ]
}, },
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting sentinelsat\n",
" Using cached https://files.pythonhosted.org/packages/5c/79/c2ac7b71dd13db95a9b83865bbbc7f1e4359c2b141bedad21b0e181fa06e/sentinelsat-0.13-py2.py3-none-any.whl\n",
"Requirement already satisfied: click in /home/rus/.anaconda/lib/python3.7/site-packages (from sentinelsat) (7.0)\n",
"Collecting html2text\n",
" Downloading https://files.pythonhosted.org/packages/ae/88/14655f727f66b3e3199f4467bafcc88283e6c31b562686bf606264e09181/html2text-2020.1.16-py3-none-any.whl\n",
"Requirement already satisfied: six in /home/rus/.anaconda/lib/python3.7/site-packages (from sentinelsat) (1.14.0)\n",
"Collecting geomet\n",
" Downloading https://files.pythonhosted.org/packages/c9/81/156ca48f950f833ddc392f8e3677ca50a18cb9d5db38ccb4ecea55a9303f/geomet-0.2.1.post1-py3-none-any.whl\n",
"Collecting geojson>=2\n",
" Using cached https://files.pythonhosted.org/packages/e4/8d/9e28e9af95739e6d2d2f8d4bef0b3432da40b7c3588fbad4298c1be09e48/geojson-2.5.0-py2.py3-none-any.whl\n",
"Requirement already satisfied: tqdm in /home/rus/.anaconda/lib/python3.7/site-packages (from sentinelsat) (4.36.1)\n",
"Requirement already satisfied: requests in /home/rus/.anaconda/lib/python3.7/site-packages (from sentinelsat) (2.22.0)\n",
"Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /home/rus/.anaconda/lib/python3.7/site-packages (from requests->sentinelsat) (3.0.4)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /home/rus/.anaconda/lib/python3.7/site-packages (from requests->sentinelsat) (2019.11.28)\n",
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /home/rus/.anaconda/lib/python3.7/site-packages (from requests->sentinelsat) (1.24.2)\n",
"Requirement already satisfied: idna<2.9,>=2.5 in /home/rus/.anaconda/lib/python3.7/site-packages (from requests->sentinelsat) (2.8)\n",
"Installing collected packages: html2text, geomet, geojson, sentinelsat\n",
"Successfully installed geojson-2.5.0 geomet-0.2.1.post1 html2text-2020.1.16 sentinelsat-0.13\n"
]
}
],
"source": [
"! pip install sentinelsat"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 47, "execution_count": 47,
@ -50,12 +16,11 @@
"from sentinelsat import SentinelAPI, read_geojson, geojson_to_wkt\n", "from sentinelsat import SentinelAPI, read_geojson, geojson_to_wkt\n",
"from datetime import date\n", "from datetime import date\n",
"\n", "\n",
"user = 'heyarne'\n", "# set up ~/.netrc using the provided ~/.netrc.example in order to be properly authenticated\n",
"password='FhnNfPppxNbBm7wCoCGLnfly'\n", "api = SentinelAPI(None, None)\n",
"api = SentinelAPI(user, password)\n",
"\n", "\n",
"# the \"footprint\" is what we can use to preselect a certain area;\n", "# the \"footprint\" is what we can use to preselect a certain area;\n",
"# the lake is at (51.7874, 14.4226)\n", "# the lakesentinelsat/ is at (51.7874, 14.4226)\n",
"footprint = 'POLYGON((14.359428613281251 51.806620319822734,14.466545312500001 51.806620319822734,14.466545312500001 51.757343872357566,14.359428613281251 51.757343872357566,14.359428613281251 51.806620319822734))'" "footprint = 'POLYGON((14.359428613281251 51.806620319822734,14.466545312500001 51.806620319822734,14.466545312500001 51.757343872357566,14.359428613281251 51.757343872357566,14.359428613281251 51.806620319822734))'"
] ]
}, },
@ -44091,15 +44056,6 @@
" f.write('\\n'.join([p['link'] for _, p in products.items()]))" " f.write('\\n'.join([p['link'] for _, p in products.items()]))"
] ]
}, },
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [],
"source": [
"# ! aria2c --http-user={user} --http-passwd={password} -i link_list.txt"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@ -44124,7 +44080,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.7.4" "version": "3.8.5"
} }
}, },
"nbformat": 4, "nbformat": 4,

View file

@ -78,21 +78,21 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 2", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "python2" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 2 "version": 3
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2", "pygments_lexer": "ipython3",
"version": "2.7.12" "version": "3.8.5"
} }
}, },
"nbformat": 4, "nbformat": 4,

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,6 @@
FROM jupyter/scipy-notebook FROM jupyter/scipy-notebook
ENV JUPYTER_LAB_ENABLE=1 ENV JUPYTER_LAB_ENABLE=1
# RUN pip install geopandas sentinelsat==0.14 descartes && \ RUN pip install geopandas==0.18.1 descartes=1.1.0 sentinelsat==0.14 rasterio==1.1.5 && \
# fix-permissions $CONDA_DIR && \ fix-permissions $CONDA_DIR && \
# fix-permissions /home/$NB_USER fix-permissions /home/$NB_USER

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long