Skip to main content

An GRASS backend for Xarray.

Project description

xarray-grass

PyPI - Version PyPI - Downloads tests

A GRASS backend for Xarray. Explore all your GRASS rasters with Xarray.

Installation and usage

Install the package using uv or pip:

uv add xarray-grass

>>> import xarray as xr
>>> test_ds = xr.open_dataset("/home/lc/grassdata/nc_spm_08_grass7/PERMANENT/", raster=["boundary_county_500m", "elevation"])
>>> test_ds
<xarray.Dataset> Size: 244kB
Dimensions:               (y: 150, x: 135)
Coordinates:
  * y                     (y) float32 600B 2.2e+05 2.2e+05 ... 2.207e+05
  * x                     (x) float32 540B 6.383e+05 6.383e+05 ... 6.39e+05
Data variables:
    boundary_county_500m  (y, x) float64 162kB ...
    elevation             (y, x) float32 81kB ...
Attributes:
    crs_proj:  +proj=lcc +lat_0=33.75 +lon_0=-79 +lat_1=36.1666666666667 +lat...
    crs_wkt:   PROJCRS["NAD83(HARN) / North Carolina",BASEGEOGCRS["NAD83(HARN...

You can choose which map you want to load with the raster, raster_3d, strds and str3ds parameters to open_dataset. Those accept either a single string or an iterable.

If run from outside a GRASS session, the tool will automatically create a session in the requested project and mapset. If run from within GRASS, only maps from accessible mapsets could be loaded. In GRASS, you can list the accessible mapsets with g.mapsets.

Roadmap

Version 1.0 goal

  • Load a single raster map
  • Load a single Space-time Raster Dataset (strds)
  • Load a single raster_3d map
  • Load a single str3ds
  • Load a combination of all the above
  • Load a full mapset
  • Support for the drop_variables parameter
  • Lazy loading of all raster types
  • Write from xarray to GRASS

Stretch goals

  • Load a full GRASS project (ex location)

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

xarray_grass-0.1.0.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xarray_grass-0.1.0-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file xarray_grass-0.1.0.tar.gz.

File metadata

  • Download URL: xarray_grass-0.1.0.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for xarray_grass-0.1.0.tar.gz
Algorithm Hash digest
SHA256 723435439ae5a629f38ca1829ac1ba291fd5a2d827f81362cc475dd15ee0c205
MD5 626263ef5fdc233cfbd13ef4661f35e6
BLAKE2b-256 b7b977379cba9d84424e01a7dd6649a902f0942dcad2cc000bf67cbc0b069315

See more details on using hashes here.

File details

Details for the file xarray_grass-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xarray_grass-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for xarray_grass-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a4399014ee44f2a79cbdd5d8969c514c4adfcbf71514d7e4670bbc679d1b48d
MD5 3c5836a58f1437f423d731bb7048bded
BLAKE2b-256 719fc458767e3c49161e378d90105d8a66c9c5bf29b9195ad8b5a8ef18fef91d

See more details on using hashes here.

Supported by

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