Commit 7620a1a4 authored by CEVAER's avatar CEVAER
Browse files

Added L2Ctolight.py

parent fa3a0a5d
#!/usr/bin/env python
import owi
import argparse
import sys
description = """Converts L2X path to nclight or nclight_L2M path."""
parser = argparse.ArgumentParser(description = description)
parser.add_argument("-p", "--paths", action="store", nargs="*", default=None, help="""Input string, containing a path to be converted into an Url.
If no string is given, the input string is taken on stdin (and can be multiple).
""")
parser.add_argument("-m", "--mode", action="store", default="sw", help="Product type : sw or gd or ll_gd")
parser.add_argument("-r", "--resolution", action="store", default=None, help="Resolution of returned product.")
args = parser.parse_args()
if args.paths is None:
lines = sys.stdin.readlines()
for l in lines:
print(owi.L2CtoLight(l.strip(), resolution=args.resolution, mode=args.mode))
else:
for l in args.paths:
print(owi.L2CtoLight(l.strip(), resolution=args.resolution, mode=args.mode))
......@@ -539,8 +539,10 @@ def L2CtoL2M(path, resolution):
else:
pathList = path
pathList = [p.replace("L2C", "L2M").replace("_CC_", "_CM_").replace("-cc-", "-cm-") if "nclight" not in p else
p.replace("nclight", "nclight_L2M").replace("-cc-", "-cm-") for p in pathList]
pathList = [p.replace("L2C", "L2M").replace("_CC_", "_CM_").replace("-cc-", "-cm-") if "nclight" not in p else p for p in pathList]
pathList = [p.replace("nclight", "nclight_L2M").replace("-cc-", "-cm-") if "nclight" in p and "nclight_L2M" not in p else p for p in pathList]
pathList = [p.split("/") for p in pathList]
for p in pathList:
filenameSplit = p[-1].split("-")
......
......@@ -10,7 +10,7 @@ setup(name='owi',
setup_requires=['setuptools_scm'],
packages=['owi'],
zip_safe=False,
scripts=['bin/owi2nclight.py','bin/nclight2gridded.py'],
scripts=['bin/owi2nclight.py', 'bin/nclight2gridded.py', 'bin/L2Ctolight.py'],
install_requires=[
'numpy', 'netCDF4', 'future'
])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment