API Reference

This page contains auto-generated documentation for wxee modules and classes.

Initialization

All automated requests to Earth Engine, such as those made by wxee should be made using the high-volume Earth Engine endpoint. This can be done by specifying the high-volume endpoint using ee.Initialize or by using the wxee.Initialize shortcut.

Initialize(**kwargs)

Initialize Earth Engine using the high-volume endpoint designed for automated requests.

Earth Engine Classes

Base Earth Engine classes have additional functionality available through the wx accessor. These methods are also accessible to TimeSeries and Climatology objects, and are the primary interface for exporting and downloading Earth Engine data in wxee.

The wx Accessor

To use methods extended by wxee, just import the package and use the wx accessor.

import ee
import wxee

ee.Image("MODIS/006/MOD13Q1/2000_02_18").wx.to_xarray()

ee.Image

Image.to_xarray([path, region, scale, crs, ...])

Convert an image to an xarray.Dataset.

Image.to_tif([out_dir, description, region, ...])

Download an image to geoTIFF.

ee.ImageCollection

ImageCollection.to_xarray([path, region, ...])

Convert an image collection to an xarray.Dataset.

ImageCollection.to_tif([out_dir, prefix, ...])

Download all images in the collection to geoTIFF.

ImageCollection.to_time_series()

Convert to a wxee.TimeSeries collection with associated methods.

ImageCollection.get_image(index)

Return the image at the specified index in the collection.

ImageCollection.last()

Return the last image in the collection.

xarray Classes

The wxee package adds a few helpful methods to xarray classes through the same wx accessor used by Earth Engine Classes. To use them, just import the package and use the wx accessor.

xarray.Dataset

DatasetAccessor.rgb([bands, stretch, ...])

Generate an RGB color composite plot of the Dataset.

xarray.DataArray

DataArrayAccessor.normalize([stretch])

Normalize a Dataset's values between 0 and 1.

Time Series

Time series are image collections with added functionality for processing in the time dimension.

Note

A TimeSeries can be converted to xarray and tif using the wx accessor, just like an ee.ImageCollection.

Creating a Time Series

Time series can be instantiated in two ways:

From an ID

import ee
import wxee

ts = wxee.TimeSeries("IDAHO_EPSCOR/GRIDMET")

From a Collection

See ImageCollection.to_time_series().

import ee
import wxee

col = ee.ImageCollection("IDAHO_EPSCOR/GRIDMET")
ts = col.wx.to_time_series()

Describing a Time Series

There are a number of properties and methods that describe the characteristics of a time series.

TimeSeries.start_time

The system:time_start of first chronological image in the collection.

TimeSeries.end_time

The system:time_start of last chronological image in the collection.

TimeSeries.interval([unit])

Compute the mean time interval between images in the time series.

TimeSeries.describe([unit])

Generate and print descriptive statistics about the Time Series such as the ID, start and end dates, and time between images.

TimeSeries.timeline()

Generate an interactive plot showing the acquisition time of each image in the time series.

TimeSeries.dataframe([props])

Generate a Pandas dataframe describing properties of each image in the time series.

Modifying a Time Series

Processing can be applied in the time dimension to modify a time series or create new time series.

TimeSeries.aggregate_time(frequency[, ...])

Aggregate the collection over the time dimension to a specified frequency.

TimeSeries.interpolate_time(time[, method])

Use interpolation to synthesize data at a given time within the time series.

TimeSeries.rolling_time(window, unit[, ...])

Apply a rolling reducer over the time dimension.

TimeSeries.fill_gaps(window, unit[, align, ...])

Apply gap-filling using a moving window reducer through time.

TimeSeries.insert_image(img)

Insert an image into the time series and sort it by system:time_start.

Calculating Climatologies

Time series of weather data can be transformed into climatologies.

TimeSeries.climatology_mean(frequency[, ...])

Calculate a mean climatology image collection with a given frequency.

TimeSeries.climatology_std(frequency[, ...])

Calculate a standard deviation climatology image collection with a given frequency.

TimeSeries.climatology_anomaly(mean[, std, ...])

Calculate climatological anomalies for the time series.

Climatology

Climatologies are image collections where images represent long-term climatological normals at specific time steps.

Creating a Climatology

Climatologies are created using TimeSeries.climatology_mean() or TimeSeries.climatology_std().

Warning

The Climatology class should never be instantiated directly.

import ee
import wxee

ts = wxee.TimeSeries("IDAHO_EPSCOR/GRIDMET").select("pr")
monthly_mean_rainfall = ts.climatology_mean("month", reducer=ee.Reducer.sum())

Note

The reducer argument defines how the raw data will be aggregated before calculating the climatological mean. In this case, we use ee.Reducer.sum() to aggregate the daily rainfall measurements into monthly totals. If the data were already monthly, the reducer would have no effect.

Describing a Climatology

In addition to having all the methods extended with the wx accessor, there are methods for describing the characteristics of a climatology.

Climatology.describe()

Generate and print descriptive statistics about the Climatology such as the ID, number of images, and frequency.