Skip to content

Update to use recent MIKE IO and ModelSkill#8

Merged
ecomodeller merged 9 commits intomainfrom
modelskill
Mar 17, 2025
Merged

Update to use recent MIKE IO and ModelSkill#8
ecomodeller merged 9 commits intomainfrom
modelskill

Conversation

@ecomodeller
Copy link
Copy Markdown
Member

@ecomodeller ecomodeller commented Mar 3, 2025

As requested by @jaadhi.

@ecomodeller ecomodeller requested a review from jsmariegaard March 3, 2025 16:38
@jaadhi
Copy link
Copy Markdown
Collaborator

jaadhi commented Mar 14, 2025

Hi Jesper, would you have time to take a look next week?
@jsmariegaard

@jsmariegaard
Copy link
Copy Markdown
Member

Hi Jesper, would you have time to take a look next week? @jsmariegaard

Yes - maybe even today

Copy link
Copy Markdown
Member

@jsmariegaard jsmariegaard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a million for upgrading FMDAp, @ecomodeller

I think it is fine to merge as is, but the pfs parsing will now only work for FemEngineHD (as noted below). I tried to add a test for it but then bumped into a MIKE IO bug which I have now reported DHI/mikeio#801

In a future PR it would also be good to update to pyproject.toml instead of setup.py. I will add this as an issue instead.

fmdap/pfs.py Outdated
self.data = pfs.data # PfsSection
self.d = pfs.data.to_dict() # dictionary
pfs = mikeio.PfsDocument(pfs_file)
self.d = pfs.FemEngineHD.to_dict() # dictionary
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only "FemEngineHD" here? "FemEngine" and "FemEngineSW" should work as well

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be done with

self.d = pfs.targets[0].to_dict()

If you want check if it is actually a FemEngine you could

if not "FemEngine" in self.names[0]:
    raise ...

"'DATA_ASSIMILATION_MODULE' section could not be found in pfs file!"
)
DA_type = d.get("METHOD", {}).get("type", 0)
d = mikeio.read_pfs(pfs_file).FemEngineHD.DATA_ASSIMILATION_MODULE
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only "FemEngineHD" here? "FemEngine" and "FemEngineSW" should work as well

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it is possible to use the alias mikeio.read_pfs(pfs_file).DA

@ecomodeller ecomodeller merged commit 6093d87 into main Mar 17, 2025
3 checks passed
@ecomodeller ecomodeller deleted the modelskill branch March 17, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants