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

Validation not working for relative path #531

Open
veenstrajelmer opened this issue Apr 13, 2023 · 0 comments
Open

Validation not working for relative path #531

veenstrajelmer opened this issue Apr 13, 2023 · 0 comments
Labels
domain: validation type: enhancement Improvements to existing functionality

Comments

@veenstrajelmer
Copy link
Collaborator

Describe the bug
When providing a pli-file from a relative path as mdu.geometry.network, there is no validation error, while it it clearly wrong

To Reproduce

import os
import hydrolib.core.dflowfm as hcdfm

dir_output = r'.\test_model_folder' #this validates while it should not
#dir_output = r'c:\test_model_folder' #this correctly raises "OSError: [Errno -51] NetCDF: Unknown file format: b'c:\\test_model_folder\\test_model.pli'"

#create dummy file
if not os.path.exists(dir_output):
    os.mkdir(dir_output)
file_pli = os.path.join(dir_output,'test_model.pli')
with open(file_pli,'w') as f:
    f.write("""name
                1    2
                1.0    2.0
                3.0    4.0
                """)

mdu_file = os.path.join(dir_output, 'test_model.mdu')
mdu = hcdfm.FMModel()
mdu.geometry.netfile = file_pli
mdu.save(mdu_file)

Expected behavior
Also when providing a relative path, there should be an error that a pli file is not a correct network.

Version info (please complete the following information):

  • OS: Spyder
  • Version: main branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: validation type: enhancement Improvements to existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants