Skip to content

Added new argument to write json from mfile, added execution of argument to post processing#3287

Merged
timothy-nunn merged 10 commits intomainfrom
3286-i-want-a-way-to-convert-an-mfile-to-json-as-part-of-process-post-processing
Sep 13, 2024
Merged

Added new argument to write json from mfile, added execution of argument to post processing#3287
timothy-nunn merged 10 commits intomainfrom
3286-i-want-a-way-to-convert-an-mfile-to-json-as-part-of-process-post-processing

Conversation

@grmtrkngtn
Copy link
Copy Markdown
Collaborator

It is useful to have PROCESS dump the mfile to json for UQ work. I have added an argument to do this which is executed in postprocessing

@grmtrkngtn grmtrkngtn linked an issue Aug 14, 2024 that may be closed by this pull request
Copy link
Copy Markdown
Collaborator

@timothy-nunn timothy-nunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you add an integration test for this (maybe with a once through input file?):

  • Does running with this command produce a JSON file at the expected location with the expected name?
  • Does the JSON file contain valid JSON?
  • Does the JSON contain some outputs we would expect?

Comment thread process/main.py Outdated
# Check mfile exists, then plot
mfile = Path(self.args.mfile)
mfile_path = Path(self.args.mfile)
mfile_str = str(mfile.resolve())
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
mfile_str = str(mfile.resolve())
mfile_str = str(mfile_path.resolve())

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    if self.args.plot:
        # Check mfile exists, then plot
        mfile_path = Path(self.args.mfile)
        mfile_str = str(mfile_path.resolve())

Comment thread process/main.py Outdated
"-mj",
"--mfilejson",
action="store_true",
help="produce a json containing mfile data",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the help message slightly. Where does it write the JSON file, and with what name?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    parser.add_argument(
        "-mj",
        "--mfilejson",
        action="store_true",
        help="Produce a filled json from --mfile arg in working dir",
    )

Modified like this

@grmtrkngtn
Copy link
Copy Markdown
Collaborator Author

I addressed the changes, let me know if further improvements are needed.

@timothy-nunn timothy-nunn merged commit 33bb544 into main Sep 13, 2024
@grmtrkngtn grmtrkngtn deleted the 3286-i-want-a-way-to-convert-an-mfile-to-json-as-part-of-process-post-processing branch September 24, 2024 13:27
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.

Convert an mfile to json as part of PROCESS post-processing

2 participants