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

Multiline obs/crs files are not parsed correctly #485

Open
veenstrajelmer opened this issue Mar 28, 2023 · 2 comments
Open

Multiline obs/crs files are not parsed correctly #485

veenstrajelmer opened this issue Mar 28, 2023 · 2 comments
Labels
priority: high type: bug Something isn't working type: compatibility Changes needed to be compatible with the computational core

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Mar 28, 2023

There was a multiline method implemented in kernel+GUI with \ as a separator, to be used for obs/crs files and maybe others. This is an example snippet from the mdu:

ObsFile   = ../../../geometry/output_locations_v2b/rmm_vzm-j19_6-v2b_1_kilometer_obs.xyn \ # Points file *.xyn with observation stations with rows x, y, station name
            ../../../geometry/output_locations_v2b/rmm_vzm-j19_6-v2b_2_output_obs.xyn \
            ../../../geometry/output_locations_v2b/rmm_vzm-j19_6-v2b_3_measurement_obs.xyn                                      
CrsFile   = ../../../geometry/cross_sections_v2b/rmm_vzm-j19_6-v2b_2_output_crs.pli \ # Polyline file *_crs.pli defining observation cross sections
            ../../../geometry/cross_sections_v2b/rmm_vzm-j19_6-v2b_3_measurement_crs.pli \
            ../../../geometry/cross_sections_v2b/rmm_vzm-j19_6-v2b_4_calibration_crs.pli 

hydrolib-core does not support this and raises the following:

ValidationError: 2 validation errors for FMModel
RMM_VZM_commented.mdu -> output -> crsFile -> 1
  File: `\\directory.intra\Project\` not found, skipped parsing. (type=value_error)
RMM_VZM_commented.mdu -> output -> crsFile -> 1
  File: `\\directory.intra\Project\` not found, skipped parsing. (type=value_error)

This happens for the \ at the end of the line, which makes sense to me and I wonder whether it should be supported or removed from kernel+gui instead. The latter makes more sense to me since I expect this is non-standard ini-formatting.

Additional information

OpenDA also crashes on this type of input

And a fun fact, the FM kernel crashes on too long space-delimited input (but only for crs, obs works fine):

ObsFile                             = ../../../geometry/output_locations_v2b/rmm_vzm-j19_6-v2b_1_kilometer_obs.xyn  ../../../geometry/output_locations_v2b/rmm_vzm-j19_6-v2b_2_output_obs.xyn                                        ../../../geometry/output_locations_v2b/rmm_vzm-j19_6-v2b_3_measurement_obs.xyn                                      
CrsFile                             = ../../../geometry/cross_sections_v2b/rmm_vzm-j19_6-v2b_2_output_crs.pli  ../../../geometry/cross_sections_v2b/rmm_vzm-j19_6-v2b_3_measurement_crs.pli                                        ../../../geometry/cross_sections_v2b/rmm_vzm-j19_6-v2b_4_calibration_crs.pli 

Gives:

** ERROR  : Observation cross section file '../../../geometry/cross_sections_v2b/rmm_vzm-j19_6-v2b_4_calibrati' not found!
@arthurvd
Copy link
Member

arthurvd commented Mar 31, 2023

@veenstrajelmer : You're quite right, I can see that in the kernel code:

    character(len=1024):: md_obsfile       = ' ' !< File containing observation points  (e.g., *_obs.xyn, *_obs.ini)
    character(len=255) :: md_crsfile       = ' ' !< File containing cross sections (e.g., *_crs.pli, observation cross section *_crs.ini)   

Will fix it over there --> https://issuetracker.deltares.nl/browse/UNST-6813

@arthurvd arthurvd added the type: question Further information is requested label Mar 31, 2023
@veenstrajelmer
Copy link
Collaborator Author

I have tested the behaviour when a file is given with multiline obs/crs files, but without \, so like this:

ObsFile                             = ../../../geometry/output_locations_v2b/rmm_vzm-j19_6-v2b_1_kilometer_obs.xyn # Points file *.xyn with observation stations with rows x, y, station name
                                      ../../../geometry/output_locations_v2b/rmm_vzm-j19_6-v2b_2_output_obs.xyn
                                      ../../../geometry/output_locations_v2b/rmm_vzm-j19_6-v2b_3_measurement_obs.xyn                                      

In this case, only the first filename is being read. I would expect a parsing error since the lines below should fail to read somewhere. Since they are not comments, I would say it should raise an error.

@priscavdsluis priscavdsluis added type: bug Something isn't working type: compatibility Changes needed to be compatible with the computational core priority: high and removed type: question Further information is requested labels Apr 9, 2024
@rhutten rhutten added this to To do in HYDROLIB-core via automation Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high type: bug Something isn't working type: compatibility Changes needed to be compatible with the computational core
Projects
HYDROLIB-core
  
To do
Development

No branches or pull requests

3 participants