Add preproc to scripts pages

This commit is contained in:
wiltbemj
2024-06-21 16:46:15 -04:00
parent e69d06c3fa
commit e285815032
7 changed files with 93 additions and 17 deletions

View File

@@ -14,6 +14,7 @@ import os
import sys
sys.path.insert(0, os.path.abspath('../../kaipy'))
sys.path.insert(1, os.path.abspath('../../kaipy/scripts/quicklook'))
sys.path.insert(2, os.path.abspath('../../kaipy/scripts/preproc'))
# -- Project information -----------------------------------------------------

View File

@@ -59,6 +59,31 @@ The quicklook directory has scripts that are used to quickly look at the data. T
.. autoprogram:: vizTrj:create_command_line_parser()
:prog: vizTrj.py
Preprocessing
-------------
The preprocessing directory has scripts that are used to setup MAGE simulations including grid generation and solar wind input file. The scripts are:
.. autoprogram:: cda2wind:create_command_line_parser()
:prog: cda2wind.py
.. autoprogram:: genLFM:create_command_line_parser()
:prog: genLFM.py
.. autoprogram:: genRCM:create_command_line_parser()
:prog: genRCM.py
.. .. autoprogram:: INIGenerator:parse_args()
.. :prog: INIGenerator.py
.. .. autoprogram:: wsa2gamera:parser
.. :prog: wsa2gamera.py
.. .. autoprogram:: wsa2TDgamera:create_command_line_parser()
.. :prog: wsa2TDgamera.py
.. autoprogram:: XMLGenerator:create_command_line_parser()
:prog: XMLGenerator.py

View File

@@ -347,10 +347,15 @@ def create_xml_template(ini_file, xml_file):
print("\n\nTemplate creation complete!\n\n")
def create_command_line_parser():
"""Create the command-line argument parser.
if __name__ == "__main__":
"""Convert a .ini file to a .xml file."""
Create the parser for command-line arguments.
Returns:
argparse.ArgumentParser: Command-line argument parser for this script.
"""
#Defaults
# Create the command-line argument parser.
parser = argparse.ArgumentParser(description="Convert Kaiju .ini files to XML configuration or XML configuration template files.")
parser.add_argument("-t", dest="template", help="Path to .xml file as source template")
@@ -359,6 +364,13 @@ if __name__ == "__main__":
parser.add_argument("-d", "--debug", help="Activate debug mode", action="store_true")
parser.add_argument("-v", "--verbose", help="Activate verbose execution mode", action="store_true")
return parser
if __name__ == "__main__":
"""Convert a .ini file to a .xml file."""
# Set up the command-line parser.
parser = create_command_line_parser()
# Parse the commmand-line arguments.
args = parser.parse_args()

View File

@@ -91,7 +91,13 @@ def getPrevDayF107(t0):
return prevF107
if __name__ == "__main__":
def create_command_line_parser():
"""Create the command-line argument parser.
Returns:
argparse.ArgumentParser: Command-line argument parser for this script.
"""
#Defaults
fOut = "bcwind.h5"
mod = "LFM"
t0Str="2010-01-01T00:00:00"
@@ -105,8 +111,7 @@ if __name__ == "__main__":
doEps = False
#Usually f107 above 300 is not reliable. The daily value could be distorted by flare emissions even if the flare may only last a short time during a day.
maxf107 = 300.0
minMfast = 1.5
MainS = """ This script does several things:
1. Fetch OMNI data from CDAWeb between the specified times (must be at least 2 hours in length)
@@ -140,6 +145,14 @@ if __name__ == "__main__":
parser.add_argument('-f107', type=float,default=None,help="Set f10.7 value to use in bcwind file. Only used if no data available. (default: %(default)s)")
parser.add_argument('-kp', type=float,default=None,help="Set Kp value to use in bcwind file. Only used if no data available. (default: %(default)s)")
parser.add_argument('-safe', action='store_true',default=False,help="Run in SAFE mode. Does not create the h5 file if certain conditions are not met (default: %(default)s)")
return parser
if __name__ == "__main__":
#Defaults
maxf107 = 300.0
minMfast = 1.5
parser = create_command_line_parser()
#Finalize parsing
args = parser.parse_args()

View File

@@ -17,21 +17,21 @@ rParams = {
#"H": '<ring gid="lfm" doRing="T" Nr="16" Nc1="8" Nc2="16" Nc3="32" Nc4="32" Nc5="64" Nc6="64" Nc7="64" Nc8="64" Nc9="128" Nc10="128" Nc11="128" Nc12="128" Nc13="256" Nc14="256" Nc15="256" Nc16="256"/>'
def create_command_line_parser():
"""Create the command-line argument parser.
if __name__ == "__main__":
Create the parser for command-line arguments.
Returns:
argparse.ArgumentParser: Command-line argument parser for this script.
"""
#Defaults
#Arg parsing
Nc0 = 8 #Number of outer i cells to cut out from LFM grid (OCT)
fIn = "./lfmG"
doEpsY = True
TINY = 1.0e-8
Rin = 2.0
Rout = 0.0
#List of grids
gStrs = ['D','Q','O','H']
gLabs = ["Double","Quad","Oct","Hex"]
Nij0 = 48
Nk0 = 64
MainS = """Generates LFM-style HDF5 grid for Gamera
Grid types (gid)
@@ -49,6 +49,21 @@ if __name__ == "__main__":
parser.add_argument('-Rout',type=float,metavar="Rout",default=Rout ,help="Sunward outer radius (default: %(default)s)")
parser.add_argument('-vizG', action='store_true', default=False,help="Show 2D figure w/ ghosts (default: %(default)s)")
return parser
if __name__ == "__main__":
#Defaults asdf
Nc0 = 8 #Number of outer i cells to cut out from LFM grid (OCT)
fIn = "./lfmG"
doEpsY = True
TINY = 1.0e-8
gLabs = ["Double","Quad","Oct","Hex"]
gStrs = ['D','Q','O','H']
Nij0 = 48
Nk0 = 64
# Set up the command-line parser.
parser = create_command_line_parser()
#Finalize parsing
args = parser.parse_args()
gid = args.gid

View File

@@ -23,10 +23,15 @@ PFLAV = 2
EFUDGE = 1./3.
PFUDGE = 0.0
def create_command_line_parser():
"""Create the command-line argument parser.
if __name__ == "__main__":
Create the parser for command-line arguments.
#Arg parsing
Returns:
argparse.ArgumentParser: Command-line argument parser for this script.
"""
#Defaults
fOut = "rcmconfig.h5"
num_e = 39
num_p = 120
@@ -61,7 +66,12 @@ if __name__ == "__main__":
parser.add_argument('-maxKp', type=int,default=maxKp, help="Max. Kp index allowed in the electron wave model, integer only (default: %(default)s)")
parser.add_argument('-i', type=str,default=fOut,metavar="fIn", help="Input file name when addWM is true (default: %(default)s)")
return parser
if __name__ == "__main__":
# Set up the command-line parser.
parser = create_command_line_parser()
#Finalize parsing
args = parser.parse_args()
fOut = args.o

View File

@@ -1,6 +1,6 @@
alive_progress
astropy
#cartopy
cartopy
cdasws
configparser
h5py