if "xarray:storage_options" in asset.extra_fields:
ds = xr.open_zarr(
asset.href,
storage_options=asset.extra_fields["xarray:storage_options"],
consolidated=True,
)
else:
ds = xr.open_dataset(
asset.href,
**asset.extra_fields["xarray:open_kwargs"],
)
return ds
def load_terraclimate_dataset():
"""
Load TerraClimate dataset from Microsoft Planetary Computer.
"""
catalog = pystac_client.Client.open(
"https://planetarycomputer.microsoft.com/api/stac/v1",
modifier=pc.sign_inplace,
)
collection = catalog.get_collection("terraclimate")
asset = collection.assets["zarr-abfs"]