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

param out nml parsing issue #35

Open
dwr-psandhu opened this issue Jul 21, 2023 · 5 comments
Open

param out nml parsing issue #35

dwr-psandhu opened this issue Jul 21, 2023 · 5 comments

Comments

@dwr-psandhu
Copy link
Contributor

  • schimpy version: 1.6.6+
  • Python version: 3.8+
  • Operating System: windows

Description

param out nml file has a issue parsing arrays
CADWRDeltaModeling/BayDeltaSCHISM#37

dwr-psandhu added a commit that referenced this issue Jul 21, 2023
@dwr-psandhu
Copy link
Contributor Author

@water-e I think the issue from BayDeltaSchism#37 is a schimpy issue. I have opened this issue and committed a test case and test data using your attachments from that issue.
The testcase is passing as it is was meets my expectations. Please modify the testcase and make it fail so I know what to fix. See the commit above.

@water-e
Copy link
Contributor

water-e commented Jul 21, 2023

You are getting the same result as I am. Let me clarify the use case this obstructs.

I hope to diff two nml files. We previously talked about 'iof_hydro(1)' being a kind of text key, and when we parse the sample files from our templates or the schism samples this has a big benefit when it comes ot comments. The line
iof_hydro(1) = 1 !0: off; 1: on - elev. [m] {elevation} 2D
is very informative and self documenting, for instance.

By contrast, the param.out.nml version of the file looks like this:
IOF_HYDRO = 1, 16*0, 2*1, 5*0, 2*1, 14*0,
... and that not only is a different syntax, it produces a different key (iof_hydro vs iof_hydro(1) )

iof_hydro(1) = 1 
iof_hydro(2) = 0
iof_hydro(3) = 0
...

the two are different.

Perhaps we can detect (regex) a value that has commas and * and split:
iof_hydro: 1, 2*0
into the following representation in the dictionary

'iof_hydro(1)' : 1
'iof_hydro(2)' : 0
'iof_hydro(3)' : 0

@water-e
Copy link
Contributor

water-e commented Jul 21, 2023

Or allowing the parameter to be an array and inline comment to be an array would work and perhaps be a better representation.

@water-e
Copy link
Contributor

water-e commented Jul 21, 2023

I agree it is a schimpy issue. I think I've had the wrong web page open for this and some of the others. We can close these out and I'll be more careful.

@dwr-psandhu
Copy link
Contributor Author

Ok I have got it now

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

No branches or pull requests

2 participants