Skip to content

Commit

Permalink
Merge branch 'onerun' of https://github.com/USGS-CMG/stglib into onerun
Browse files Browse the repository at this point in the history
  • Loading branch information
dnowacki-usgs committed Aug 27, 2024
2 parents 199365e + eb7ffd2 commit 6802d52
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 65 deletions.
147 changes: 89 additions & 58 deletions stglib/core/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,73 +27,104 @@ def ncarg(parser):
parser.add_argument("ncname", help="processed .nc filename")


def runots_parser():
description = "Run ocean time-series processing system."
parser = argparse.ArgumentParser(description=description)
subparsers = parser.add_subparsers(
title="instruments",
required=True,
dest="instrument",
)

# subparsers.add_parser("aqdhdr2cdf", parents=[aqdhdr2cdf_parser()], add_help=False)
# subparsers.add_parser("aqdcdf2nc", parents=[aqdcdf2nc_parser()], add_help=False)
inst = subparsers.add_parser("aqd", add_help=False)
instsp = inst.add_subparsers(
title="steps",
required=True,
dest="step",
)
instsp.add_parser("hdr2cdf", parents=[inst2cdf_parser()], add_help=False)
def addcdf2nc(instsp):
instsp.add_parser("cdf2nc", parents=[cdf2nc_parser()], add_help=False)

inst = subparsers.add_parser("vec", add_help=False)
instsp = inst.add_subparsers(
title="steps",
required=True,
dest="step",
)
instsp.add_parser("dat2cdf", parents=[inst2cdf_parser()], add_help=False)
instsp.add_parser("cdf2nc", parents=[cdf2nc_parser()], add_help=False)
instsp.add_parser("nc2waves", parents=[nc2waves_parser()], add_help=False)

inst = subparsers.add_parser("wvs", add_help=False)
instsp = inst.add_subparsers(
title="steps",
required=True,
dest="step",
)
instsp.add_parser("wad2cdf", parents=[inst2cdf_parser()], add_help=False)
instsp.add_parser("cdf2nc", parents=[cdf2nc_parser()], add_help=False)
def addnc2waves(instsp):
instsp.add_parser("nc2waves", parents=[nc2waves_parser()], add_help=False)

inst = subparsers.add_parser("rbr", add_help=False)
instsp = inst.add_subparsers(
title="steps",
required=True,
dest="step",
)
instsp.add_parser("csv2cdf", parents=[inst2cdf_parser()], add_help=False)
instsp.add_parser("cdf2nc", parents=[cdf2nc_parser()], add_help=False)
instsp.add_parser("nc2waves", parents=[nc2waves_parser()], add_help=False)

inst = subparsers.add_parser("hobo", add_help=False)
instsp = inst.add_subparsers(
title="steps",
required=True,
dest="step",
)
instsp.add_parser("csv2cdf", parents=[inst2cdf_parser()], add_help=False)
instsp.add_parser("cdf2nc", parents=[cdf2nc_parser()], add_help=False)
def addinst2cdf(instsp, action):
instsp.add_parser(action, parents=[inst2cdf_parser()], add_help=False)


def add_instrument(subparsers, instrument):
inst = subparsers.add_parser(instrument, add_help=False)
instsp = inst.add_subparsers(title="steps", required=True, dest="step")
return instsp

inst = subparsers.add_parser("iq", add_help=False)
instsp = inst.add_subparsers(
title="steps",

def runots_parser():
description = "Run USGS CMHRP ocean time-series data processing system."
parser = argparse.ArgumentParser(description=description)
subparsers = parser.add_subparsers(
title="instruments",
required=True,
dest="step",
dest="instrument",
)
instsp.add_parser("mat2cdf", parents=[inst2cdf_parser()], add_help=False)
instsp.add_parser("cdf2nc", parents=[cdf2nc_parser()], add_help=False)

instsp = add_instrument(subparsers, "aqd")
addinst2cdf(instsp, "hdr2cdf")
addcdf2nc(instsp)

instsp = add_instrument(subparsers, "aqdhr")
addinst2cdf(instsp, "hdr2cdf")
addcdf2nc(instsp)

instsp = add_instrument(subparsers, "wvs")
addinst2cdf(instsp, "wad2cdf")
addcdf2nc(instsp)
addnc2waves(instsp)

instsp = add_instrument(subparsers, "rbr")
addinst2cdf(instsp, "csv2cdf")
addcdf2nc(instsp)
addnc2waves(instsp)

instsp = add_instrument(subparsers, "sig")
addinst2cdf(instsp, "mat2cdf")
addcdf2nc(instsp)

instsp = add_instrument(subparsers, "vec")
addinst2cdf(instsp, "dat2cdf")
addcdf2nc(instsp)
addnc2waves(instsp)

instsp = add_instrument(subparsers, "eco")
addinst2cdf(instsp, "csv2cdf")
addcdf2nc(instsp)

instsp = add_instrument(subparsers, "eofe")
addinst2cdf(instsp, "log2cdf")
addcdf2nc(instsp)

instsp = add_instrument(subparsers, "exo")
addinst2cdf(instsp, "csv2cdf")
addcdf2nc(instsp)

instsp = add_instrument(subparsers, "hobo")
addinst2cdf(instsp, "csv2cdf")
addcdf2nc(instsp)

instsp = add_instrument(subparsers, "iq")
addinst2cdf(instsp, "mat2cdf")
addcdf2nc(instsp)

instsp = add_instrument(subparsers, "lisst")
addinst2cdf(instsp, "csv2cdf")
addcdf2nc(instsp)

instsp = add_instrument(subparsers, "mc")
addinst2cdf(instsp, "asc2cdf")
addcdf2nc(instsp)

instsp = add_instrument(subparsers, "sg")
addinst2cdf(instsp, "tid2cdf")
addcdf2nc(instsp)
addnc2waves(instsp)

instsp = add_instrument(subparsers, "tcm")
addinst2cdf(instsp, "csv2cdf")
addcdf2nc(instsp)

instsp = add_instrument(subparsers, "troll")
addinst2cdf(instsp, "csv2cdf")
addcdf2nc(instsp)

instsp = add_instrument(subparsers, "wxt")
addinst2cdf(instsp, "csv2cdf")
addcdf2nc(instsp)

return parser

Expand Down
71 changes: 64 additions & 7 deletions stglib/core/runcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,12 @@ def runots():
runaqdhdr2cdf(args)
elif args.step == "cdf2nc":
runaqdcdf2nc(args)
elif args.instrument == "vec":
if args.step == "dat2cdf":
runvecdat2cdf(args)
if args.instrument == "aqdhr":
if args.step == "hdr2cdf":
runaqdhrhdr2cdf(args)
elif args.step == "cdf2nc":
runveccdf2nc(args)
elif args.step == "nc2waves":
runvecnc2waves(args)
elif args.instrument == "wvs":
runaqdhrcdf2nc(args)
elif args.instrument in ["aqdwvs", "wvs"]:
if args.step == "wad2cdf":
runwvsdat2cdf(args)
elif args.step == "cdf2nc":
Expand All @@ -401,6 +399,33 @@ def runots():
runrskcdf2nc(args)
elif args.step == "nc2waves":
runrsknc2waves(args)
elif args.instrument == "sig":
if args.step == "mat2cdf":
runsigmat2cdf(args)
elif args.step == "cdf2nc":
runsigcdf2nc(args)
elif args.instrument == "vec":
if args.step == "dat2cdf":
runvecdat2cdf(args)
elif args.step == "cdf2nc":
runveccdf2nc(args)
elif args.step == "nc2waves":
runvecnc2waves(args)
elif args.instrument == "eco":
if args.step == "csv2cdf":
runecocsv2cdf(args)
elif args.step == "cdf2nc":
runecocdf2nc(args)
elif args.instrument == "eofe":
if args.step == "log2cdf":
runeofelog2cdf(args)
elif args.step == "cdf2nc":
runeofecdf2nc(args)
elif args.instrument == "exo":
if args.step == "csv2cdf":
runexomat2cdf(args)
elif args.step == "cdf2nc":
runexocdf2nc(args)
elif args.instrument == "hobo":
if args.step == "csv2cdf":
runhobocsv2cdf(args)
Expand All @@ -411,3 +436,35 @@ def runots():
runiqmat2cdf(args)
elif args.step == "cdf2nc":
runiqcdf2nc(args)
elif args.instrument == "lisst":
if args.step == "csv2cdf":
runlisstcsv2cdf(args)
elif args.step == "cdf2nc":
runlisstcdf2nc(args)
elif args.instrument == "mc":
if args.step == "asc2cdf":
runmcasc2cdf(args)
elif args.step == "cdf2nc":
runmccdf2nc(args)
elif args.instrument == "sg":
if args.step == "tid2cdf":
runsgtid2cdf(args)
elif args.step == "cdf2nc":
runsgcdf2nc(args)
elif args.step == "nc2waves":
runsgnc2waves(args)
elif args.instrument == "tcm":
if args.step == "csv2cdf":
runtcmcsv2cdf(args)
elif args.step == "cdf2nc":
runtcmcdf2nc(args)
elif args.instrument == "troll":
if args.step == "csv2cdf":
runtrollcsv2cdf(args)
elif args.step == "cdf2nc":
runtrollcdf2nc(args)
elif args.instrument == "wxt":
if args.step == "csv2cdf":
runwxtcsv2cdf(args)
elif args.step == "cdf2nc":
runwxtcdf2nc(args)

0 comments on commit 6802d52

Please sign in to comment.