@@ -639,7 +639,7 @@ def datacube(
639
639
if intersects is not None :
640
640
intersects = cube_utils .GeometryManager (intersects ).to_geopandas ()
641
641
self .intersects = intersects
642
-
642
+
643
643
if mask_with :
644
644
if mask_with not in mask ._available_masks :
645
645
raise NotImplementedError (
@@ -686,7 +686,6 @@ def datacube(
686
686
"No cross calibration coefficient available for the specified collections."
687
687
)
688
688
689
-
690
689
xr_datacube = datacube (
691
690
items ,
692
691
intersects = intersects ,
@@ -747,32 +746,33 @@ def datacube(
747
746
748
747
Mask = mask .Mask (xr_datacube , intersects = intersects , bbox = bbox )
749
748
xr_datacube = getattr (Mask , mask_with )(** mask_kwargs )
750
-
751
-
749
+
752
750
if groupby_date :
753
751
xr_datacube = xr_datacube .groupby ("time.date" , restore_coord_dims = True )
754
- xr_datacube = getattr (xr_datacube , groupby_date )().rename (dict (date = "time" ))
752
+ xr_datacube = getattr (xr_datacube , groupby_date )().rename (
753
+ dict (date = "time" )
754
+ )
755
755
xr_datacube ["time" ] = xr_datacube .time .astype ("<M8[ns]" )
756
-
756
+
757
757
if clear_cover or mask_statistics :
758
-
759
758
first_var = xr_datacube [list (xr_datacube .data_vars )[0 ]]
760
759
xy = first_var .isel (time = 0 ).size
761
-
760
+
762
761
null_pixels = (first_var .isnull ().sum (dim = ("x" , "y" ))).values
763
- n_pixels_as_labels = xy - null_pixels
762
+ n_pixels_as_labels = xy - null_pixels
764
763
# n_pixels_as_labels = xr_datacube.attrs["usable_pixels"] - n_pixels_as_labels
765
-
764
+
766
765
xr_datacube = xr_datacube .assign_coords (
767
766
{"clear_pixels" : ("time" , n_pixels_as_labels )}
768
767
)
769
-
768
+
770
769
xr_datacube = xr_datacube .assign_coords (
771
770
{
772
771
"clear_percent" : (
773
772
"time" ,
774
773
np .multiply (
775
- n_pixels_as_labels / xr_datacube .attrs ["usable_pixels" ],
774
+ n_pixels_as_labels
775
+ / xr_datacube .attrs ["usable_pixels" ],
776
776
100 ,
777
777
).astype (np .int8 ),
778
778
)
@@ -781,8 +781,6 @@ def datacube(
781
781
if clear_cover :
782
782
xr_datacube = mask .filter_clear_cover (xr_datacube , clear_cover )
783
783
784
-
785
-
786
784
return xr_datacube
787
785
788
786
def _update_search_for_assets (self , assets ):
0 commit comments