Skip to content

Commit

Permalink
fix(landsat QA_pixel) : force loading dask
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasK committed Dec 6, 2023
1 parent 38cbe4b commit 3328902
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions earthdaily/earthdatastore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,7 @@ def datacube(
raise ValueError(
f"Specified mask '{mask_with}' is not available. Currently available masks provider are : {mask._available_masks}"
)
collection = collections[0]
else:
collection = collections
collection = collections[0] if isinstance(collections,list) else collections

if mask_with == "ag_cloud_mask":
search_kwargs = self._update_search_kwargs_for_ag_cloud_mask(
Expand Down Expand Up @@ -510,7 +508,7 @@ def datacube(
acm_datacube = acm_datacube.load()
mask_kwargs.update(acm_datacube=acm_datacube)
else:
mask_assets = mask._native_mask_asset_mapping[collections]
mask_assets = mask._native_mask_asset_mapping[collection]
if "groupby_date" in kwargs:
kwargs["groupby_date"] = "max"
if "resolution" not in kwargs:
Expand Down
2 changes: 1 addition & 1 deletion earthdaily/earthdatastore/mask/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def landsat_qa_pixel(self, add_mask_var=False, mask_statistics=False):

def _landsat_qa_pixel_convert(self):
for time in self._obj.time:
data = self._obj["qa_pixel"].loc[dict(time=time)].data
data = self._obj["qa_pixel"].loc[dict(time=time)].load().data
data_f = data.flatten()
clm = QA_PIXEL_cloud_detection(data_f[~np.isnan(data_f)])
clm = np.where(clm == 0, np.nan, clm)
Expand Down

0 comments on commit 3328902

Please sign in to comment.