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.2.0.tar.gz (20.9 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.2.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xarray_grass-0.2.0.tar.gz
  • Upload date:
  • Size: 20.9 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.2.0.tar.gz
Algorithm Hash digest
SHA256 4baa8a09b1311078570bb4b99c07c1feec3b0d14f2a9477d332df66f0337c549
MD5 1e8318ac6c189a76b4f39fc005ac77f9
BLAKE2b-256 6cc35b4df8d57515783df68bd7c2509040184be8eeba055d3307fefa8d815e8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xarray_grass-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d3057463b1250f893b240622f72af06fa0a9105eb7fc2a5069444e8ef7428472
MD5 f879a189406309f87d42188adcb0610b
BLAKE2b-256 0ffaaa2565929c3738b6f34bd47085ff0da2d27813a6f67ac22a21d717a61f47

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