Skip to main content

Mapchete xarray output driver

Project description

This driver enables mapchete to write multidimensional arrays into a tile directory structure.

https://badge.fury.io/py/mapchete_xarray.svg https://travis-ci.org/ungarj/mapchete_xarray.svg?branch=master https://coveralls.io/repos/github/ungarj/mapchete_xarray/badge.svg?branch=master https://img.shields.io/pypi/pyversions/mapchete_xarray.svg

Usage

Example .mapchete file:

process: process.py
zoom_levels:
    min: 0
    max: 12
input:
output:
    format: xarray
    path: /some/output/path
    dtype: uint16
    bands: 3
pyramid:
    grid: geodetic
    metatiling: 2

Example process file:

from dateutil import parser
import numpy as np
import xarray as xr


def execute(mp, stack_height=10):
    # create 4D arrays with current tile shape and dtype
    arrs = [
        np.ones((3, ) + mp.tile.shape, dtype="uint16")
        for _ in range(1, stack_height)
    ]

    # create timestamps for each array
    timestamps = [parser.parse("2018-04-0%s" % i) for i in range(1, stack_height)]

    # build xarray with time axis
    timeseries = xr.DataArray(
        np.stack(arrs), coords={'time': timestamps}, dims=('time', 'bands', 'x', 'y')
    )

    # return to write
    return timeseries

Installation

# install using pip:
pip install mapchete_xarray
# verify driver is vailable ('xarray' should be listed as output format):
mapchete formats

Current Limitations

  • no reprojection allowed

  • when reading from existing output, process metatiling must be smaller than xarray output metatiling

  • only writing to NetCDF files currently implemented

License

MIT License

Copyright (c) 2019 EOX IT Services

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mapchete_xarray-0.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

mapchete_xarray-0.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file mapchete_xarray-0.2.tar.gz.

File metadata

  • Download URL: mapchete_xarray-0.2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

File hashes

Hashes for mapchete_xarray-0.2.tar.gz
Algorithm Hash digest
SHA256 616ff6404d8fd3f176a6bd39fb1ddd93d2f2c038d5f51525418c1f3b3e1e1c29
MD5 05505291e751c910b442d8b0edcf8fb7
BLAKE2b-256 6bc4492c532fa01834e428f4af5e04602bef44a90cae94d927d491663d3b0814

See more details on using hashes here.

File details

Details for the file mapchete_xarray-0.2-py3-none-any.whl.

File metadata

  • Download URL: mapchete_xarray-0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

File hashes

Hashes for mapchete_xarray-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 94a2073f0135fae00135e2a31588307400973a60dfef4c699b4e0853b3f0f347
MD5 faddf3326f2caa9886ef36b2d56cdec5
BLAKE2b-256 e40ace82ec87404b5043402bab9598b3cc1d6c2f818499cfe90af32333d50a68

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page