A set of helper functions to make working with spatial data in open source tools easier. This package is maintained by Earth Lab and was originally designed to support the earth analytics education program.
Project description
EarthPy
EarthPy makes it easier to plot and manipulate spatial data in Python.
Why EarthPy?
Python is a generic programming language designed to support many different applications. Because of this, many commonly performed spatial tasks for science including plotting and working with spatial data take many steps of code. EarthPy builds upon the functionality developed for raster data (rasterio) and vector data (geopandas) in Python and simplifies the code needed to:
- Stack and crop raster bands from data such as Landsat into an easy to use numpy array
- Work with masks to set bad pixels such a those covered by clouds and cloud-shadows to NA (
mask_pixels()
) - Plot rgb (color), color infrared and other 3 band combination images (
plot_rgb()
) - Plot bands of a raster quickly using
plot_bands()
- Plot histograms for a set of raster files.
- Create discrete (categorical) legends
- Calculate vegetation indices such as Normalized Difference Vegetation Index (
normalized_diff()
) - Create hillshade from a DEM
EarthPy also has an io
module that allows users to
- Quickly access pre-created data subsets used in the earth-analytics courses hosted on www.earthdatascience.org
- Download other datasets that they may want to use in their workflows.
EarthPy's design was inspired by the raster
and sp
package functionality available to R
users.
View Example EarthPy Applications in Our Documentation Gallery
Check out our vignette gallery for applied examples of using EarthPy in common spatial workflows.
Install
EarthPy can be installed using pip
, but we strongly recommend that you install it using conda and the conda-forge
channel.
Install Using Conda / conda-forge Channel (Preferred)
If you are working within an Anaconda environment, we suggest that you install EarthPy using
conda-forge
$ conda install -c conda-forge earthpy
Note: if you want to set conda-forge as your default conda channel, you can use the following install workflow. We recommmend this approach. Once you have run conda config, you can install earthpy without specifying a channel.
$ conda config --add channels conda-forge
$ conda install earthpy
Install via Pip
We strongly suggest that you install EarthPy using conda-forge given pip can be more prone to spatial library dependency conflicts. However, you can install earthpy using pip.
To install EarthPy via pip
use:
$ pip install --upgrade earthpy
Once you have successfully installed EarthPy, you can import it into Python.
>>> import earthpy.plot as ep
Below is a quick example of plotting multiple bands in a numpy array format.
>>> arr = np.random.randint(4, size=(3, 5, 5))
>>> ep.plot_bands(arr, titles=["Band 1", "Band 2", "Band 3"])
>>> plt.show()
Active Maintainers
We welcome contributions to EarthPy. Below are the current active package maintainers. Please see our contributors file for a complete list of all of our contributors.
Contributors
We've welcome any and all contributions. Below are some of the contributors to EarthPy. We are currently trying to update this list!!
How to Contribute
We welcome contributions to EarthPy! Please be sure to check out our contributing guidelines for more information about submitting pull requests or changes to EarthPy.
License & Citation
Citation Information
When citing EarthPy, please cite our JOSS paper:
@article{Wasser2019EarthPy,
journal = {Journal of Open Source Software},
doi = {10.21105/joss.01886},
issn = {2475-9066},
number = {43},
publisher = {The Open Journal},
title = {EarthPy: A Python package that makes it easier to explore and plot raster and vector data using open source Python tools.},
url = {https://doi.org/10.21105/joss.01886},
volume = {4},
author = {Wasser, Leah and Joseph, Maxwell and McGlinchy, Joe and Palomino, Jenny and Korinek, Nathan and Holdgraf, Chris and Head, Tim},
pages = {1886},
date = {2019-11-13},
year = {2019},
month = {11},
day = {13},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file earthpy-0.9.4.tar.gz
.
File metadata
- Download URL: earthpy-0.9.4.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16ec2831ec87ace9d70473ef23840b6bf3cd239e178b9ddb5767da86e5a34c1b |
|
MD5 | a985e74bc0b3825bbea01c8fbebb6720 |
|
BLAKE2b-256 | 21a7ce7c931ca9e1732bcd7c1f0d4001914fcb888228180d47e5480db1ae7161 |
File details
Details for the file earthpy-0.9.4-py3-none-any.whl
.
File metadata
- Download URL: earthpy-0.9.4-py3-none-any.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a8dfa81b97b42dd62ed5452e2b4b633fbe51d03bf12f975f9bf6e130876bb56 |
|
MD5 | cfd3cde8619fd630da3a9823df3f7560 |
|
BLAKE2b-256 | a77298c78371de0ffd281d89f7da85bb2001aa6ce9820fabbfd2adfee99e1935 |