85c356297a
* Add logging to logfiles to all snakemake workflow scripts. * Fix missing quotation marks in Snakefile. * Apply suggestions from code review Co-Authored-By: Fabian Neumann <fabian.neumann@outlook.de> * Apply suggestions from code review Co-Authored-By: Fabian Neumann <fabian.neumann@outlook.de> * doc: fix _ec_ filenames in docs * Allow logging message format to be specified in config.yaml. * Add logging for Snakemake rule 'retrieve_databundle '. * Add limited logging to STDERR only for retrieve_*.py scripts. * Import progressbar module only on demand. * Fix logging to file and enable concurrent printing to STDERR for most scripts. * Add new 'logging_format' option to Travis CI test config.yaml. * Add missing parenthesis (bug fix) and cross-os compatible paths. * Fix typos in messages. * Use correct log files for logging (bug fix). * doc: fix line references * config: logging_format in all configs * doc: add doc for logging_format * environment: update to powerplantmatching 0.4.3 * doc: update line references for tutorial.rst * Change logging configuration scheme for config.yaml. * Add helper function for doing basic logging configuration. * Add logpath for prepare_links_p_nom rule. * Outsource basic logging configuration for all scripts to _helper submodule. * Update documentation for changed config.yaml structure. Instead of 'logging_level' and 'logging_format', now 'logging' with subcategories is used. * _helpers: Change configure_logging signature.
48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
## Copyright 2019 Fabian Hofmann (FIAS)
|
|
|
|
"""
|
|
.. 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::
|
|
For details see :mod:`build_natura_raster`.
|
|
|
|
"""
|
|
|
|
import logging
|
|
logger = logging.getLogger(__name__)
|
|
|
|
from pathlib import Path
|
|
from _helpers import progress_retrieve, configure_logging
|
|
|
|
if __name__ == "__main__":
|
|
|
|
configure_logging(snakemake) # TODO Make logging compatible with progressbar (see PR #102)
|
|
|
|
# Save location, ensure folder existence
|
|
to_fn = Path("resources/natura.tiff")
|
|
to_fn.parent.mkdir(parents=True, exist_ok=True)
|
|
|
|
url = "https://zenodo.org/record/3518215/files/natura.tiff"
|
|
|
|
logger.info(f"Downloading natura raster from '{url}'.")
|
|
progress_retrieve(url, to_fn)
|
|
|
|
logger.info(f"Natura raster available as '{to_fn}'.") |