Commit 5a15b6d6 authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

ENH: better prototype for coherent period retrieval function.

parent 66a10da9
......@@ -45,15 +45,14 @@ def temporalSmoothing(fld,
cmd += ['{' + ';'.join(expr) + '}']
subprocess.call(cmd)
def getCoherentReferencePeriod(dates_fn,start_month,end_month,start_day=1,end_day=None,dates_per_year=23):
def getCoherentReferencePeriod(dates_fn,start_month,nb_days,start_day=1,dates_per_year=23):
start_date = (start_month,start_day)
with open(dates_fn,'rb') as df:
lst = df.readlines()
date_list = [datetime.datetime.strptime(x.strip(),'%Y%m%d') for x in lst]
if end_day is None:
end_day = monthrange(date_list[0].year,end_month)[1]
end_date = (end_month,end_day)
end_dt = datetime.datetime(date_list[0].year,start_month,start_day) + datetime.timedelta(nb_days)
end_date = (end_dt.month,end_dt.day)
# Get closest date to start_date
gaps = []
......
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