Skip to content

Commit

Permalink
Fix pre-commit failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyh committed Apr 26, 2022
1 parent 667f2aa commit 82ae027
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
30 changes: 21 additions & 9 deletions eodatasets3/wagl.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,23 +459,31 @@ def for_path(
[fmask_doc] = loads_yaml(fl)

if "sentinel" in wagl_doc["source_datasets"]["platform_id"].lower():
s2cloudless_prob_path = s2cloudless_prob_path or wagl_hdf5.with_name(
f"{granule_name}.prob.s2cloudless.tif"
s2cloudless_prob_path = (
s2cloudless_prob_path
or wagl_hdf5.with_name(f"{granule_name}.prob.s2cloudless.tif")
)
if not s2cloudless_prob_path.exists():
raise ValueError(f"No s2cloudless probability image found at {s2cloudless_prob_path}")
raise ValueError(
f"No s2cloudless probability image found at {s2cloudless_prob_path}"
)

s2cloudless_mask_path = s2cloudless_mask_path or wagl_hdf5.with_name(
f"{granule_name}.mask.s2cloudless.tif"
s2cloudless_mask_path = (
s2cloudless_mask_path
or wagl_hdf5.with_name(f"{granule_name}.mask.s2cloudless.tif")
)
if not s2cloudless_mask_path.exists():
raise ValueError(f"No s2cloudless mask image found at {s2cloudless_mask_path}")
raise ValueError(
f"No s2cloudless mask image found at {s2cloudless_mask_path}"
)

s2cloudless_doc_path = s2cloudless_doc_path or wagl_hdf5.with_name(
f"{granule_name}.s2cloudless.yaml"
)
if not s2cloudless_doc_path.exists():
raise ValueError(f"No s2cloudless metadata found at {s2cloudless_doc_path}")
raise ValueError(
f"No s2cloudless metadata found at {s2cloudless_doc_path}"
)
with s2cloudless_doc_path.open("r") as fl:
[s2cloudless_doc] = loads_yaml(fl)
else:
Expand Down Expand Up @@ -747,7 +755,9 @@ def package(
)

if granule.s2cloudless_prob:
with do(f"Writing s2cloudless probability from {granule.s2cloudless_prob} "):
with do(
f"Writing s2cloudless probability from {granule.s2cloudless_prob} "
):
p.write_measurement(
"oa:s2cloudless_prob",
granule.s2cloudless_prob,
Expand All @@ -757,7 +767,9 @@ def package(
)

if granule.s2cloudless_mask:
with do(f"Writing s2cloudless mask from {granule.s2cloudless_mask} "):
with do(
f"Writing s2cloudless mask from {granule.s2cloudless_mask} "
):
p.write_measurement(
"oa:s2cloudless_mask",
granule.s2cloudless_mask,
Expand Down
18 changes: 5 additions & 13 deletions tests/integration/test_packagewagl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1089,15 +1089,11 @@ def test_esa_sentinel_wagl_package(tmp_path: Path):
},
},
"s2cloudless": {
"parameters": {
"average_over": 4,
"dilation_size": 2,
"threshold": 0.4
},
"parameters": {"average_over": 4, "dilation_size": 2, "threshold": 0.4},
"percent_class_distribution": {
"clear": 94.25411486314457,
"cloud": 5.745885136855438
}
"cloud": 5.745885136855438,
},
},
"software_versions": [
{
Expand Down Expand Up @@ -1526,14 +1522,10 @@ def test_sinergise_sentinel_wagl_package(tmp_path: Path):
},
},
"s2cloudless": {
"parameters": {
"average_over": 4,
"dilation_size": 2,
"threshold": 0.4
},
"parameters": {"average_over": 4, "dilation_size": 2, "threshold": 0.4},
"percent_class_distribution": {
"clear": 97.14675202540054,
"cloud": 2.8532479745994497
"cloud": 2.8532479745994497,
},
},
"software_versions": [
Expand Down

0 comments on commit 82ae027

Please sign in to comment.