diff --git a/eodatasets3/wagl.py b/eodatasets3/wagl.py index f08be2f1..fa8a845e 100644 --- a/eodatasets3/wagl.py +++ b/eodatasets3/wagl.py @@ -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: @@ -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, @@ -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, diff --git a/tests/integration/test_packagewagl.py b/tests/integration/test_packagewagl.py index 1ba4c6f6..bdc503ac 100644 --- a/tests/integration/test_packagewagl.py +++ b/tests/integration/test_packagewagl.py @@ -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": [ { @@ -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": [