source: TI02-CSML/trunk/parser/API/ops_GridSeriesFeature.py @ 1032

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/parser/API/ops_GridSeriesFeature.py@1032
Revision 1032, 1.6 KB checked in by domlowe, 14 years ago (diff)

domainreference + domaincomplement working in api

Line 
1''' ops_GridSeriesFeature  contains operations for GridSeriesFeatures'''
2from API import *
3
4def testmethod(self):
5    print 'testmethod for gridseries feature'
6    return 'testmethod - gridseries'
7
8def getAllowedSubsettings(self):
9    return ['subsetToGridSeries']
10
11def getDomainReference(self):
12    #Inspects a time position list for the domain reference.
13    #TODO, does not handle a file extract in place of a list.
14    if isinstance(self.domain.domainReference,Parser.TimePositionList):
15        time = {}
16        time['t'] = self.domain.domainReference.timePositions
17        domainref  = time
18    return domainref
19   
20def getDomainComplement(self):
21    #This will return a list containing one or more ordinates:
22    #currently in form [Name, values]
23    #assumes ordinate.axisValues is a file extract
24    #TODO axisValues may be inline -see also domainReference for similar problem
25    domaincomp ={}
26    dc = self.domain.domainComplement
27    #dc should be a grid!
28    if isinstance(dc, Parser.Grid):
29        for ordinate in dc.ordinates:
30            domaincomp[ordinate.definesAxis]=ordinate.axisValues.getData()
31    return domaincomp
32
33# #     def getDomain(self):
34# #         #returns both the domain reference axes and domain compliment axes in a single domain dictionary
35# #         #axes are in no particular order
36# #         domain = {}
37# #         dr=self.__getDomainReference()
38# #         dc=self.__getDomainComplement()
39# #         for key in dc.keys():
40# #             domain[key]=dc[key]
41# #         for key in dr.keys():
42# #             domain[key]=dr[key]
43# #         return domain
Note: See TracBrowser for help on using the repository browser.