ee.ImageCollection.loadZarrV2Array

  • ee.ImageCollection.loadZarrV2Array loads a Zarr v2 array with 3 or more dimensions as an ImageCollection by slicing along a specified non-spatial axis.

  • The Zarr array must have at least three dimensions, with the final two representing Y and X, and its attributes must include '_ARRAY_DIMENSIONS' listing the dimension names.

  • Supported compression codecs include 'blosc', 'gzip', 'lz4', 'zlib', and 'zstd', with specific blosc meta-compression codecs also supported.

  • The function requires a Cloud Storage URI for the .zarray file, which must have a corresponding .zmetadata file and be located in a supported US region or dual-region with necessary permissions.

Loads a Zarr v2 array with 3 or more dimensions (i.e., 1 or more non-spatial dimensions) as an ImageCollection by slicing along a specified non-spatial axis. The array attributes (.zattrs) must contain the field '_ARRAY_DIMENSIONS', which is a list of the names of each dimension (e.g., ['time', 'y', 'x']). There must be at least two dimensions, with the final two representing Y and X respectively (e.g., ['lat', 'lon']). The supported compression codecs are 'blosc', 'gzip', 'lz4', 'zlib', and 'zstd'. The supported blosc meta-compression codecs are 'lz4', 'lz4hc', 'zlib', and 'zstd' ('blosclz' is not supported).

UsageReturns
ee.ImageCollection.loadZarrV2Array(uri, proj, axis, starts, ends)ImageCollection
ArgumentTypeDetails
uriStringThe Cloud Storage URI of the .zarray file to load. A .zmetadata file must be present in the parent directory of the array's directory (e.g., for 'gs://b/o/.zarray', 'gs://b/.zmetadata' must be present). The bucket metadata must be accessible (requires the `storage.buckets.get` permission which is provided by the role "Storage Legacy Bucket Reader" among others, see https://cloud.google.com/storage/docs/access-control/iam-roles) and the bucket must be located in the US multi-region, a dual-region including US-CENTRAL1, or the US-CENTRAL1 region.
projProjectionThe projection of the array.
axisInteger, default: nullThe non-spatial axis (0-indexed) along which to slice the array to create an ImageCollection. Each image in the collection represents a single slice (length 1) along this axis. If null, defaults to 0. The value must be in the range [0, N-1], where N is the number of non-spatial dimensions (i.e., total dimensions - 2). The array must have at least one non-spatial dimension (i.e., be at least 3 dimensional).
startsList, default: nullThe indices (inclusive) at which to start taking slices along each non-spatial dimension. If null, slices will start at index 0 for all non-spatial dimensions. If specified, this list must have a length equal to the number of non-spatial dimensions (total dimensions - 2). An individual element within the list may be null, which defaults to 0 for that dimension. Negative indices are counted from the end of the dimension (e.g., -1 is the last element).
endsList, default: nullThe indices (exclusive) at which to stop taking slices along each non-spatial dimension. If null, slices will extend to the end of each corresponding non-spatial dimension (i.e., defaults to the length of the dimension). If specified, this list must have a length equal to the number of non-spatial dimensions (total dimensions - 2). An individual element within the list may be null, which also defaults to the length of that dimension. Negative indices are counted from the end of the dimension (e.g., -1 is the last element).

Examples

Code Editor (JavaScript)

var timeStart = 1000000;
var timeEnd = 1000048;

// Load a 2m temperature Zarr v2 array.
var temperature = ee.ImageCollection.loadZarrV2Array({
  uri: 'gs://gcp-public-data-arco-era5/ar/' +
      'full_37-1h-0p25deg-chunk-1.zarr-v3/2m_temperature/.zarray',
  proj: 'EPSG:4326',
  axis: 0,
  starts: [timeStart],
  ends: [timeEnd]
});

print(temperature);

var visParams = {
  min: 220,
  max: 350,
  palette: [
    'darkblue', 'blue', 'cyan', 'green', 'yellow', 'orange', 'red', 'darkred'
  ]
};
Map.addLayer(temperature, visParams, '2m Temperature');

Python setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

import ee
import geemap.core as geemap

Colab (Python)

time_start = 1000000
time_end = 1000048

# Load a 2m temperature Zarr v2 array.
temperature = ee.ImageCollection.loadZarrV2Array(
    uri=(
        'gs://gcp-public-data-arco-era5/ar/'
        'full_37-1h-0p25deg-chunk-1.zarr-v3/2m_temperature/.zarray'
    ),
    proj='EPSG:4326',
    axis=0,
    starts=[time_start],
    ends=[time_end],
)

display(temperature)

vis_params = {
    'min': 220,
    'max': 350,
    'palette': [
        'darkblue',
        'blue',
        'cyan',
        'green',
        'yellow',
        'orange',
        'red',
        'darkred',
    ],
}
m.add_layer(temperature, vis_params, '2m Temperature')
m