Skip to content

Commit 45d4fe0

Browse files
committed
fix linting
1 parent bbc77d3 commit 45d4fe0

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

odc/stats/plugins/cloud_proba_percentiles.py

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,14 @@
88
"""
99

1010
from functools import partial
11-
from typing import Any, Dict, Iterable, Optional, Sequence, Tuple, Mapping
11+
from typing import Sequence, Tuple, Mapping
1212

13-
import datacube
1413
import numpy as np
15-
import pandas as pd
1614
import xarray as xr
17-
from datacube.model import Dataset
18-
from odc.geo.xr import assign_crs
19-
from odc.geo.geobox import GeoBox
20-
from odc.algo.io import load_with_native_transform
2115
from odc.algo._percentile import xr_quantile_bands
2216
from odc.stats.plugins._registry import register, StatsPluginInterface
23-
from odc.algo._masking import (
24-
erase_bad,
25-
enum_to_bool
26-
)
17+
from odc.algo._masking import erase_bad, enum_to_bool
18+
2719

2820
class S2Cloudless_percentiles(StatsPluginInterface):
2921
NAME = "S2Cloudless_percentiles"
@@ -35,36 +27,37 @@ def __init__(
3527
self,
3628
resampling: str = "cubic",
3729
bands: Sequence[str] = ["oa_s2cloudless_prob"],
38-
output_bands: Sequence[str] = ['oa_s2cloudless_prob_pc_5', 'oa_s2cloudless_prob_pc_10','oa_s2cloudless_prob_pc_25'],
30+
output_bands: Sequence[str] = [
31+
"oa_s2cloudless_prob_pc_5",
32+
"oa_s2cloudless_prob_pc_10",
33+
"oa_s2cloudless_prob_pc_25",
34+
],
3935
mask_band: str = "oa_s2cloudless_mask",
4036
chunks: Mapping[str, int] = {"y": 512, "x": 512},
4137
group_by: str = "solar_day",
42-
nodata_classes: Sequence[str] = ["nodata"],
38+
nodata_classes: Sequence[str] = ["nodata"],
4339
output_dtype: str = "float32",
4440
**kwargs,
4541
):
46-
47-
self.resampling=resampling
42+
43+
self.resampling = resampling
4844
self.bands = bands
4945
self.output_bands = output_bands
5046
self.mask_band = mask_band
5147
self.chunks = chunks
5248
self.group_by = group_by
5349
self.resampling = resampling
54-
self.nodata_classes= nodata_classes
50+
self.nodata_classes = nodata_classes
5551
self.output_dtype = np.dtype(output_dtype)
5652
self.output_nodata = np.nan
5753

5854
super().__init__(
59-
input_bands=tuple(bands),
60-
resampling=resampling,
61-
chunks=chunks,
62-
**kwargs
55+
input_bands=tuple(bands), resampling=resampling, chunks=chunks, **kwargs
6356
)
6457

6558
@property
6659
def measurements(self) -> Tuple[str, ...]:
67-
return (self.output_bands)
60+
return self.output_bands
6861

6962
def native_transform(self, xx: xr.Dataset) -> xr.Dataset:
7063
"""
@@ -79,14 +72,13 @@ def native_transform(self, xx: xr.Dataset) -> xr.Dataset:
7972
mask = xx[self.mask_band]
8073
bad = enum_to_bool(mask, self.nodata_classes)
8174

82-
#drop mask band
75+
# drop mask band
8376
xx = xx.drop_vars([self.mask_band])
8477

8578
# apply the masks
8679
xx = erase_bad(xx, bad)
8780

8881
return xx
89-
9082

9183
def reduce(self, xx: xr.Dataset) -> xr.Dataset:
9284
"""
@@ -99,4 +91,5 @@ def reduce(self, xx: xr.Dataset) -> xr.Dataset:
9991

10092
return yy
10193

94+
10295
register("s2_gm_tools.S2Cloudless_percentiles", S2Cloudless_percentiles)

0 commit comments

Comments
 (0)