Skip to main content

Mapchete xarray output driver

Project description

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


Example .mapchete file:

    min: 0
    max: 12
    format: xarray
    path: /some/output/path
    dtype: uint16
    bands: 3
    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


# 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


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.

Files for mapchete-xarray, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size mapchete_xarray-0.3-py3-none-any.whl (6.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size mapchete_xarray-0.3.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page