Skip to content

Commit

Permalink
Added N2, O2, and Argon calculated concentrations to the WACCM initia…
Browse files Browse the repository at this point in the history
…l conditions (#266)

* Added pararms for writing CSV and JSON diagnostic output. Include [units] in CSV.

* Added N2, O2, and Argon caculated for WACCM temperature and pressure.

---------

Co-authored-by: carl-drews <[email protected]>
  • Loading branch information
carl-drews and carl-drews authored Oct 15, 2024
1 parent 19ba97d commit 46f43a0
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/acom_music_box/tools/waccmToMusicBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,17 @@ def readWACCM(waccmMusicaDict, latitude, longitude,
return (musicaDict)


# Add molecular Nitrogen, Oxygen, and Argon to dictionary.
# varValues = already read from WACCM, contains (name, concentration, units)
# return varValues with N2, O2, and Ar added
def addStandardGases(varValues):
varValues["N2"] = ("N2", 0.78084, "mol/mol") # standard fraction by volume
varValues["O2"] = ("O2", 0.20946, "mol/mol")
varValues["Ar"] = ("Ar", 0.00934, "mol/mol")

return(varValues)


# set up indexes for the tuple
musicaIndex = 0
valueIndex = 1
Expand All @@ -228,8 +239,6 @@ def readWACCM(waccmMusicaDict, latitude, longitude,
# Perform any numeric conversion needed.
# varDict = originally read from WACCM, tuples are (musicaName, value, units)
# return varDict with values modified


def convertWaccm(varDict):
# from the supporting documents
# https://agupubs.onlinelibrary.wiley.com/action/downloadSupplement?doi=10.1029%2F2019MS001882&file=jame21103-sup-0001-2019MS001882+Text_SI-S01.pdf
Expand Down Expand Up @@ -435,6 +444,9 @@ def main():
lat, lon, when, waccmDir, waccmFilename)
logger.info(f"Original WACCM varValues = {varValues}")

# add molecular Nitrogen, Oxygen, and Argon
varValues = addStandardGases(varValues)

# Perform any conversions needed, or derive variables.
varValues = convertWaccm(varValues)
logger.info(f"Converted WACCM varValues = {varValues}")
Expand Down

0 comments on commit 46f43a0

Please sign in to comment.