Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions DATASET_CATALOG_USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ datasets = list_available_datasets(catalog)
# }

# Resolve a specific dataset to its CID
cid = resolve_dataset_cid_from_stac(
resolved = resolve_dataset_cid_from_stac(
catalog=catalog,
collection="ecmwf_era5",
dataset="temperature_2m",
variant="finalized", # Optional, only needed if dataset has multiple variants
organization="ecmwf",
)

print(f"Dataset CID: {cid}")
print(f"Dataset CID: {resolved.cid} (variant: {resolved.variant})")
```

## STAC Catalog Structure
Expand Down Expand Up @@ -317,7 +317,7 @@ def resolve_dataset_cid_from_stac(
collection: str,
dataset: str,
variant: Optional[str] = None
) -> str
) -> ResolvedDataset
```

**Parameters:**
Expand All @@ -327,7 +327,7 @@ def resolve_dataset_cid_from_stac(
- `variant`: Optional variant name

**Returns:**
- `str`: IPFS CID (without "ipfs://" prefix)
- `ResolvedDataset`: IPFS CID (without "ipfs://" prefix) and selected variant

**Raises:**
- `ValueError`: If collection, dataset, or variant is not found
Expand All @@ -340,14 +340,14 @@ from dclimate_client_py import load_stac_catalog, resolve_dataset_cid_from_stac
catalog = load_stac_catalog("https://ipfs-gateway.dclimate.net")

# Resolve dataset to CID
cid = resolve_dataset_cid_from_stac(
resolved = resolve_dataset_cid_from_stac(
catalog=catalog,
collection="ifs",
dataset="temperature",
variant="single"
)

print(f"Dataset CID: {cid}")
print(f"Dataset CID: {resolved.cid} (variant: {resolved.variant})")
```

### `get_root_catalog_cid()`
Expand All @@ -362,7 +362,7 @@ def get_root_catalog_cid() -> str
- `str`: The IPFS CID of the latest root STAC catalog

**Raises:**
- `requests.HTTPError`: If the API request fails
- `httpx.HTTPError`: If the API request fails
- `KeyError`: If response doesn't contain expected 'cid' field

**Example:**
Expand Down
2 changes: 2 additions & 0 deletions dclimate_client_py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
TemporalExtent,
)
from .stac_server import (
ResolvedDataset,
resolve_cid_from_stac_server,
list_available_datasets_from_stac_server,
STAC_SERVER_URL,
Expand Down Expand Up @@ -74,6 +75,7 @@ def __dir__() -> list[str]:
"TemporalExtent",
"load_stac_catalog",
"list_available_datasets",
"ResolvedDataset",
"resolve_cid_from_stac_server",
"list_available_datasets_from_stac_server",
"STAC_SERVER_URL",
Expand Down
24 changes: 12 additions & 12 deletions dclimate_client_py/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ def load_s3(
def geo_temporal_query(
dataset_name: str,
source: typing.Literal["s3"] = "s3",
bucket_name: str = None,
var_name: str = None,
bucket_name: typing.Optional[str] = None,
var_name: typing.Optional[str] = None,
gateway_uri_stem: str | None = None,
rpc_uri_stem: str | None = None,
forecast_reference_time: str = None,
point_kwargs: dict = None,
circle_kwargs: dict = None,
rectangle_kwargs: dict = None,
polygon_kwargs: dict = None,
multiple_points_kwargs: dict = None,
forecast_reference_time: typing.Optional[str] = None,
point_kwargs: typing.Optional[dict] = None,
circle_kwargs: typing.Optional[dict] = None,
rectangle_kwargs: typing.Optional[dict] = None,
polygon_kwargs: typing.Optional[dict] = None,
multiple_points_kwargs: typing.Optional[dict] = None,
bounds=None,
bounds_options: dict = None,
spatial_agg_kwargs: dict = None,
temporal_agg_kwargs: dict = None,
rolling_agg_kwargs: dict = None,
bounds_options: typing.Optional[dict] = None,
spatial_agg_kwargs: typing.Optional[dict] = None,
temporal_agg_kwargs: typing.Optional[dict] = None,
rolling_agg_kwargs: typing.Optional[dict] = None,
time_range: typing.Optional[typing.List[datetime.datetime]] = None,
# as_of: typing.Optional[datetime.datetime] = None, # Removed as_of
point_limit: int = DEFAULT_POINT_LIMIT,
Expand Down
Loading
Loading