All Projects → KMarkert → cartoee

KMarkert / cartoee

Licence: GPL-3.0 license
Publication quality maps using Earth Engine and Cartopy

Programming Languages

python
139335 projects - #7 most used programming language
TeX
3793 projects

Projects that are alternatives of or similar to cartoee

live-graph
Simple live graph with Flask and SocketIO
Stars: ✭ 17 (-55.26%)
Mutual labels:  plot
svg plot
Plot data in SVG format using C++ (header only) library .
Stars: ✭ 20 (-47.37%)
Mutual labels:  plot
spyndex
Awesome Spectral Indices in Python.
Stars: ✭ 56 (+47.37%)
Mutual labels:  earth-engine
pgfplots
pgfplots - A TeX package to draw normal and/or logarithmic plots directly in TeX in two and three dimensions with a user-friendly interface and pgfplotstable - a TeX package to round and format numerical tables. Examples in manuals and/or on web site.
Stars: ✭ 119 (+213.16%)
Mutual labels:  plot
mltb
Machine Learning Tool Box
Stars: ✭ 25 (-34.21%)
Mutual labels:  plot
terminalplot
No description or website provided.
Stars: ✭ 40 (+5.26%)
Mutual labels:  plot
region-plot
A tool to plot significant regions of GWAS
Stars: ✭ 20 (-47.37%)
Mutual labels:  plot
ggquiver
R package for quiver plots in 'ggplot2'
Stars: ✭ 38 (+0%)
Mutual labels:  plot
PHPlot
A PHP graph library for dynamic scientific, business, and stock-market charts and graphs.
Stars: ✭ 29 (-23.68%)
Mutual labels:  plot
ofxHistoryPlot
Visualize value history on a configurable graph
Stars: ✭ 40 (+5.26%)
Mutual labels:  plot
ee extra
A ninja python package that unifies the Google Earth Engine ecosystem.
Stars: ✭ 42 (+10.53%)
Mutual labels:  earth-engine
SerialTest
Serial port test tool on Win/Linux/Android, with realtime plotting, shortcut | 跨平台串口助手,带实时绘图和快捷发送面板
Stars: ✭ 98 (+157.89%)
Mutual labels:  plot
quickhist
quickly plot a histogram on the CLI
Stars: ✭ 45 (+18.42%)
Mutual labels:  plot
SwiftCharts
Easy to use and highly customizable charts library for iOS
Stars: ✭ 2,405 (+6228.95%)
Mutual labels:  plot
KiBot
KiCad automation utility
Stars: ✭ 203 (+434.21%)
Mutual labels:  plot
smag
Show Me A Graph - Command Line Graphing
Stars: ✭ 78 (+105.26%)
Mutual labels:  plot
awesome-earth-engine-apps
A collection of all public Google Earth Engine Apps.
Stars: ✭ 78 (+105.26%)
Mutual labels:  earth-engine
reddit-hot-recorder
Records the activity (comments and karma) on the hot page of a Reddit sub and prepare an animated data visualisation.
Stars: ✭ 89 (+134.21%)
Mutual labels:  plot
earthengine-py-examples
A collection of 300+ examples for using Earth Engine and the geemap Python package
Stars: ✭ 76 (+100%)
Mutual labels:  earth-engine
plotly-plot
Polymer element for the plotly.js library
Stars: ✭ 21 (-44.74%)
Mutual labels:  plot

cartoee

PyPI version Build Status Documentation Status DOI License: GPL v3 status

Publication quality maps using Earth Engine and Cartopy! alt-text

Installation

cartoee is available to install via pip. To install the package, you can use pip install for your Python environment:

pip install cartoee

Or, you can install the package manually from source code using the following commands:

git clone https://github.com/kmarkert/cartoee.git
cd cartoee
python setup.py install

Please see the documentation for instructions on installing dependencies.

Working with cartoee

cartoee aims to do only one thing well: getting processing results from Earth Engine into a publication quality mapping interface. cartoee simply gets results from Earth Engine and plots it with the correct geographic projections leaving ee and cartopy to do more of the processing and visualization.

A simple case

Here is what a simple workflow looks like to visualize SRTM data on a map:

import cartoee as cee
import ee

ee.Initialize()

# get an earth engine image
srtm = ee.Image("CGIAR/SRTM90_V4")

# plot the result using cartoee
ax = cee.getMap(srtm,region=[-180,-90,180,90],visParams={'min':0,'max':3000})

ax.coastlines()
plt.show()

alt-text

Now that we have our EE image as a cartopy/matplotlib object, we can start styling our plot for the publication using the cartopy API.

import cartopy.crs as ccrs
from cartopy.mpl.gridliner import LATITUDE_FORMATTER, LONGITUDE_FORMATTER

# set gridlines and spacing
xticks = [-180,-120,-60,0,60,120,180]
yticks = [-90,-60,-30,0,30,60,90]
ax.gridlines(xlocs=xticks, ylocs=yticks,linestyle='--')

# set custom formatting for the tick labels
ax.xaxis.set_major_formatter(LONGITUDE_FORMATTER)
ax.yaxis.set_major_formatter(LATITUDE_FORMATTER)

# set tick labels
ax.set_xticks([-180,-120,-60, 0, 60, 120, 180], crs=ccrs.PlateCarree())
ax.set_yticks([-90, -60, -30, 0, 30, 60, 90], crs=ccrs.PlateCarree())

alt-text

Doing more...

Now that we have a grasp on a simple example, we can use Earth Engine to to some processing and make a pretty map.

# function to add NDVI band to imagery
def calc_ndvi(img):
    ndvi = img.normalizedDifference(['Nadir_Reflectance_Band2','Nadir_Reflectance_Band1'])
    return img.addBands(ndvi.rename('ndvi'))

# MODIS Nadir BRDF-Adjusted Reflectance with NDVI band
modis = ee.ImageCollection('MODIS/006/MCD43A4')\
        .filterDate('2010-01-01','2016-01-01')\
        .map(calc_ndvi)

# get the cartopy map with EE results
ax = cee.getMap(modis.mean(),cmap='YlGn'
    visParams={'min':-0.5,'max':0.85,'bands':'ndvi',},
    region=[-180,-90,180,90])

ax.coastlines()

cb = cee.addColorbar(ax,loc='right',cmap='YlGn',visParams={'min':0,'max':1,'bands':'ndvi'})

alt-text

You can see from the example that we calculated NDVI on MODIS imagery from 2010-2015 and created a global map with the mean value per pixel.

What if we want to make multiple maps with some different projections? We can do that by creating our figure and supplying the axes to plot on.

# get land mass feature collection
land = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017')

# get seasonal averages and clip to land features
djf = modis.filter(ee.Filter.calendarRange(12,3,'month')).mean().clip(land)
mam = modis.filter(ee.Filter.calendarRange(3,6,'month')).mean().clip(land)
jja = modis.filter(ee.Filter.calendarRange(6,9,'month')).mean().clip(land)
son = modis.filter(ee.Filter.calendarRange(9,12,'month')).mean().clip(land)

fig,ax = plt.subplots(ncols=2,nrows=2,subplot_kw={'projection': ccrs.Orthographic(-80,35)})

imgs = np.array([[djf,mam],[jja,son]])
titles = np.array([['DJF','MAM'],['JJA','SON']])

for i in range(len(imgs)):
    for j in range(len(imgs[i])):
        ax[i,j] = cee.addLayer(imgs[i,j],ax=ax[i,j],
                               region=bbox,dims=500,
                               visParams=ndviVis,cmap='YlGn'
                              )
        ax[i,j].coastlines()
        ax[i,j].gridlines(linestyle='--')
        ax[i,j].set_title(titles[i,j])

cax = fig.add_axes([0.9, 0.2, 0.02, 0.6])
cb = cee.addColorbar(ax[i,j],cax=cax,cmap='YlGn',visParams=ndviVis)

alt-text

To see more examples, go to the documentation at https://cartoee.readthedocs.io!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].