source: TI02-CSML/trunk/csml/API/ops_AbstractFeature.py @ 1483

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/csml/API/ops_AbstractFeature.py@1912
Revision 1483, 1.2 KB checked in by domlowe, 14 years ago (diff)

more module madness

Line 
1''' ops_AbstractFeature  contains operations for AbstractFeatures'''
2import cdtime
3
4def testmethod(self):
5    print 'testmethod for abstract feature'
6    return 'testmethod abstract feature'
7
8def getAllowedSubsettings(self):
9    return ['none']
10
11def __compareTimes(timemin, timecheck, timemax):
12    try:
13        year=int(timecheck.split('-')[0])
14        month=int(timecheck.split('-')[1])
15        day=int(timecheck.split('-')[2].split('T')[0])
16        tcheck=cdtime.comptime(year,month,day)
17        timeok=0
18        if tcheck.cmp(timemin) >= 0:
19            if tcheck.cmp(timemax) < 1:
20                timeok = 1
21    except:
22        #if it's not a proper internet time e.g. time = '6' then just compare numerically
23        timeok=0
24        if timecheck >=timemin:
25            if timecheck <=timemax:
26                timeok = 1
27    return timeok
28
29def __getCDtime(time): 
30    year=int(time.split('-')[0])
31    month=int(time.split('-')[1])
32    day=int(time.split('-')[2].split('T')[0])
33    hour=int(time.split('-')[2].split('T')[1].split(':')[0])
34    minute=int(time.split('-')[2].split('T')[1].split(':')[1])
35    second=float(time.split('-')[2].split('T')[1].split(':')[2])
36    cdTimeVal=cdtime.comptime(year,month,day,hour,minute,second)
37    return cdTimeVal
Note: See TracBrowser for help on using the repository browser.