Skip to content

Commit

Permalink
try to fix path issues now having created init files
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-a-a committed Oct 29, 2024
1 parent 6d29750 commit 275acf7
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions watertap/unit_models/tests/test_surrogate_crystallizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,22 @@ def add_crystallizer_rbf_model(
block_name = "crystallizer_surrogate" + "_" + filename[sm]
blk.add_component(block_name, SurrogateBlock(concrete=True))
surrogate_name = f"{filename[sm]}.json"
with importlib.resources.path(
"watertap.data.surrogate_defaults.surrogate_crystallizer_defaults",
# with importlib.resources.path(
# "watertap.data.surrogate_defaults.surrogate_crystallizer_defaults",
# surrogate_name,
# ) as json_path:
# current_surrogate = PysmoSurrogate.load_from_file(str(json_path))
surrogate_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"..",
"..",
"data",
"surrogate_defaults",
"surrogate_crystallizer_defaults",
surrogate_name,
) as json_path:
current_surrogate = PysmoSurrogate.load_from_file(str(json_path))
)
current_surrogate = PysmoSurrogate.load_from_file(surrogate_path)

getattr(blk, block_name).build_model(
current_surrogate,
input_vars=crystallizer_inputs,
Expand Down

0 comments on commit 275acf7

Please sign in to comment.