EarthPy is makes it easier to plot and manipulate spatial data in Python.
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 takes advantage of functionality developed for raster data (rasterio) and vector data (geopandas) and simplifies the code needed to :
- Stack 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 (
- Plot rgb (color), color infrared and other 3 band combination images (
- Plot bands of a raster quickly using
- View histograms of sets of raster
- Create discrete (categorical) legends
- Crop raster bands to a study area
- Calculate vegetation indices such as Normalized Difference Vegetation Index (
EarthPy also has an io module that allows users to
- Quickly access pre-created datasubsets used in the earth-analytics courses hosted on www.earthdatascience.org
- Download other datasets that they may want to use in their workflows.
View Example EarthPy Applications in Our Documentation Gallery
Check out our vignette gallery for applied examples of using EarthPy in common spatial workflows.
To install, use
conda-forge. We encourage you to use
conda-forge if you are a conda users.
Install via Pip
To install EarthPy via
$ pip install --upgrade earthpy
Install Using Conda / conda-forge Channel
If you are working within an Anaconda environment, we suggest that you install EarthPy using
$ 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
Once you have successfully installed EarthPy, you can import it into Python.
>>> import earthpy as et
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()
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.
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.