Skip to content

Commit

Permalink
added parser fix
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sintef committed Dec 7, 2022
1 parent 0e04df1 commit 094db6c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions aiida_marketusercase3/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def parse(self, **kwargs):
return ExitCode(0)


DummyUserCase3Calc = CalculationFactory("dummy_marketuc3")
class DummyUserCase3Parser(Parser):
"""
Dummy parser that only reads output json files form other plugins
Expand All @@ -109,8 +110,8 @@ def __init__(self, node):
:param type node: :class:`aiida.orm.nodes.process.process.ProcessNode`
"""
super().__init__(node)
if not issubclass(node.process_class, UserCase3Calc):
raise exceptions.ParsingError("Can only parse UserCase3 calculations")
if not issubclass(node.process_class, DummyUserCase3Calc):
raise exceptions.ParsingError("Can only parse Dummy-UserCase3 calculations")

def parse(self, **kwargs):
"""
Expand All @@ -135,13 +136,13 @@ def parse(self, **kwargs):
with self.retrieved.open(result_json) as fh:
result_dict = json.load(fh)

volume_value = result_dict["volume_value"]
area_value = result_dict["area_value"]
volume_flux = result_dict["volume_flux"]
area_flux = result_dict["area_flux"]
particle_size = result_dict["particle_size"]

results = ArrayData()
results.set_array("volume_flux", np.array(volume_value))
results.set_array("area_flux", np.array(area_value))
results.set_array("volume_flux", np.array(volume_flux))
results.set_array("area_flux", np.array(area_flux))
results.set_array("particle_size", np.array(particle_size))
self.out("output", results)

Expand Down

0 comments on commit 094db6c

Please sign in to comment.