Giter VIP home page Giter VIP logo

xarray-spatial's Introduction

pypi pytest codecov PyPI version Downloads License


History of OS GIS Timeline


title

๐Ÿ“ Fast, Accurate Python library for Raster Operations

โšก Extensible with Numba

โฉ Scalable with Dask

๐ŸŽŠ Free of GDAL / GEOS Dependencies

๐ŸŒ General-Purpose Spatial Processing, Geared Towards GIS Professionals


Xarray-Spatial implements common raster analysis functions using Numba and provides an easy-to-install, easy-to-extend codebase for raster analysis.

Installation

# via pip
pip install xarray-spatial

# via conda
conda install -c conda-forge xarray-spatial

Downloading our starter examples and data

Once you have xarray-spatial installed in your environment, you can use one of the following in your terminal (with the environment active) to download our examples and/or sample data into your local directory.

xrspatial examples : Download the examples notebooks and the data used.

xrspatial copy-examples : Download the examples notebooks but not the data. Note: you won't be able to run many of the examples.

xrspatial fetch-data : Download just the data and not the notebooks.

In all the above, the command will download and store the files into your current directory inside a folder named 'xrspatial-examples'.

xarray-spatial grew out of the Datashader project, which provides fast rasterization of vector data (points, lines, polygons, meshes, and rasters) for use with xarray-spatial.

xarray-spatial does not depend on GDAL / GEOS, which makes it fully extensible in Python but does limit the breadth of operations that can be covered. xarray-spatial is meant to include the core raster-analysis functions needed for GIS developers / analysts, implemented independently of the non-Python geo stack.

Our documentation is still under construction, but docs can be found here.

Raster-huh?

Rasters are regularly gridded datasets like GeoTIFFs, JPGs, and PNGs.

In the GIS world, rasters are used for representing continuous phenomena (e.g. elevation, rainfall, distance), either directly as numerical values, or as RGB images created for humans to view. Rasters typically have two spatial dimensions, but may have any number of other dimensions (time, type of measurement, etc.)

Supported Spatial Functions with Supported Inputs


Classification

Name NumPy xr.DataArray Dask xr.DataArray CuPy GPU xr.DataArray Dask GPU xr.DataArray
Equal Interval โœ…๏ธ โœ… โœ… ๏ธ
Natural Breaks โœ…๏ธ ๏ธ
Reclassify โœ…๏ธ โœ… โœ… โœ…
Quantile โœ…๏ธ โœ… โœ… ๏ธ

Focal

Name NumPy xr.DataArray Dask xr.DataArray CuPy GPU xr.DataArray Dask GPU xr.DataArray
Apply โœ…๏ธ โœ…๏ธ
Hotspots โœ…๏ธ โœ…๏ธ โœ…๏ธ
Mean โœ…๏ธ โœ…๏ธ โœ…๏ธ
Focal Statistics โœ…๏ธ โœ…๏ธ โœ…๏ธ

Multispectral

Name NumPy xr.DataArray Dask xr.DataArray CuPy GPU xr.DataArray Dask GPU xr.DataArray
Atmospherically Resistant Vegetation Index (ARVI) โœ…๏ธ โœ…๏ธ โœ…๏ธ โœ…๏ธ
Enhanced Built-Up and Bareness Index (EBBI) โœ…๏ธ โœ…๏ธ โœ…๏ธ โœ…๏ธ
Enhanced Vegetation Index (EVI) โœ…๏ธ โœ…๏ธ โœ…๏ธ โœ…๏ธ
Green Chlorophyll Index (GCI) โœ…๏ธ โœ…๏ธ โœ…๏ธ โœ…๏ธ
Normalized Burn Ratio (NBR) โœ…๏ธ โœ…๏ธ โœ…๏ธ โœ…๏ธ
Normalized Burn Ratio 2 (NBR2) โœ…๏ธ โœ…๏ธ โœ…๏ธ โœ…๏ธ
Normalized Difference Moisture Index (NDMI) โœ…๏ธ โœ…๏ธ โœ…๏ธ โœ…๏ธ
Normalized Difference Vegetation Index (NDVI) โœ…๏ธ โœ…๏ธ โœ…๏ธ โœ…๏ธ
Soil Adjusted Vegetation Index (SAVI) โœ…๏ธ โœ…๏ธ โœ…๏ธ โœ…๏ธ
Structure Insensitive Pigment Index (SIPI) โœ…๏ธ โœ…๏ธ โœ…๏ธ โœ…๏ธ
True Color โœ…๏ธ ๏ธ โœ…๏ธ ๏ธ

Pathfinding

Name NumPy xr.DataArray Dask xr.DataArray CuPy GPU xr.DataArray Dask GPU xr.DataArray
A* Pathfinding โœ…๏ธ

Proximity

Name NumPy xr.DataArray Dask xr.DataArray CuPy GPU xr.DataArray Dask GPU xr.DataArray
Allocation โœ…๏ธ โœ…
Direction โœ…๏ธ โœ…
Proximity โœ…๏ธ โœ…

Raster to vector

Name NumPy xr.DataArray Dask xr.DataArray CuPy GPU xr.DataArray Dask GPU xr.DataArray
Polygonize โœ…๏ธ

Surface

Name NumPy xr.DataArray Dask xr.DataArray CuPy GPU xr.DataArray Dask GPU xr.DataArray
Aspect โœ…๏ธ โœ…๏ธ โœ…๏ธ โš ๏ธ
Curvature โœ…๏ธ โš ๏ธ
Hillshade โœ…๏ธ โœ…๏ธ
Slope โœ…๏ธ โœ…๏ธ โœ…๏ธ โš ๏ธ
Terrain Generation โœ…๏ธ โœ…๏ธ โœ…๏ธ
Viewshed โœ…๏ธ
Perlin Noise โœ…๏ธ โœ…๏ธ โœ…๏ธ
Bump Mapping โœ…๏ธ

Zonal

Name NumPy xr.DataArray Dask xr.DataArray CuPy GPU xr.DataArray Dask GPU xr.DataArray
Apply โœ…๏ธ โœ…๏ธ
Crop โœ…๏ธ
Regions
Trim โœ…๏ธ
Zonal Statistics โœ…๏ธ โœ…๏ธ
Zonal Cross Tabulate โœ…๏ธ โœ…๏ธ

Local

Name NumPy xr.DataArray Dask xr.DataArray CuPy GPU xr.DataArray Dask GPU xr.DataArray
Cell Stats โœ…๏ธ
Combine โœ…๏ธ
Lesser Frequency โœ…๏ธ
Equal Frequency โœ…๏ธ
Greater Frequency โœ…๏ธ
Lowest Position โœ…๏ธ
Highest Position โœ…๏ธ
Popularity โœ…๏ธ
Rank โœ…๏ธ

Usage

Basic Pattern
import xarray as xr
from xrspatial import hillshade

my_dataarray = xr.DataArray(...)
hillshaded_dataarray = hillshade(my_dataarray)

Check out the user guide here.


title title

Dependencies

xarray-spatial currently depends on Datashader, but will soon be updated to depend only on xarray and numba, while still being able to make use of Datashader output when available.

title

Notes on GDAL

Within the Python ecosystem, many geospatial libraries interface with the GDAL C++ library for raster and vector input, output, and analysis (e.g. rasterio, rasterstats, geopandas). GDAL is robust, performant, and has decades of great work behind it. For years, off-loading expensive computations to the C/C++ level in this way has been a key performance strategy for Python libraries (obviously...Python itself is implemented in C!).

However, wrapping GDAL has a few drawbacks for Python developers and data scientists:

  • GDAL can be a pain to build / install.
  • GDAL is hard for Python developers/analysts to extend, because it requires understanding multiple languages.
  • GDAL's data structures are defined at the C/C++ level, which constrains how they can be accessed from Python.

With the introduction of projects like Numba, Python gained new ways to provide high-performance code directly in Python, without depending on or being constrained by separate C/C++ extensions. xarray-spatial implements algorithms using Numba and Dask, making all of its source code available as pure Python without any "black box" barriers that obscure what is going on and prevent full optimization. Projects can make use of the functionality provided by xarray-spatial where available, while still using GDAL where required for other tasks.

Contributors

  • @brendancol
  • @thuydotm
  • @jbednar
  • @pablomakepath
  • @kristinepetrosyan
  • @sjsrey
  • @giancastro
  • @ocefpaf
  • @rsignell-usgs
  • @marcozimmermannpm
  • @jthetzel
  • @chase-dwelle
  • @SAN154
  • @SapirLastimoza-Dooley
  • @lex-c

Cite our code:

makepath/xarray-spatial, https://github.com/makepath/xarray-spatial, ยฉ2020-2022.

xarray-spatial's People

Contributors

brendancol avatar thuydotm avatar giancastro avatar ianthomas23 avatar calexat-123 avatar kristinepetrosyan avatar a7az0th avatar marcozimmermannpm avatar sapirlastimoza-dooley avatar chase-dwelle avatar jbednar avatar nodell111 avatar kiliakis avatar ocefpaf avatar mkeenan195 avatar g2giovanni avatar akupitz avatar tcmetzger avatar sjsrey avatar snullo avatar richardscottoz avatar jthetzel avatar jam-lock avatar drnextgis avatar danielavrella avatar dahnj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.