NCAR / music-box

A box/column model using MICM chemistry
https://ncar.github.io/music-box/branch/main/
Apache License 2.0
14 stars 9 forks source link

MusicBox configurations from Greg Michalski #176

Open carl-drews opened 1 month ago

carl-drews commented 1 month ago

From: Carl Drews drews@ucar.edu Date: Tue, Jul 30, 2024 at 8:00 PM Subject: MusicBox configurations from Greg Michalski To: Matthew Dawson mattdawson@ucar.edu Cc: Kyle Shores kshores@ucar.edu

Matt and Kyle -

I am finding quite a few errors in the configuration files that Greg sent us. Here is how one of them shows up:

INFO:acom_music_box.music_box_main:myBox.solver = <musica.MICM object at 0x000001EF5917C9B0> Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\drews\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts\music_box.exe__main__.py", line 7, in File "C:\Users\drews\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\acom_music_box\music_box_main.py", line 82, in main mySolution = myBox.solve(os.path.join(musicBoxOutputDir, "mySolution.csv")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\drews\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\acom_music_box\music_box.py", line 483, in solve ordered_concentrations = self.order_species_concentrations(curr_conditions, species_constant_ordering) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\drews\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\acom_music_box\music_box.py", line 720, in order_species_concentrations ordered_concentrations[species_constant_ordering[key]] = value


IndexError: list assignment index out of range

C:\2024\MusicBox\GregMichalski>

We may need to think about some kind of friendly error-checking for the JSON configs.

Carl
carl-drews commented 1 month ago

This file: C:\2024\MusicBox\GregMichalski\config2\camp_data\config.json

Had references to: "camp_data/tolerance.json",

But that is wrong. File paths here are relative here, and the camp_data is redundant.

In music_box_reaction_list.py, line 77: #assumes reactions file is second in the list To do: Fix this! if(len(config['camp-files']) > 1): reaction_file_path = os.path.dirname(config_file_path) + "/" + config['camp-files'][1]

Work-around for now: Re-order the files so that reactions.json is listed second.

species.json line 7 "description": "Third-body molecule. This is any molecule present in the system." RuntimeError: Error creating solver: Non-standard key 'description' found in object{"description":"Third-body molecule. This is any molecule present in the system.","name":"M","tracer type":"CONSTANT","type":"CHEM_SPEC"}: Contains non-standard key

Solution: Delete the description. Note that JSON does not support comments.

carl-drews commented 1 month ago

Here is the revised order in C:\2024\MusicBox\music-box-interactive-api\interactive\api\static\examples\CHAPMAN\camp_data\config.json:

{ "camp-files" : [ "camp_data/species.json", "camp_data/reactions.json", "camp_data/tolerance.json" ] }