All Projects → bluegreen-labs → gee_subset

bluegreen-labs / gee_subset

Licence: AGPL-3.0 license
Google Earth Engine subset script & library

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to gee subset

parlitools
A collection of useful tools for UK politics
Stars: ✭ 22 (-48.84%)
Mutual labels:  data-retrieval
awesome-spectral-indices
A ready-to-use curated list of Spectral Indices for Remote Sensing applications.
Stars: ✭ 357 (+730.23%)
Mutual labels:  google-earth-engine
Geoweaver
a web system to allow users to automatically record history and manage complicated scientific workflows in web browsers involving the online spatial data facilities, high-performance computation platforms, and open-source libraries.
Stars: ✭ 32 (-25.58%)
Mutual labels:  google-earth-engine
CoastSat.slope
Beach-face slope estimation from satellite-derived shorelines, extension of the CoastSat toolbox.
Stars: ✭ 42 (-2.33%)
Mutual labels:  google-earth-engine
eemont
A python package that extends Google Earth Engine.
Stars: ✭ 290 (+574.42%)
Mutual labels:  google-earth-engine
GoogleEarthEngine-side-projects
Google Earth Engine side projects and tutorial scripts
Stars: ✭ 23 (-46.51%)
Mutual labels:  google-earth-engine
climate-data-science
Climate Data Science and Earth Observation with Python.
Stars: ✭ 103 (+139.53%)
Mutual labels:  google-earth-engine
geemap-apps
Interactive web apps created using geemap and streamlit
Stars: ✭ 24 (-44.19%)
Mutual labels:  google-earth-engine
tvgrabpyAPI
An xmltv-API for extracting and merging tv programme information from several sources
Stars: ✭ 25 (-41.86%)
Mutual labels:  data-retrieval
earthengine-apps
A collection of Earth Engine Apps created using geemap, voila, and heroku
Stars: ✭ 20 (-53.49%)
Mutual labels:  google-earth-engine
curso-gee
Google Earth Engine para el monitoreo del uso y cobertura del suelo de la República Argentina
Stars: ✭ 34 (-20.93%)
Mutual labels:  google-earth-engine
spectral
Awesome Spectral Indices for the Google Earth Engine JavaScript API (Code Editor).
Stars: ✭ 68 (+58.14%)
Mutual labels:  google-earth-engine
earthengine-py-examples
A collection of 300+ examples for using Earth Engine and the geemap Python package
Stars: ✭ 76 (+76.74%)
Mutual labels:  google-earth-engine
spyndex
Awesome Spectral Indices in Python.
Stars: ✭ 56 (+30.23%)
Mutual labels:  google-earth-engine
RivWidthCloudPaper
A Google Earth Engine based algorithm that extracts river centerlines and widths from satellite images
Stars: ✭ 62 (+44.19%)
Mutual labels:  google-earth-engine
awesome-earth-engine-apps
A collection of all public Google Earth Engine Apps.
Stars: ✭ 78 (+81.4%)
Mutual labels:  google-earth-engine
geeup
Simple CLI for Google Earth Engine Uploads
Stars: ✭ 67 (+55.81%)
Mutual labels:  google-earth-engine
ee extra
A ninja python package that unifies the Google Earth Engine ecosystem.
Stars: ✭ 42 (-2.33%)
Mutual labels:  google-earth-engine
covid19germany
R package - Load, visualise and analyse daily updated data on the COVID-19 outbreak in Germany
Stars: ✭ 47 (+9.3%)
Mutual labels:  data-retrieval

DOI

Google Earth Engine subset script & library

This is a small python script to subset GEE gridded data products into time series for a given location or list of locations. This script should make it easier to subset remote sensing time series for processing external to GEE. If this code made your life easier please refer to it using the Zenodo citation and DOI (see below / medallion) in any research papers.

Installation

Make sure you have a working Google Earth Engine python API setup. The installation instructions can be found on the GEE developer site.

After this you can either install by cloning the repository:

git clone https://github.com/khufkens/google_earth_engine_subsets.git

or, when integrating the script in other python code by using pypi:

pip install gee-subset

Use

command line

Below you find an example call to the scrip which downloads MODIS MYD09Q1 (-p, --product) reflectance data for bands 1 and 2 (-b, --band) for a number of sites as listed in selected_sites.csv and saves the results on the users desktop (-d, --directory).

./gee_subset.py -p "MODIS/MYD09Q1" \
                -b "sur_refl_b01" "sur_refl_b02" \
                -f "~/Desktop/selected_sites.csv" \
                -d "/Users/foo/Desktop/"
# prints output to console
./gee_subset.py -p "LANDSAT/LC08/C01/T1" \
                -b "B1" "B2" \
                -s "2015-01-01" \
                -e "2015-12-31" \
                -l 44.064665 -71.287575

Sites can be listed as a latitude longitude tuple using the -loc parameter, or by providing the before mentioned csv file (-f, --file parameter). Either one should be provided.

The csv file is a comma delimited file of the format:

site, latitude, longitude.

A padding value can be provided (-pd, --pad) so one can download a rectangular window of data padded x km in either direction around a particular location. This option is limited by the maximum pixels which GEE can export. For normal use (i.e. 1 to 2 km padding) this should not present a problem for most products.

General help can be queried by calling:

./gee_subset.py -h

python module

In addition the script can be loaded as a library in a python script module by calling:

import gee_subset

# or for the module itself
from gee_subset import gee_subset

The function is called gee_subset(). Consult the script for correct parameter naming conventions. Currently minimum error trapping is provided.

When using the python module remember that the module does not support lazy loading of dependencies. You will need the start your code with:

# load required modules
# these are required and the module
# will fail without them!
import os, re
import pandas as pd
from datetime import datetime
import ee
from gee_subset import gee_subset

# Initialize earth engine
ee.Initialize()

# your call (below a MODIS example)
df = gee_subset(product = "MODIS/MYD09Q1", bands = ["sur_refl_b01", "sur_refl_b02"], start_date = "2015-01-01", end_date = "2015-12-31", latitude = 44, longitude = -72, scale = 30)

print(df)

Data format

The output of the script is tidy data in which each row is an observation. Multiple observations can be returned in case a padding value is specified. Multiple bands can be called at once by providing multiple valid bands as an argument. Multiple bands will be returned as columns in the tidy data format. When datasets overlap, such as is the case of sidelapped tiles in Landsat 8 data multiple values are returned for a given location or date. In this case the id column will inform you on the source of the data.

Demo code

An example query, calling the python script from R, downloads two years (~100 data points) of Landsat 8 Tier 1 data for two bands (red, NIR) in ~8 seconds flat. Querying for a larger footprint (1x1 km footprint) only creates a small overhead (13 sec. query). The resulting figure for the point location with the derived NDVI values is shown below. The demo script to recreate this figure is included in the examples folder of the github repository.

References

Hufkens K. (2017) A Google Earth Engine time series subset script & library. DOI: 10.5281/zenodo.833789.

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].