Commit ab279a91 authored by mickael's avatar mickael

add options for more flexibility in calling

parent 58a8926f
......@@ -706,6 +706,8 @@ def writeAllData(datemonth, picklerPath, satellite='a', showData=True):
datemonth, picklerPath, satellite)
geolocalizedElementsFromCalvalIndex, notGeolocalizedElementsFromCalvalIndex = writeNCFileNameFromCalvalIndex(
datemonth, picklerPath, satellite)
listElementsInError(args.monthToProcess, picklerPath, args.satellite)
def writeAllDataCFO(datemonth, picklerPath):
pngBaseList, pngFullPathList = writeListFromPNGOnHardDrive(
......@@ -1596,12 +1598,13 @@ if __name__ == "__main__":
print picklerPath
if args.function == 'overview':
createHTMLOverview(picklerPath, args.satellite)
if args.function == 'monthlygraph':
elif args.function == 'monthlygraph':
createHTMLOutputGraph(args.monthToProcess, picklerPath, args.satellite)
if args.function == 'monthlyhtml':
elif args.function == 'monthlyhtml':
createHTMLOutput(args.monthToProcess, picklerPath, args.satellite)
if args.function == 'writealldata':
elif args.function == 'writealldata':
writeAllData(args.monthToProcess, picklerPath, args.satellite)
listElementsInError(args.monthToProcess, picklerPath, args.satellite)
else:
locals()[args.function](args.monthToProcess, picklerPath, args.satellite)
sys.exit(0)
......@@ -220,6 +220,14 @@ def parsearguments(parser):
action='store',type="string",
default=None,dest='outputFilepath',
help="the path where to generate the listing")
parser.add_option("--output-folder",
action='store',type="string",
default=None,dest='outputFolder',
help="the path where you want the spectra to be generated")
parser.add_option("--stdin",
action='store_true',
default=False,dest='stdin',
help="using stdin to generate the listing")
(options, args) = parser.parse_args()
return options
......@@ -279,32 +287,35 @@ def createlisting(options):
else:
enddate = datetime.datetime.strptime(options.enddate,'%Y%m%d')
if options.begdate == None:
startdate = mission_start_s1a
startdate = datetime.datetime.strptime(mission_start_s1a,'%Y%m%d')
else:
startdate = datetime.datetime.strptime(options.begdate,'%Y%m%d')
print enddate,startdate
enddate_str = datetime.datetime.strftime(enddate,'%Y%m%d')
startdate_str = datetime.datetime.strftime(startdate,'%Y%m%d')
#---------------------------------------
if options.outputFolder is None:
repout = getoutputfolder(options.platform)
else:
repout = options.outputFolder
if not options.stdin:
inputfolder = getinputfolder(options)
logging.info('inputfolder = %s',inputfolder)
repout = getoutputfolder(options.platform)
inputfolder = getinputfolder(options)
logging.info('inputfolder = %s',inputfolder)
#USELESS BECAUSE L1 SAFE Different from L2 SAFE
#pathdict = {}
#if options.source =="WW3":
# pathdict = getl1indexeddictionary(startdate_str,enddate_str,options.platform)
if options.stdin:
listnc = sys.stdin
#get all the files that contains data for the specified interval
listnc = getinputfilelist(inputfolder,options,startdate_str,enddate_str,write_to_file=True)
else:
listnc = getinputfilelist(inputfolder,options,startdate_str,enddate_str,write_to_file=True)
logging.info('generate listing for L2 xspectrum from %s to %s',startdate,enddate)
logging.info('generate listing for L2 xspectrum from %s to %s',startdate,enddate)
listing_togenerate = '/home/cercache/project/mpc-sentinel1/analysis/s1_data_analysis/L2_V2/listing/xspec_l2_'+startdate_str+'_'+enddate_str+'_'+options.platform+'_'+options.source+'.lst'
if "outputFilepath" in dir(options):
if options.outputFilepath:
listing_togenerate = options.outputFilepath
else:
listing_togenerate = '/home/cercache/project/mpc-sentinel1/analysis/s1_data_analysis/L2_V2/listing/xspec_l2_'+startdate_str+'_'+enddate_str+'_'+options.platform+'_'+options.source+'.lst'
if os.path.exists(listing_togenerate):
os.remove(listing_togenerate)
......@@ -314,6 +325,7 @@ def createlisting(options):
filecounteroutput = 0
for inputfile in listnc:
inputfile = inputfile.strip('\n')
linestogenerate = getoutputlines(inputfile,repout,options.source)
for currentline in linestogenerate:
#Check if the file to generate exist or if the option redo is active
......
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