Skip to content

Update to use recent MIKE IO and ModelSkill #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 17, 2025
Merged

Conversation

ecomodeller
Copy link
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
Collaborator

jaadhi commented Mar 14, 2025

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

@jsmariegaard
Copy link
Member

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

Yes - maybe even today

Copy link
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
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
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
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
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