2019-11-06 11:04:01 +00:00
|
|
|
## Copyright 2019 Fabian Hofmann (FIAS)
|
2019-11-05 11:53:21 +00:00
|
|
|
|
2019-11-06 13:50:59 +00:00
|
|
|
"""
|
|
|
|
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3518215.svg
|
|
|
|
:target: https://doi.org/10.5281/zenodo.3518215
|
|
|
|
|
|
|
|
This rule, as a substitute for :mod:`build_natura_raster`, downloads an already rasterized version (`natura.tiff <https://zenodo.org/record/3518215/files/natura.tiff>`_) of `Natura 2000 <https://en.wikipedia.org/wiki/Natura_2000>`_ natural protection areas to reduce computation times. The file is placed into the ``resources`` sub-directory.
|
|
|
|
|
|
|
|
**Relevant Settings**
|
|
|
|
|
|
|
|
.. code:: yaml
|
|
|
|
|
|
|
|
enable:
|
|
|
|
build_natura_raster:
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
Documentation of the configuration file ``config.yaml`` at
|
|
|
|
:ref:`toplevel_cf`
|
|
|
|
|
|
|
|
**Outputs**
|
|
|
|
|
|
|
|
- ``resources/natura.tiff``: Rasterized version of `Natura 2000 <https://en.wikipedia.org/wiki/Natura_2000>`_ natural protection areas to reduce computation times.
|
|
|
|
|
|
|
|
.. seealso::
|
2019-12-09 20:29:15 +00:00
|
|
|
For details see :mod:`build_natura_raster`.
|
2019-11-06 13:50:59 +00:00
|
|
|
|
|
|
|
"""
|
|
|
|
|
2019-11-28 07:22:52 +00:00
|
|
|
import logging
|
2019-11-05 11:53:21 +00:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
2019-11-28 07:22:52 +00:00
|
|
|
from pathlib import Path
|
|
|
|
from _helpers import progress_retrieve, configure_logging
|
2019-11-05 11:53:21 +00:00
|
|
|
|
2019-11-06 13:50:59 +00:00
|
|
|
if __name__ == "__main__":
|
2019-12-09 20:29:15 +00:00
|
|
|
if 'snakemake' not in globals():
|
|
|
|
from _helpers import mock_snakemake
|
|
|
|
snakemake = mock_snakemake('retrieve_natura_raster')
|
2019-11-28 07:22:52 +00:00
|
|
|
configure_logging(snakemake) # TODO Make logging compatible with progressbar (see PR #102)
|
|
|
|
|
|
|
|
url = "https://zenodo.org/record/3518215/files/natura.tiff"
|
2019-11-06 13:50:59 +00:00
|
|
|
|
2019-11-28 07:22:52 +00:00
|
|
|
logger.info(f"Downloading natura raster from '{url}'.")
|
2019-12-09 20:29:15 +00:00
|
|
|
progress_retrieve(url, snakemake.output[0])
|
|
|
|
|
|
|
|
logger.info(f"Natura raster available as '{snakemake.output[0]}'.")
|