Skip to content
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

Writing a onedfieldfile into an inifieldmodel only possible with full absolute path #616

Open
RuudHurkmans opened this issue Mar 1, 2024 · 0 comments
Labels

Comments

@RuudHurkmans
Copy link
Collaborator

Problem

The objective is to write a uniform initial water depth to a model by referencing it in the inifieldfile.

I understand that eventually this should be possible:

for ifield, onedfield in enumerate(models.onedfieldmodels):
    fm.geometry.inifieldfile.initial[ifield].datafile = OneDFieldModel(global_=onedfield)

where models.onedfieldmodels is a list containing (in this case) a OneDFieldGlobal-object.

This is, however, not implemented (yet) and this is the workaround I use:

  onedfield_filepath = output_path / "fm" / Path("initialwaterdepth.ini")
  onedfieldmodel = OneDFieldModel(global_=onedfield)
  onedfieldmodel.save(filepath=onedfield_filepath)
  fm.geometry.inifieldfile.initial[ifield].datafile = DiskOnlyFileModel(
      filepath=onedfield_filepath
  )

which works, but the full absolute path of initialwaterdepth.ini is incuded in inifieldfile.ini, which is unfortunate when one transfers the model. Or, without including a path, it is written in the current working directory.

Expected outcome
Ideally, the onedfieldfile is written in the designated output folder, along with inifield.ini, but without including the full path.

Is it possible to implement the first solution in the next release? Or is there a solution to prevent writing the full path to inifield.ini?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants