Skip to content

appeears

This module contains functionality to download and load MODIS land products subsets from AppEEARS

See https://appeears.earthdatacloud.nasa.gov/

Credentials are read from ~/.config/springtime/appeears.json. JSON file should look like {"username": "foo", "password": "bar"}.

Appeears

Bases: Dataset

Download and load MODIS data using AppEEARS.

Attributes:

Name Type Description
years

timerange. For example years=[2000, 2002] downloads data for three years.

resample Optional[ResampleConfig]

Resample the dataset to a different time resolution. If None, no resampling.

product str

An AppEEARSp product name. Use products() to get a list of currently available in AppEEARS.

version str

An AppEEARS product version.

layers list[str]

Layers of a AppEEARS product. Use layers(product) to get list of available layers for a product.

area NamedArea | None

A dictionary of the form {"name": "yourname", "bbox": [xmin, ymin, xmax, ymax]}.

points Points | None

List of points as [[longitude, latitude], ...], in WGS84 projection.

infer_date_offset bool

for yearly variables given as day of year, transform value to day of year.

resample Optional[ResampleConfig]

Resample the dataset to a different time resolution. If None, no resampling. Else, should be a dictonary of the form {frequency: 'M', operator: 'mean', **other_options}. Currently supported operators are 'mean', 'min', 'max', 'sum', 'median'. For valid frequencies see [1]. Other options will be passed directly to xr.resample [2]

to_recipe()

Print out a recipe to reproduce this dataset.

download()

Download data if necessary and return file paths.

raw_load()

Load dataset into memory, including pre-processing.

load()

Load dataset into memory, including pre-processing.

download_area()

Download the data.

raw_load_area()

Load the dataset from disk into memory.

This may include pre-processing operations as specified by the context, e.g. filter certain variables, remove data points with too many NaNs, reshape data.

load_points_from_area()

Load the dataset from disk into memory.

First the bounding box of area is downloaded and then points are selected from the area. This could be quicker then directly downloading points, if the amount of points is large and in a small area.

download_points()

Download point files if necessary and return paths.

ProductInfo

Bases: BaseModel

Product information

LayerInfo

Bases: BaseModel

Layer information

products()

Get list of products

Returns:

Type Description
list[ProductInfo]

list of products

layers(product)

Get layers for a product

Parameters:

Name Type Description Default
product str

product name and version.

required

Returns:

Type Description
dict[str, LayerInfo]

list of layers

Example:

```python
import springtime.datasets.appeears as ma
products = ma.products()
product = next(filter(
    lambda p: p.Product == 'MOD15A2H' and p.Version == '061',
    products
))
layers = ma.layers(product.ProductAndVersion)
{k:v.Description for k,v in layers.items()}
```

Outputs:

```python
{'FparExtra_QC': 'Extra detail Quality for Lai and Fpar',
'FparLai_QC': 'Quality for Lai and Fpar',
'FparStdDev_500m': 'Standard deviation of Fpar',
'Fpar_500m': 'Fraction of photosynthetically active radiation',
'LaiStdDev_500m': 'Standard deviation of Lai',
'Lai_500m': 'Leaf area index'}
```