From 9077685b14905bce091283a68abae921115e2a86 Mon Sep 17 00:00:00 2001 From: adityakiran1423 Date: Mon, 25 Nov 2024 17:39:29 +0530 Subject: [PATCH 1/2] appended National Science Foundation wherever required --- README.md | 2 +- src/acom_music_box/tools/waccmToMusicBox.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 019c866..de7b3ef 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ MusicBox: A MUSICA model for boxes and columns. [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14008358.svg)](https://doi.org/10.5281/zenodo.14008358) -Copyright (C) 2020 National Center for Atmospheric Research +Copyright (C) 2020 National Science Foundation - National Center for Atmospheric Research # Installation ``` diff --git a/src/acom_music_box/tools/waccmToMusicBox.py b/src/acom_music_box/tools/waccmToMusicBox.py index c93a8f0..08fef4c 100644 --- a/src/acom_music_box/tools/waccmToMusicBox.py +++ b/src/acom_music_box/tools/waccmToMusicBox.py @@ -4,7 +4,7 @@ # and convert to initial conditions for MusicBox (case TS1). # # Author: Carl Drews -# Copyright 2024 by Atomospheric Chemistry Observations & Modeling (UCAR/ACOM) +# Copyright 2024 by Atmospheric Chemistry Observations & Modeling (UCAR/ACOM) # import os import argparse From 142f88ebfb9511a78610bfa16b56b8dea97abaa2 Mon Sep 17 00:00:00 2001 From: adityakiran1423 Date: Mon, 25 Nov 2024 18:46:53 +0530 Subject: [PATCH 2/2] fixed indentation, won't cause IndentationError --- .../electron_configuration_reader.py | 120 +++++++++--------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/acom_music_box/connections/electron_configuration_reader.py b/src/acom_music_box/connections/electron_configuration_reader.py index 51ca14e..0fe50c2 100644 --- a/src/acom_music_box/connections/electron_configuration_reader.py +++ b/src/acom_music_box/connections/electron_configuration_reader.py @@ -10,73 +10,41 @@ class ElectronConfiguraitonReader: """ Reads configuration information from the electron applicant to create a box model simulation. """ - def __init__(self): - self.box_model_options = None - self.species_list = None - self.reaction_list = None - self.initial_conditions = None - self.evolving_conditions = None + def __init__(self): + self.box_model_options = None + self.species_list = None + self.reaction_list = None + self.initial_conditions = None + self.evolving_conditions = None - def read_electron_configuration(self): - with open(self.electron_configuration_file_path, 'r') as file: - for line in file: - element, configuration = line.strip().split(' ') - self.electron_configuration[element] = configuration + def read_electron_configuration(self): + with open(self.electron_configuration_file_path, 'r') as file: + for line in file: + element, configuration = line.strip().split(' ') + self.electron_configuration[element] = configuration - def get_electron_configuration(self, element): - return self.electron_configuration[element] + def get_electron_configuration(self, element): + return self.electron_configuration[element] - def readFromUIJson(self, path_to_json): - """ - Reads and parses a JSON file from the MusicBox Interactive UI to set up the box model simulation. + def readFromUIJson(self, path_to_json): + """ + Reads and parses a JSON file from the MusicBox Interactive UI to set up the box model simulation. - This function takes the path to a JSON file, reads the file, and parses the JSON - to set up the box model simulation. + This function takes the path to a JSON file, reads the file, and parses the JSON + to set up the box model simulation. - Args: - path_to_json (str): The path to the JSON file from the UI. + Args: + path_to_json (str): The path to the JSON file from the UI. - Returns: - None + Returns: + None - Raises: - ValueError: If the JSON file cannot be read or parsed. - """ + Raises: + ValueError: If the JSON file cannot be read or parsed. + """ - with open(path_to_json, 'r') as json_file: - data = json.load(json_file) - - # Set box model options - self.box_model_options = BoxModelOptions.from_UI_JSON(data) - - # Set species list - self.species_list = SpeciesList.from_UI_JSON(data) - - # Set reaction list - self.reaction_list = ReactionList.from_UI_JSON( - data, self.species_list) - - # Set initial conditions - self.initial_conditions = Conditions.from_UI_JSON( - data, self.species_list, self.reaction_list) - - # Set evolving conditions - self.evolving_conditions = EvolvingConditions.from_UI_JSON( - data, self.species_list, self.reaction_list) - - def readFromUIJsonString(self, data): - """ - Reads and parses a JSON string from the MusicBox Interactive UI to set up the box model simulation. - - Args: - json_string (str): The JSON string from the UI. - - Returns: - None - - Raises: - ValueError: If the JSON string cannot be parsed. - """ + with open(path_to_json, 'r') as json_file: + data = json.load(json_file) # Set box model options self.box_model_options = BoxModelOptions.from_UI_JSON(data) @@ -85,7 +53,8 @@ def readFromUIJsonString(self, data): self.species_list = SpeciesList.from_UI_JSON(data) # Set reaction list - self.reaction_list = ReactionList.from_UI_JSON(data, self.species_list) + self.reaction_list = ReactionList.from_UI_JSON( + data, self.species_list) # Set initial conditions self.initial_conditions = Conditions.from_UI_JSON( @@ -94,3 +63,34 @@ def readFromUIJsonString(self, data): # Set evolving conditions self.evolving_conditions = EvolvingConditions.from_UI_JSON( data, self.species_list, self.reaction_list) + + def readFromUIJsonString(self, data): + """ + Reads and parses a JSON string from the MusicBox Interactive UI to set up the box model simulation. + + Args: + json_string (str): The JSON string from the UI. + + Returns: + None + + Raises: + ValueError: If the JSON string cannot be parsed. + """ + + # Set box model options + self.box_model_options = BoxModelOptions.from_UI_JSON(data) + + # Set species list + self.species_list = SpeciesList.from_UI_JSON(data) + + # Set reaction list + self.reaction_list = ReactionList.from_UI_JSON(data, self.species_list) + + # Set initial conditions + self.initial_conditions = Conditions.from_UI_JSON( + data, self.species_list, self.reaction_list) + + # Set evolving conditions + self.evolving_conditions = EvolvingConditions.from_UI_JSON( + data, self.species_list, self.reaction_list)