Skip to content

Commit

Permalink
Use the same magics setup code also in test-render. Refs: #2
Browse files Browse the repository at this point in the history
  • Loading branch information
spanezz committed Aug 8, 2020
1 parent 3daa533 commit b5e8d0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions arkimaps
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ def main():

# Tell magics where it shuold take its default styles from
os.environ["MAGICS_STYLE_PATH"] = args.styles
# Tell magics not to print noisy banners
os.environ["MAGPLUS_QUIET"] = "1"

with workdir() as root:
# Dispatch input products into a work directory
Expand Down
13 changes: 10 additions & 3 deletions test-render
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,18 @@ def render(fname):


def main():
default_styles = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "styles"))
if not os.path.isdir(default_styles):
default_styles = "/usr/share/magics/styles/ecmwf"

parser = argparse.ArgumentParser(description="Render model maps")
parser.add_argument("--verbose", "-v", action="store_true", help="verbose output")
parser.add_argument("--debug", action="store_true", help="debug output")
parser.add_argument("--styles", metavar="dir", action="store", default=default_styles, help="styles directory")
parser.add_argument("files", nargs="+", help="files to render")

args = parser.parse_args()

# Tell magics not to print noisy banners
os.environ["MAGPLUS_QUIET"] = "1"

# Setup logging
FORMAT = "%(asctime)-15s %(levelname)s %(message)s"
if args.debug:
Expand All @@ -71,6 +73,11 @@ def main():
else:
logging.basicConfig(level=logging.WARN, stream=sys.stderr, format=FORMAT)

# Tell magics where it shuold take its default styles from
os.environ["MAGICS_STYLE_PATH"] = args.styles
# Tell magics not to print noisy banners
os.environ["MAGPLUS_QUIET"] = "1"

for fname in args.files:
render(fname)

Expand Down

0 comments on commit b5e8d0b

Please sign in to comment.