Commit fa3a0a5d authored by CEVAER's avatar CEVAER
Browse files

Improved path conversion for better supporting nclight paths

parent e5a92acb
...@@ -527,8 +527,9 @@ def getDataAtCoord(data,lon,lat): ...@@ -527,8 +527,9 @@ def getDataAtCoord(data,lon,lat):
# Convert L2C file system path into L2M filesystem path # Convert L2C file system path into L2M filesystem path
# Input validity is not tested. Supports converting raw L2X products paths or nclight product paths
# INPUT: # INPUT:
# path : iterable or non iterable of a full L2C path (list of string or just string depending on input) # path : iterable or non iterable of a full L2C/nclight path (list of string or just string depending on input)
# resolution : resolution of the L2M path needed # resolution : resolution of the L2M path needed
# Return: # Return:
# A path or a list of path (same type as path parameter) containing the L2M paths # A path or a list of path (same type as path parameter) containing the L2M paths
...@@ -538,7 +539,8 @@ def L2CtoL2M(path, resolution): ...@@ -538,7 +539,8 @@ def L2CtoL2M(path, resolution):
else: else:
pathList = path pathList = path
pathList = [p.replace("L2C", "L2M").replace("_CC_", "_CM_").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.replace("nclight", "nclight_L2M").replace("-cc-", "-cm-") for p in pathList]
pathList = [p.split("/") for p in pathList] pathList = [p.split("/") for p in pathList]
for p in pathList: for p in pathList:
filenameSplit = p[-1].split("-") filenameSplit = p[-1].split("-")
...@@ -560,7 +562,7 @@ def L2CtoL2M(path, resolution): ...@@ -560,7 +562,7 @@ def L2CtoL2M(path, resolution):
# resolution (int) : resolution of the L2M path needed. If not provided, will return the L2CLight # resolution (int) : resolution of the L2M path needed. If not provided, will return the L2CLight
# Return: # Return:
# A path or a list of path (same type as path parameter) containing the L2CLight/L2MLight paths # A path or a list of path (same type as path parameter) containing the L2CLight/L2MLight paths
def L2CtoLight(path, resolution=None , mode='sw'): def L2CtoLight(path, resolution=None, mode='sw'):
if type(path) == str: if type(path) == str:
pathList = [path] pathList = [path]
else: else:
......
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