Commit 8f1d3714 authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

ENH: better prototype for coherent period retrival.

parent e41a049d
......@@ -3,6 +3,7 @@ import datetime
import os
import subprocess
import warnings
from calendar import monthrange
def temporalSmoothing(fld,
template='MOD13Q1.006__250m_16_days_NDVI_',
......@@ -44,10 +45,16 @@ def temporalSmoothing(fld,
cmd += ['{' + ';'.join(expr) + '}']
subprocess.call(cmd)
def getCoherentReferencePeriod(dates_fn,start_date=(1,1),end_date=(12,31),dates_per_year=23):
def getCoherentReferencePeriod(dates_fn,start_month,end_month,start_day=1,end_day=None,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)[2]
end_date = (end_month,end_day)
# Get closest date to start_date
gaps = []
for dt in date_list:
......
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