26
26
import pystac .item
27
27
import xarray as xr
28
28
from dask .utils import ndeepmap
29
- from numpy .typing import DTypeLike
30
29
from odc .geo import CRS , MaybeCRS , SomeResolution
31
30
from odc .geo .geobox import GeoBox , GeoboxAnchor , GeoboxTiles
32
31
from odc .geo .types import Unset
37
36
resolve_chunk_shape ,
38
37
resolve_load_cfg ,
39
38
)
40
- from odc .loader .types import ReaderDriverSpec
39
+ from odc .loader .types import ReaderDriverSpec , Band_DType
41
40
42
41
from ._mdtools import ConversionConfig , output_geobox , parse_items
43
42
from .model import BandQuery , ParsedItem , RasterCollectionMetadata
@@ -90,7 +89,7 @@ def load(
90
89
* ,
91
90
groupby : Optional [Groupby ] = "time" ,
92
91
resampling : Optional [Union [str , Dict [str , str ]]] = None ,
93
- dtype : Union [ DTypeLike , Dict [ str , DTypeLike ], None ] = None ,
92
+ dtype : Band_DType = None ,
94
93
chunks : Optional [Dict [str , int | Literal ["auto" ]]] = None ,
95
94
pool : Union [ThreadPoolExecutor , int , None ] = None ,
96
95
# Geo selection
@@ -105,6 +104,7 @@ def load(
105
104
y : Optional [Tuple [float , float ]] = None ,
106
105
like : Optional [Any ] = None ,
107
106
geopolygon : Optional [Any ] = None ,
107
+ intersects : Optional [Any ] = None ,
108
108
# UI
109
109
progress : Optional [Any ] = None ,
110
110
fail_on_error : bool = True ,
@@ -130,7 +130,7 @@ def load(
130
130
catalog = pystac.Client.open(...)
131
131
query = catalog.search(...)
132
132
xx = odc.stac.load(
133
- query.get_items (),
133
+ query.items (),
134
134
bands=["red", "green", "blue"],
135
135
)
136
136
xx.red.plot.imshow(col="time")
@@ -263,6 +263,10 @@ def load(
263
263
``EPSG:4326`` projection for dictionary and Shapely inputs. CRS information available
264
264
on GeoPandas inputs should be understood correctly.
265
265
266
+ :param intersects:
267
+ Simple alias to `geopolygon` so that the same inputs work for `pystac_client.Client.search`
268
+ as they do here.
269
+
266
270
.. rubric:: STAC Related Options
267
271
268
272
:param stac_cfg:
@@ -293,7 +297,7 @@ def load(
293
297
)
294
298
295
299
xx = stac.load(
296
- query.get_items (),
300
+ query.items (),
297
301
bands=["red", "green", "blue"],
298
302
resolution=100, # 1/10 of the native 10m resolution
299
303
patch_url=pc.sign,
@@ -355,6 +359,9 @@ def load(
355
359
items = list (items )
356
360
_parsed = list (parse_items (items , cfg = stac_cfg , md_plugin = md_plugin ))
357
361
362
+ if geopolygon is None and intersects is not None :
363
+ geopolygon = intersects
364
+
358
365
gbox = output_geobox (
359
366
_parsed ,
360
367
bands = bands ,
@@ -459,6 +466,7 @@ def _with_debug_info(ds: xr.Dataset, **kw) -> xr.Dataset:
459
466
chunks = chunks ,
460
467
pool = pool ,
461
468
progress = progress ,
469
+ dtype = dtype ,
462
470
)
463
471
)
464
472
0 commit comments