diff --git a/CHANGELOG.md b/CHANGELOG.md index c8f4d8b7..278685f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.10] - 2024-10-10 + +### Added + +- Add a retry strategy for the EarthDaily client. + +### Fixed + +- `bbox` for datacube has been fixed. + ## [0.2.9] - 2024-09-24 ### Fixed diff --git a/earthdaily/__init__.py b/earthdaily/__init__.py index cc1752ca..6c23d445 100644 --- a/earthdaily/__init__.py +++ b/earthdaily/__init__.py @@ -7,7 +7,7 @@ # to hide warnings from rioxarray or nano seconds conversion # warnings.filterwarnings("ignore") -__version__ = "0.2.9" +__version__ = "0.2.10" def EarthDataStore( diff --git a/earthdaily/earthdatastore/__init__.py b/earthdaily/earthdatastore/__init__.py index 38231430..ebe495d9 100644 --- a/earthdaily/earthdatastore/__init__.py +++ b/earthdaily/earthdatastore/__init__.py @@ -16,6 +16,8 @@ from pystac.item_collection import ItemCollection from pystac_client.item_search import ItemSearch from pystac_client import Client +from pystac_client.stac_api_io import StacApiIO +from urllib3 import Retry from itertools import chain from odc import stac from . import _scales_collections, cube_utils, mask @@ -308,10 +310,15 @@ def _get_client(config=None, presign_urls=True, request_payer=False): if request_payer: headers["x-amz-request-payer"] = "requester" - return Client.open( - eds_url, - headers=headers, + retry = Retry( + total=5, + backoff_factor=1, + status_forcelist=[502, 503, 504], + allowed_methods=None, ) + stac_api_io = StacApiIO(max_retries=retry) + + return Client.open(eds_url, headers=headers, stac_io=stac_api_io) class StacCollectionExplorer: diff --git a/earthdaily/earthdatastore/mask/__init__.py b/earthdaily/earthdatastore/mask/__init__.py index 49d6d443..48ff5f01 100644 --- a/earthdaily/earthdatastore/mask/__init__.py +++ b/earthdaily/earthdatastore/mask/__init__.py @@ -39,7 +39,7 @@ class Mask: def __init__(self, dataset: xr.Dataset, intersects=None, bbox=None): self._obj = dataset - if bbox and intersects is None: + if bbox is not None and intersects is None: intersects = _bbox_to_intersects(bbox) if isinstance(intersects, gpd.GeoDataFrame): intersects = intersects.to_crs(self._obj.rio.crs) diff --git a/requirements.yml b/requirements.yml index 7ad246dd..fafcde60 100644 --- a/requirements.yml +++ b/requirements.yml @@ -24,4 +24,5 @@ dependencies: - spyndex - dask-image - toml -- click \ No newline at end of file +- click +- urllib3 \ No newline at end of file diff --git a/setup.py b/setup.py index e27d5d9c..c6659542 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ "spyndex", "dask-image", "numba", - "geocube", + "urllib3", "click", "toml", ],