Skip to main content

lizard-raster-reducer

Introduction

Lizard raster reducer is a tool to auto-generate regional reports from Lizard data. It “reduces” raster data to aggregate statistics for multiple regions. Lizard API endpoints are used to retrieve data. The main ones are search, rasters, regions and raster-aggregates. To prevent API overload, the tool creates and fills a ‘lizard_cache’ folder by default.

Multiple rasters can be specified. The first raster will act as the scope raster. The scope raster determines the spatial extent and temporal behaviour of the result. Rasters can be temporal or static. Rasters can contain continuous values or discrete classes. Regions of one region type are used for the result. Regions within the spatial extent of the scope raster are used in the result. A configuration file is used to customize the output.

The results are aggregate numbers of data per region. When the data type is interval or ratio, the average of the region is returned. When data are classes, the area fraction per class are returned. The output format can be specified to be CSV, JSON or HTML.

Installation

We can be installed with:

$ pip install lizard-raster-reducer

Usage (iPython notebook example)

This example notebook (link) exemplifies how the Lizard raster reducer can be used.

Usage (command line example)

Create .yml configuration files from templates:

$ run-lizard-raster-reducer
  1. Specify reducer options in reducer_options.yml.

  2. Specify Lizard credentials in credentials.yml

  3. Review optional arguments to pass: run-lizard-raster-reducer -h

  4. Run the code: run-lizard-raster-reducer

  5. Find result(s) in local sub-folder /reducer_results

Development installation of this project itself

We’re installed with pipenv, a handy wrapper around pip and virtualenv. Install that first with pip install pipenv. Then run:

$ PIPENV_VENV_IN_PROJECT=1 pipenv --three
$ pipenv install --dev

There will be a script you can run like this:

$ pipenv run run-lizard-raster-reducer

It runs the main() function in lizard-raster-reducer/scripts.py, adjust that if necessary. The script is configured in setup.py (see entry_points).

In order to get nicely formatted python files without having to spend manual work on it, run the following command periodically:

$ pipenv run black lizard_raster_reducer

Run the tests regularly. This also checks with pyflakes, black and it reports coverage. Pure luxury:

$ pipenv run pytest

The tests are also run automatically on travis-ci, you’ll see it in the pull requests. There’s also coverage reporting on coveralls.io (once it has been set up).

If you need a new dependency (like requests), add it in setup.py in install_requires. Afterwards, run install again to actually install your dependency:

$ pipenv install --dev

Changelog of lizard-raster-reducer

0.6 (2019-04-30)

  • Options for hectares (besides fraction) and temporal range (besides last timesteps)

0.5 (2019-04-11)

  • Improved readme

0.4 (2019-04-08)

  • Notebook example to demonstrate usage

0.3 (2019-04-08)

  • Functionality to set regional alarms.

0.2 (2019-03-27)

  • First deploy to pypi.org.

0.1 (2019-03-27)

Release files for lizard-raster-reducer 0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lizard-raster-reducer 0.6
File Size Uploaded
lizard-raster-reducer-0.6.tar.gz 15.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lizard-raster-reducer 0.6
File Interpreter ABI Platform
lizard_raster_reducer-0.6-py3-none-any.whl Python 3 none any Details

Total release size: 37.4 kB

Release files / lizard-raster-reducer-0.6.tar.gz

Download URL lizard-raster-reducer-0.6.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a9dc6e33af6a2191b6fb939995db8719b3fdd86b64d624d3f8a84b013f450911
BLAKE2b-256 checksum
How to use checksums
50979bfe8f8514c345487f295b2085703c1b7aee43866145e2e45860e66500ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

Release files / lizard_raster_reducer-0.6-py3-none-any.whl

Download URL lizard_raster_reducer-0.6-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2803c3e3b5503f756899d1add4e4205c442fe1c8300c07fe93a0b9d4332803a2
BLAKE2b-256 checksum
How to use checksums
1b60ec35b7d39c9a1d454e16c00ef91bb2d9a215a6a7b1766685d48b0ae9f79d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

0.6 This release

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page