Skip to content

Commit

Permalink
fix: fixed issue where smoothing 0 would remove all values
Browse files Browse the repository at this point in the history
  • Loading branch information
JanssenBrm committed Mar 19, 2024
1 parent 954b24c commit b4da48c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 20 deletions.
53 changes: 38 additions & 15 deletions src/fusets/openeo/services/mogpr_s1_s2.json
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,29 @@
}
}
},
"gt1": {
"process_id": "gt",
"arguments": {
"x": 0,
"y": {
"from_parameter": "s1_smoothing_lambda"
}
}
},
"if7": {
"process_id": "if",
"arguments": {
"accept": {
"from_node": "applydimension1"
},
"reject": {
"from_node": "if6"
},
"value": {
"from_node": "gt1"
}
}
},
"BIOPAR1": {
"process_id": "BIOPAR",
"arguments": {
Expand Down Expand Up @@ -1047,7 +1070,7 @@
"y": "ndvi"
}
},
"if7": {
"if8": {
"process_id": "if",
"arguments": {
"accept": {
Expand All @@ -1069,14 +1092,14 @@
"y": "fapar"
}
},
"if8": {
"if9": {
"process_id": "if",
"arguments": {
"accept": {
"from_node": "maskpolygon12"
},
"reject": {
"from_node": "if7"
"from_node": "if8"
},
"value": {
"from_node": "eq21"
Expand All @@ -1093,14 +1116,14 @@
"y": "lai"
}
},
"if9": {
"if10": {
"process_id": "if",
"arguments": {
"accept": {
"from_node": "maskpolygon11"
},
"reject": {
"from_node": "if8"
"from_node": "if9"
},
"value": {
"from_node": "eq22"
Expand All @@ -1117,14 +1140,14 @@
"y": "fcover"
}
},
"if10": {
"if11": {
"process_id": "if",
"arguments": {
"accept": {
"from_node": "maskpolygon10"
},
"reject": {
"from_node": "if9"
"from_node": "if10"
},
"value": {
"from_node": "eq23"
Expand All @@ -1141,14 +1164,14 @@
"y": "evi"
}
},
"if11": {
"if12": {
"process_id": "if",
"arguments": {
"accept": {
"from_node": "adddimension3"
},
"reject": {
"from_node": "if10"
"from_node": "if11"
},
"value": {
"from_node": "eq24"
Expand All @@ -1165,14 +1188,14 @@
"y": "ccc"
}
},
"if12": {
"if13": {
"process_id": "if",
"arguments": {
"accept": {
"from_node": "maskpolygon8"
},
"reject": {
"from_node": "if11"
"from_node": "if12"
},
"value": {
"from_node": "eq25"
Expand All @@ -1189,14 +1212,14 @@
"y": "cwc"
}
},
"if13": {
"if14": {
"process_id": "if",
"arguments": {
"accept": {
"from_node": "maskpolygon7"
},
"reject": {
"from_node": "if12"
"from_node": "if13"
},
"value": {
"from_node": "eq26"
Expand All @@ -1207,10 +1230,10 @@
"process_id": "merge_cubes",
"arguments": {
"cube1": {
"from_node": "applydimension1"
"from_node": "if7"
},
"cube2": {
"from_node": "if13"
"from_node": "if14"
}
}
},
Expand Down
14 changes: 9 additions & 5 deletions src/fusets/openeo/services/publish_mogpr_s1_s2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Reads contents with UTF-8 encoding and returns str.
import openeo
from openeo.api.process import Parameter
from openeo.processes import eq, if_, merge_cubes, process
from openeo.processes import eq, gt, if_, merge_cubes, process

from fusets.openeo.services.dummies import DummyConnection
from fusets.openeo.services.helpers import DATE_SCHEMA, GEOJSON_SCHEMA, publish_service, read_description
Expand All @@ -15,7 +15,7 @@


def execute_udf():
connection = openeo.connect("openeo-dev.vito.be").authenticate_oidc()
connection = openeo.connect("openeo.vito.be").authenticate_oidc()
spat_ext = {
"type": "Polygon",
"coordinates": [
Expand All @@ -28,7 +28,7 @@ def execute_udf():
]
],
}
temp_ext = ["2023-01-01", "2023-06-30"]
temp_ext = ["2023-01-01", "2023-02-28"]
mogpr = connection.datacube_from_flat_graph(
generate_cube(
connection=connection,
Expand All @@ -42,7 +42,7 @@ def execute_udf():
).flat_graph()
)
mogpr.execute_batch(
"./result_mogpr_s1_s2_outputs.nc",
"./result_mogpr_s1_s2_outputs_smoothed.nc",
title=f"FuseTS - MOGPR S1 S2 - Local - Outputs - DESC",
job_options={
"udf-dependency-archives": [
Expand Down Expand Up @@ -259,7 +259,11 @@ def load_s1_collection(connection, collection, smoothing_lambda, polygon, date):
collection=collection, label=option["label"], callable=option["function"], reject=collections
)

smoothed = generate_whittaker_cube(input_cube=collections, smoothing_lambda=smoothing_lambda)
smoothed = if_(
gt(0, smoothing_lambda),
generate_whittaker_cube(input_cube=collections, smoothing_lambda=smoothing_lambda),
collections,
)
return smoothed


Expand Down

0 comments on commit b4da48c

Please sign in to comment.