Skip to content

Commit

Permalink
fix: fixed processing graph keyword (#69)
Browse files Browse the repository at this point in the history
Co-authored-by: Gerald Walter Irsiegler <gerald@Irsiegler-P14s>
  • Loading branch information
GeraldIr and Gerald Walter Irsiegler authored Oct 18, 2023
1 parent fe39617 commit 612d706
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 112 deletions.
6 changes: 3 additions & 3 deletions openeo_pg_parser_networkx/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ def _walk_node(self):

for arg_name, arg in self._EVAL_ENV.callbacks_to_walk.items():
if "fitcurve" in self._EVAL_ENV.node_name and arg_name == "function":
function_pg_data = self.pg_data[self._EVAL_ENV.node_name]["arguments"][
arg_name
]
function_pg_data = self.pg_data["process_graph"][
self._EVAL_ENV.node_name
]["arguments"][arg_name]
pg = OpenEOProcessGraph(pg_data=function_pg_data)
formatted_nodes = format_nodes(pg=pg, vars=['x'])

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openeo-pg-parser-networkx"
version = "2023.10.5"
version = "2023.10.6"

description = "Parse OpenEO process graphs from JSON to traversible Python objects."
authors = ["Lukas Weidenholzer <[email protected]>", "Sean Hoyal <[email protected]>", "Valentina Hutter <[email protected]>", "Gerald Irsiegler <[email protected]>"]
Expand Down
275 changes: 167 additions & 108 deletions tests/data/graphs/fit_curve.json
Original file line number Diff line number Diff line change
@@ -1,116 +1,175 @@
{
"loadcollection1":{
"process_id":"load_collection",
"arguments":{
"bands":[
"B02",
"B03"
],
"id":"boa_sentinel_2",
"spatial_extent":{
"west":11.389,
"east":11.39,
"south":46.349,
"north":46.35
},
"temporal_extent":[
"2016-09-01",
"2018-09-01"
]
"id": "testcurvefitgerald22",
"process_graph": {
"loadcollection1": {
"process_id": "load_collection",
"arguments": {
"bands": [
"B02",
"B03"
],
"id": "boa_sentinel_2",
"spatial_extent": {
"west": 11.5,
"east": 11.8,
"south": 47,
"north": 47.3
},
"temporal_extent": [
"2016-09-01",
"2018-09-01"
]
}
},
"apply1":{
"process_id":"apply",
"arguments":{
"data":{
"from_node":"loadcollection1"
},
"process":{
"process_graph":{
"clip1":{
"process_id":"clip",
"arguments":{
"max":5000,
"min":0,
"x":{
"from_parameter":"x"
}
},
"result":true
}
},
"apply1": {
"process_id": "apply",
"arguments": {
"data": {
"from_node": "loadcollection1"
},
"process": {
"process_graph": {
"clip1": {
"process_id": "clip",
"arguments": {
"max": 5000,
"min": 0,
"x": {
"from_parameter": "x"
}
},
"result": true
}
}
}
}
}
},
"fitcurve1":{
"process_id":"fit_curve",
"arguments":{
"data":{
"from_node":"apply1"
},
"dimension":"time",
"function":{
"process_graph":{
"arrayelement1":{
"process_id":"array_element",
"arguments":{
"data":{
"from_parameter":"parameters"
},
"index":0
}
},
"arrayelement2":{
"process_id":"array_element",
"arguments":{
"data":{
"from_parameter":"parameters"
},
"index":1
}
},
"multiply1":{
"process_id":"multiply",
"arguments":{
"x":{
"from_node":"arrayelement2"
},
"y":{
"from_parameter":"x"
}
}
},
"add1":{
"process_id":"add",
"arguments":{
"x":{
"from_node":"arrayelement1"
},
"y":{
"from_node":"multiply1"
}
},
"result":true
}
},
"fitcurve1": {
"process_id": "fit_curve",
"arguments": {
"data": {
"from_node": "apply1"
},
"dimension": "t",
"function": {
"process_graph": {
"arrayelement1": {
"process_id": "array_element",
"arguments": {
"data": {
"from_parameter": "parameters"
},
"index": 0
}
},
"arrayelement2": {
"process_id": "array_element",
"arguments": {
"data": {
"from_parameter": "parameters"
},
"index": 1
}
},
"multiply1": {
"process_id": "multiply",
"arguments": {
"x": 1.991021277657232e-7,
"y": {
"from_parameter": "x"
}
}
},
"cos1": {
"process_id": "cos",
"arguments": {
"x": {
"from_node": "multiply1"
}
}
},
"multiply2": {
"process_id": "multiply",
"arguments": {
"x": {
"from_node": "arrayelement2"
},
"y": {
"from_node": "cos1"
}
}
},
"add1": {
"process_id": "add",
"arguments": {
"x": {
"from_node": "arrayelement1"
},
"y": {
"from_node": "multiply2"
}
}
},
"arrayelement3": {
"process_id": "array_element",
"arguments": {
"data": {
"from_parameter": "parameters"
},
"index": 2
}
},
"sin1": {
"process_id": "sin",
"arguments": {
"x": {
"from_node": "multiply1"
}
}
},
"multiply3": {
"process_id": "multiply",
"arguments": {
"x": {
"from_node": "arrayelement3"
},
"y": {
"from_node": "sin1"
}
}
},
"add2": {
"process_id": "add",
"arguments": {
"x": {
"from_node": "add1"
},
"y": {
"from_node": "multiply3"
}
},
"result": true
}
},
"parameters":[
1,
2
]
}
},
"parameters": [
400,
100,
-100
]
}
},
"saveresult1":{
"process_id":"save_result",
"arguments":{
"data":{
"from_node":"fitcurve1"
},
"format":"NetCDF",
"options":{

}
},
"saveresult1": {
"process_id": "save_result",
"arguments": {
"data": {
"from_node": "fitcurve1"
},
"format": "NetCDF",
"options": {
}
},
"result":true
}
"result": true
}
}
}

0 comments on commit 612d706

Please sign in to comment.