From 22599075aa8de8b6ba2bf3b289bee086d45dbb3c Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Mon, 25 Nov 2024 06:43:22 -0600 Subject: [PATCH] Update README.md --- README.md | 71 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index d2dd0e5..88abaaa 100644 --- a/README.md +++ b/README.md @@ -55,35 +55,54 @@ This example demonstrates how consumers of this extension can use the data to si an asset from STAC into an xarray Dataset. ```python ->>> import fsspec, xarray, pystac ->>> collection = pystac.read_file("examples/collection.json") ->>> asset = collection.assets["example"] +>>> import pystac, planetary_computer, xarray as xr + +>>> collection = planetary_computer.sign( +... pystac.read_file("https://planetarycomputer.microsoft.com/api/stac/v1/collections/terraclimate") +... ) +>>> asset = collection.assets["zarr-abfs"] >>> asset.media_type -'application/vnd+zarr' ->>> store = fsspec.get_mapper(asset.href, **asset.properties["xarray:storage_options"]) ->>> ds = xarray.open_zarr(store, **asset.properties["xarray:open_kwargs"]) + +>>> ds = xr.open_dataset( +... asset.href, +... **asset.extra_fields["xarray:open_kwargs"] +... ) >>> ds - -Dimensions: (crs: 1, lat: 4320, lon: 8640, time: 744) + Size: 2TB +Dimensions: (time: 768, lat: 4320, lon: 8640, crs: 1) Coordinates: - * crs (crs) int16 3 - * lat (lat) float64 89.98 89.94 89.9 ... -89.94 -89.98 - * lon (lon) float64 -180.0 -179.9 -179.9 ... 179.9 180.0 - * time (time) datetime64[ns] 1958-01-01 ... 2019-12-01 -Data variables: (12/18) - aet (time, lat, lon) float32 dask.array - def (time, lat, lon) float32 dask.array - pdsi (time, lat, lon) float32 dask.array - pet (time, lat, lon) float32 dask.array - ppt (time, lat, lon) float32 dask.array - ppt_station_influence (time, lat, lon) float32 dask.array - ... ... - tmin (time, lat, lon) float32 dask.array - tmin_station_influence (time, lat, lon) float32 dask.array - vap (time, lat, lon) float32 dask.array - vap_station_influence (time, lat, lon) float32 dask.array - vpd (time, lat, lon) float32 dask.array - ws (time, lat, lon) float32 dask.array + * crs (crs) int16 2B 3 + * lat (lat) float64 35kB 89.98 89.94 89.9 89.85 ... -89.9 -89.94 -89.98 + * lon (lon) float64 69kB -180.0 -179.9 -179.9 ... 179.9 179.9 180.0 + * time (time) datetime64[ns] 6kB 1958-01-01 1958-02-01 ... 2021-12-01 +Data variables: (12/14) + aet (time, lat, lon) float32 115GB dask.array + def (time, lat, lon) float32 115GB dask.array + pdsi (time, lat, lon) float32 115GB dask.array + pet (time, lat, lon) float32 115GB dask.array + ppt (time, lat, lon) float64 229GB dask.array + q (time, lat, lon) float64 229GB dask.array + ... ... + swe (time, lat, lon) float64 229GB dask.array + tmax (time, lat, lon) float32 115GB dask.array + tmin (time, lat, lon) float32 115GB dask.array + vap (time, lat, lon) float32 115GB dask.array + vpd (time, lat, lon) float32 115GB dask.array + ws (time, lat, lon) float32 115GB dask.array +Attributes: (12/52) + Conventions: CF-1.6 + acknowledgment: Please cite the references included here... + cdm_data_type: GRID + contributor_email: khegewisch@ucmerced.edu + contributor_name: Katherine Hegewisch + contributor_role: Postdoctoral Fellow + ... ... + time_coverage_duration: P1Y + time_coverage_end: 1958-12-01T00:0 + time_coverage_resolution: P1M + time_coverage_start: 1958-01-01T00:0 + title: TerraClimate: monthly climate and climat... + version: v1.0 ``` ## Contributing