Changeset 1032


Ignore:
Timestamp:
26/05/06 14:34:00 (13 years ago)
Author:
domlowe
Message:

domainreference + domaincomplement working in api

Location:
TI02-CSML/trunk/parser
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/parser/API/__init__.py

    r1029 r1032  
    11''' __init__.py  ''' 
    22 
    3 #import everything needed 
     3#import dataiface from scanner 
    44import os, sys 
    5 currentPath=os.getcwd() 
    6 parserPath=os.sep.join(currentPath.split(os.sep)[:-1]) 
    7 sys.path.append(parserPath) #append the parser path to sys.path  
     5currentPath=os.getcwd()  
     6scannerPath=os.sep.join(currentPath.split(os.sep)[:-1]) + '/Scanner' 
     7sys.path.append(scannerPath) #append the parser path to sys.path  
     8print sys.path 
    89try: 
    9     import Parser 
    10     import parser_extra 
     10    import csmllibs.csmldataiface as csmldataiface 
    1111except: 
    12     print 'Could not import CSML Parser. Make sure the Parser code is in parent directory.' 
     12    print 'Could not import CSML data interface. ' 
    1313    sys.exit() 
    1414 
     15 
     16#import element tree and the parser api 
    1517from cElementTree import * 
     18import Parser 
     19import parser_extra 
    1620import ops_Dataset 
     21import ops_AbstractFileExtract 
    1722import ops_AbstractFeature 
    1823import ops_PointFeature 
     
    3338Parser.Dataset.getFileExtract=ops_Dataset.getFileExtract 
    3439 
     40#AbstractFileExtract methods: 
     41Parser.AbstractFileExtract.getData=ops_AbstractFileExtract.getData 
    3542 
    3643#AbstractFeature methods: 
     
    6269Parser.GridSeriesFeature.getAllowedSubsettings=ops_GridSeriesFeature.getAllowedSubsettings 
    6370Parser.GridSeriesFeature.getDomainReference=ops_GridSeriesFeature.getDomainReference 
     71Parser.GridSeriesFeature.getDomainComplement=ops_GridSeriesFeature.getDomainComplement 
    6472 
    6573#TrajectoryFeature methods: 
  • TI02-CSML/trunk/parser/API/ops_AbstractFileExtract.py

    r1028 r1032  
    66    return 'testmethod AbstractFileExtract' 
    77 
     8 
     9def getData(self): 
     10    #should handle setAxis or setVariable as cdms netcdf model 
     11    DI = csmldataiface.DataInterface() 
     12    DI=DI.getUnknownInterfaceType(self.fileName) 
     13    DI.openFile(self.fileName) 
     14    DI.setAxis(self.variableName) 
     15    data=DI.getDataForAxis() 
     16    return data 
  • TI02-CSML/trunk/parser/API/ops_GridSeriesFeature.py

    r1027 r1032  
    1818    return domainref 
    1919     
    20 #     def __getDomainComplement(self): 
    21 #         #This will return a list containing one or more ordinates: 
    22 #         #currently in form [Name, values] 
    23 #         domaincomp ={} 
    24 #         dc = self.domain.domainComplement 
    25 #         #dc should be a grid! 
    26 #         if isinstance(dc, Grid): 
    27 #             for ordinate in dc.ordinates: 
    28 #                 fe=CSMLAbstractFileExtract(ordinate.axisValues) 
    29 #                 domaincomp[ordinate.definesAxis]=fe.getAxisData() 
    30 #                 fe.close() 
    31 #         return domaincomp 
    32              
     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 
    3333# #     def getDomain(self): 
    3434# #         #returns both the domain reference axes and domain compliment axes in a single domain dictionary 
  • TI02-CSML/trunk/parser/apicalls.py

    r1027 r1032  
    2222print '\n The feature has domain reference:'  
    2323print feature.getDomainReference() 
     24 
     25#get the domain complement of the feature 
     26print '\n The feature has domain complement :'  
     27print feature.getDomainComplement() 
Note: See TracChangeset for help on using the changeset viewer.