Skip to content
Snippets Groups Projects
Commit a541138e authored by Nick Bearson's avatar Nick Bearson
Browse files

Merge branch '19-fix-help-text-returning-a-different-internal-script-name' into 'master'

make our help text return the name of the script that was actually called

Closes #19

See merge request !8
parents 77e5930c 5f2f6429
No related branches found
No related tags found
1 merge request!8make our help text return the name of the script that was actually called
...@@ -29,4 +29,5 @@ fi ...@@ -29,4 +29,5 @@ fi
source $CSPP_GEO_GGLM_HOME/libexec/env.sh source $CSPP_GEO_GGLM_HOME/libexec/env.sh
# Call the python module to do the processing, passing all arguments # Call the python module to do the processing, passing all arguments
export PROG_NAME="${BASH_SOURCE[0]}"
python3 $CSPP_GEO_GGLM_HOME/libexec/_make_glm_grids.py "$@" python3 $CSPP_GEO_GGLM_HOME/libexec/_make_glm_grids.py "$@"
...@@ -29,4 +29,5 @@ fi ...@@ -29,4 +29,5 @@ fi
source $CSPP_GEO_GGLM_HOME/libexec/env.sh source $CSPP_GEO_GGLM_HOME/libexec/env.sh
# Call the python module to do the processing, passing all arguments # Call the python module to do the processing, passing all arguments
export PROG_NAME="${BASH_SOURCE[0]}"
python3 $CSPP_GEO_GGLM_HOME/libexec/_minute_gridder.py "$@" python3 $CSPP_GEO_GGLM_HOME/libexec/_minute_gridder.py "$@"
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# This example was provided by GLMTools # This example was provided by GLMTools
# https://github.com/deeplycloudy/glmtools/blob/master/examples/grid/make_GLM_grids.py # https://github.com/deeplycloudy/glmtools/blob/master/examples/grid/make_GLM_grids.py
import argparse import argparse
import sys
parse_desc = """Grid GLM flash data. The start and end times can be specified parse_desc = """Grid GLM flash data. The start and end times can be specified
independently, or if not provided they will be inferred from the filenames. independently, or if not provided they will be inferred from the filenames.
...@@ -24,7 +25,8 @@ structure by specifying a path like so: -o ...@@ -24,7 +25,8 @@ structure by specifying a path like so: -o
{start_time:%%Y/%%b/%%d}/{dataset_name}""" {start_time:%%Y/%%b/%%d}/{dataset_name}"""
def create_parser(): def create_parser():
parser = argparse.ArgumentParser(description=parse_desc) prog = os.getenv('PROG_NAME', sys.argv[0])
parser = argparse.ArgumentParser(prog=prog, description=parse_desc)
parser.add_argument(dest='filenames',metavar='filename', nargs='*') parser.add_argument(dest='filenames',metavar='filename', nargs='*')
parser.add_argument('-o', '--output_path', parser.add_argument('-o', '--output_path',
metavar='filename template including path', metavar='filename template including path',
......
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
parse_desc = """Create one minute NetCDF4 grids (and, optionally, AWIPS-compatible tiles) from GLM flash data. parse_desc = """Create one minute NetCDF4 grids (and, optionally, AWIPS-compatible tiles) from GLM flash data.
Example usage:\n Example usage:
cspp-geo-gglm.sh \\
%(prog)s \\
--goes-sector conus \\ --goes-sector conus \\
--create-tiles \\ --create-tiles \\
-vv \\ -vv \\
...@@ -37,7 +38,10 @@ log = logging.getLogger(__name__) ...@@ -37,7 +38,10 @@ log = logging.getLogger(__name__)
def create_parser(): def create_parser():
import argparse import argparse
parser = argparse.ArgumentParser(description=parse_desc, formatter_class=argparse.RawTextHelpFormatter) # RawTextHelpFormatter preserves our newlines in the example usage message prog = os.getenv('PROG_NAME', sys.argv[0])
parser = argparse.ArgumentParser(prog=prog,
description=parse_desc,
formatter_class=argparse.RawTextHelpFormatter) # RawTextHelpFormatter preserves our newlines in the example usage message
parser.add_argument('-v', '--verbose', dest='verbosity', action="count", default=0, parser.add_argument('-v', '--verbose', dest='verbosity', action="count", default=0,
help="each occurrence increases verbosity 1 level through ERROR-WARNING-INFO-DEBUG\n" help="each occurrence increases verbosity 1 level through ERROR-WARNING-INFO-DEBUG\n"
"(default: ERROR)") "(default: ERROR)")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment