Initial commit

This commit is contained in:
heyarne 2020-07-08 12:58:21 +00:00
commit 09680432d2
12 changed files with 46756 additions and 0 deletions

154
.gitignore vendored Normal file
View file

@ -0,0 +1,154 @@
# ignore any raster files
*.tiff
*.zip
*.SAFE
# Created by https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks
# Edit at https://www.toptal.com/developers/gitignore?templates=python,jupyternotebooks
### JupyterNotebooks ###
# gitignore template for Jupyter Notebooks
# website: http://jupyter.org/
.ipynb_checkpoints
*/.ipynb_checkpoints/*
# IPython
profile_default/
ipython_config.py
# Remove previous ipynb_checkpoints
# git rm -r .ipynb_checkpoints/
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
# IPython
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# End of https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,100 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In order to configure this, run the following command:\n",
"\n",
"```\n",
"/usr/local/snap/bin/snapp-conf $(wich python2)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.append('/home/rus/.anaconda/lib/python3.7/lib/site-packages')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from snappy import ProductIO"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<span color='#fbb'>*Important:*</span> This only works in Pyhton 2 and is therefore not further explored. Trying the above command with `python3` yielded the following error:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```\n",
"\tat org.esa.snap.python.PyBridge.configureJpy(PyBridge.java:232)\n",
"\tat org.esa.snap.python.PyBridge.installPythonModule(PyBridge.java:149)\n",
"\tat org.esa.snap.rcp.cli.SnapArgsProcessor.processPython(SnapArgsProcessor.java:103)\n",
"\tat org.esa.snap.rcp.cli.SnapArgsProcessor.process(SnapArgsProcessor.java:49)\n",
"\tat org.netbeans.modules.sendopts.DefaultProcessor.process(DefaultProcessor.java:202)\n",
"\tat org.netbeans.spi.sendopts.Option$1.process(Option.java:387)\n",
"\tat org.netbeans.api.sendopts.CommandLine.process(CommandLine.java:317)\n",
"\tat org.netbeans.modules.sendopts.HandlerImpl.execute(HandlerImpl.java:62)\n",
"\tat org.netbeans.modules.sendopts.Handler.cli(Handler.java:69)\n",
"\tat org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)\n",
"\tat org.netbeans.core.startup.CLICoreBridge.cli(CLICoreBridge.java:82)\n",
"\tat org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)\n",
"\tat org.netbeans.CLIHandler$1.exec(CLIHandler.java:268)\n",
"\tat org.netbeans.CLIHandler.finishInitialization(CLIHandler.java:447)\n",
"\tat org.netbeans.MainImpl.finishInitialization(MainImpl.java:256)\n",
"\tat org.netbeans.Main.finishInitialization(Main.java:92)\n",
"\tat org.netbeans.core.startup.Main.start(Main.java:316)\n",
"\tat org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:123)\n",
"\tat java.lang.Thread.run(Thread.java:748)\n",
"Python configuration error: Python configuration failed.\n",
"Command [/home/rus/.anaconda/bin/python3 ./snappyutil.py --snap_home /usr/local/snap --java_module /home/rus/.snap/system/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --jvm_max_mem 10G --java_home /usr/local/snap/jre --req_arch amd64]\n",
"failed with return code 40.\n",
"Please check the log file '/home/rus/.anaconda/lib/python3.7/lib/site-packages/snappy/snappyutil.log'.\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.12"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
https://scihub.copernicus.eu/apihub/odata/v1/Products('297fbd5d-7aee-4458-bf92-0fabb2390686')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('beba8823-384b-40c4-9a46-f805c93e4c0b')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('0cd55e83-661a-4e6d-9260-090f181dba98')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('0c926d46-b8c3-4389-92c5-d55eeae24d27')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('f0357a27-f2ae-4cae-964a-4a239063e00e')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('94bae100-882b-4879-9803-f80e5836ed03')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('81a0f8d2-8e26-4a11-b237-2d77278a0201')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('a7e88612-b5f7-43f7-aeb9-c3a1f59988a9')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('4720dc74-5dcd-439f-98f6-ccce1f9e91ba')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('d3d8ca59-1ea2-423f-b5ca-0a796189de77')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('cb092920-5135-4d1a-8022-b3b9adeb0c71')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('a76efffe-dee1-4d90-bb0e-fe3ae2fd203e')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('b861e6c9-de3b-4b13-aadb-a5f307977c12')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('a096a190-a148-43ba-bf76-99d009c481c8')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('dbc5195f-e37e-4f7c-a2bc-4f8744875a00')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('2ccd7b68-a9ff-45de-91b2-532f63de58ad')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('b84b8e66-5788-47ad-82ec-43b30b81f648')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('768a8fc7-26f2-4daf-b326-fad0eb373932')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('a13c0d72-b29d-4ce4-95cd-72c6e6a0ef93')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('da264968-83e8-49e8-bd12-d1be4ea11d98')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('14ad7da9-61e3-49df-a093-d122f3d7741b')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('027baf71-82c7-4554-866a-93c939e037a6')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('fc303b98-b4d9-4e6a-a920-0cd5896f4b29')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('2fe656bf-98c1-449c-bb50-a0511f28335d')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('97f38784-462a-4f55-8015-64b700cad233')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('de1eb034-6504-4779-894b-cad441ca47df')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('7c42b169-f1fc-47cc-b853-7e3e529d5242')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('96dc4323-92d5-4e2a-a6c5-177b167431a3')/$value
https://scihub.copernicus.eu/apihub/odata/v1/Products('ddb91569-8c5e-4fe0-a227-b0454f56c2b8')/$value

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,36 @@
import zipfile
def band_paths(p, bands, resolution=None):
'''
Given a zip file at `p`, returns the paths inside p to the raster files containing
information for the given bands. Because some bands are available in more than one
resolution, this can be filtered by prodiding a third parameter (e.g. resolution='10m').
The returned paths are formatted in the zip scheme as per Apache Commons VFS and can
thus be directly opened by rasterio.
'''
with zipfile.ZipFile(p) as f:
files = f.namelist()
rasters = [f for f in files if f.endswith('.jp2')]
rasters = [r for r in rasters for b in bands if b in r]
if resolution:
rasters = [r for r in rasters if resolution in r]
rasters = ['zip+file://' + p + '!/' + r for r in rasters]
return rasters
def rgb_paths(zip_file, resolution='10m'):
return band_paths(zip_file, ['B02', 'B03', 'B04'], resolution)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,36 @@
import zipfile
def band_paths(p, bands, resolution=None):
'''
Given a zip file at `p`, returns the paths inside p to the raster files containing
information for the given bands. Because some bands are available in more than one
resolution, this can be filtered by prodiding a third parameter (e.g. resolution='10m').
The returned paths are formatted in the zip scheme as per Apache Commons VFS and can
thus be directly opened by rasterio.
'''
with zipfile.ZipFile(p) as f:
files = f.namelist()
rasters = [f for f in files if f.endswith('.jp2')]
rasters = [r for r in rasters for b in bands if b in r]
if resolution:
rasters = [r for r in rasters if resolution in r]
rasters = ['zip+file://' + p + '!/' + r for r in rasters]
return rasters
def rgb_paths(zip_file, resolution='10m'):
return band_paths(zip_file, ['B02', 'B03', 'B04'], resolution)