diff --git a/cwl/sar_coherence.cwl b/cwl/sar_coherence.cwl index 7672067..ec30d6c 100755 --- a/cwl/sar_coherence.cwl +++ b/cwl/sar_coherence.cwl @@ -99,8 +99,9 @@ $graph: sub_swath: type: - type: enum - symbols: [ "IW1", "IW2", "IW3" ] + - "null" + - type: enum + symbols: [ "IW1", "IW2", "IW3" ] doc: "Sub-swath identifier" temporal_extent: @@ -147,7 +148,7 @@ $graph: run: "#extract_pairs_array" in: pairs_json_file: generate_pairs/insar_pairs_json - out: [pairs_array] + out: [pairs_array, sub_swath_id] process_pairs: run: "#process_single_pair" @@ -157,7 +158,7 @@ $graph: burst_id: burst_id spatial_extent: spatial_extent polarization: polarization - sub_swath: sub_swath + sub_swath: extract_pairs/sub_swath_id coherence_window_rg: coherence_window_rg coherence_window_az: coherence_window_az out: [pair_output] @@ -195,7 +196,7 @@ $graph: }); } - class: DockerRequirement - dockerPull: ghcr.io/cloudinsar/openeo_insar:20260511T0923 + dockerPull: ghcr.io/cloudinsar/openeo_insar:20260514T1358-merge - class: NetworkAccess networkAccess: true - class: InlineJavascriptRequirement @@ -209,8 +210,10 @@ $graph: - type: enum symbols: [ "VV", "VH" ] sub_swath: - - type: enum - symbols: [ "IW1", "IW2", "IW3" ] + type: + - "null" + - type: enum + symbols: [ "IW1", "IW2", "IW3" ] temporal_extent: type: string[] temporal_baseline: @@ -242,11 +245,16 @@ $graph: items: type: array items: string + sub_swath_id: + type: string expression: | ${ var data = JSON.parse(inputs.pairs_json_file.contents); - return {"pairs_array": data.InSAR_pairs}; + return { + "pairs_array": data.InSAR_pairs, + "sub_swath_id": data.sub_swath_id + }; } - class: CommandLineTool @@ -322,8 +330,7 @@ $graph: - type: enum symbols: [ "VV", "VH" ] sub_swath: - - type: enum - symbols: [ "IW1", "IW2", "IW3" ] + type: string coherence_window_rg: type: int? coherence_window_az: diff --git a/sar/example_inputs/input_dict_2018_vh_new_spatial_extent_no_subswath.json b/sar/example_inputs/input_dict_2018_vh_new_spatial_extent_no_subswath.json new file mode 100644 index 0000000..21705d0 --- /dev/null +++ b/sar/example_inputs/input_dict_2018_vh_new_spatial_extent_no_subswath.json @@ -0,0 +1,18 @@ +{ + "temporal_extent": [ + "2018-01-28", + "2018-02-03" + ], + "temporal_baseline": 6, + "spatial_extent": { + "west": -6.05477, + "east": -6.054, + "south": 37.039, + "north": 37.03968 + }, + "coherence_window_az": 2, + "coherence_window_rg": 10, + "n_az_looks": 1, + "n_rg_looks": 4, + "polarization": "VH" +} diff --git a/sar/get_bursts.py b/sar/get_bursts.py index 031ad5c..0fba773 100755 --- a/sar/get_bursts.py +++ b/sar/get_bursts.py @@ -42,6 +42,8 @@ spatial_extent=input_dict.get("spatial_extent"), ) +subswath = input_dict.get("sub_swath") if input_dict.get("sub_swath") is not None else s1_bursts[0]["SwathIdentifier"] + dates = [datetime.strptime(b["BeginningDateTime"][:10], "%Y-%m-%d") for b in s1_bursts] dates.sort() InSARpairs = [] @@ -61,7 +63,7 @@ raise ValueError(f"Not enough bursts found to make pairs for the given parameters: {input_dict}") input_dict["InSAR_pairs"] = InSARpairs - +input_dict["sub_swath_id"] = subswath result_folder = Path.cwd().absolute() # result_folder = repo_directory / "output" # result_folder.mkdir(exist_ok=True) diff --git a/sar/sar_coherence.py b/sar/sar_coherence.py index be236c5..08e3019 100755 --- a/sar/sar_coherence.py +++ b/sar/sar_coherence.py @@ -50,6 +50,8 @@ spatial_extent=input_dict.get("spatial_extent"), ) +# If we do not pass the subswath as input parameter, we get it from the automatically selected burst with lowest number +subswath = input_dict.get("sub_swath") if input_dict.get("sub_swath") is not None else bursts[0]["SwathIdentifier"] burst_paths = [] for burst in bursts: begin = parse_date(burst["BeginningDateTime"]).date() @@ -61,7 +63,7 @@ "sentinel1_burst_extractor.sh", "-n", burst["ParentProductName"], "-p", input_dict["polarization"].lower(), - "-s", str(input_dict["sub_swath"].lower()), + "-s", str(subswath.lower()), "-r", str(burst["BurstId"]), "-o", str(tmp_insar), ]