Changeset 1487
- Timestamp:
- 06/09/06 10:31:55 (14 years ago)
- Location:
- TI02-CSML/trunk
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
TI02-CSML/trunk/csml/API/__init__.py
r1484 r1487 1 1 ''' __init__.py ''' 2 3 #import dataiface from scanner4 import os, sys5 # currentPath=os.getcwd()6 # scannerPath=os.sep.join(currentPath.split(os.sep)[:-1]) + '/Scanner'7 # sys.path.append(scannerPath) #append the parser path to sys.path8 # try:9 # import csmllibs.csmldataiface as csmldataiface10 # except:11 # print 'Could not import CSML data interface. '12 # sys.exit()13 #14 # try:15 # import csmllibs.csmltime as csmltime16 # except:17 # print 'Could not import csmltime. '18 # sys.exit()19 2 20 3 … … 33 16 import ops_GridSeriesFeature 34 17 import ops_TrajectoryFeature 35 import CSMLDocument 18 36 19 37 20 -
TI02-CSML/trunk/csml/API/ops_GridSeriesFeature.py
r1485 r1487 4 4 import csml.parser 5 5 import csml.csmllibs.csmltime 6 import csml.csmllibs.csml Document6 import csml.csmllibs.csmldocument 7 7 import csml.API.ops_AbstractFeature 8 import csml.csmllibs.netCDFWriter 8 9 9 10 … … 177 178 178 179 #### write csml document ##### 179 csmldoc=csml.csmllibs.csml Document.CSMLDocument("mydoc", "mymetadata")180 csmldoc=csml.csmllibs.csmldocument.CSMLDocument("mydoc", "mymetadata") 180 181 csmldoc.addGridSeriesFeature(domain,rangeSet,datasetID="A",featureID="B",description="C") 181 182 csmldoc=csmldoc.consolidate() … … 185 186 186 187 ### write netcdf using NCWriter class (wraps cdms) ### 187 nc= NetCDFWriter.NCwriter(pathToSubsetNetCDF)188 nc=csml.csmllibs.netCDFWriter.NCwriter(pathToSubsetNetCDF) 188 189 floatTimes=[] 189 190 for time in self.times: -
TI02-CSML/trunk/csml/csmllibs/csmldocument.py
r1486 r1487 1 1 ''' CSMLDocument.py - simple implementation to return a CSML document containing a single type of feature''' 2 # from API import * 3 # from Parser import * 4 # importparser_extra2 3 import csml.parser 4 import csml.parser_extra 5 5 6 6 class CSMLDocument(object): … … 12 12 #initialise a new document 13 13 #Create an Empty Dataset & FeatureCollection 14 self.ds = Dataset()15 self.fc= FeatureCollection()14 self.ds = csml.parser.Dataset() 15 self.fc=csml.parser.FeatureCollection() 16 16 #Set attributes of dataset 17 17 #if docMetaDataProperty is a URI, set it as href attribute if MetaDataProperty instance, 18 18 #else set it as a text attribute of a MetaDataProperty instance. 19 mdp= MetaDataProperty()20 if parser_extra.isURI(docMetaDataProperty):19 mdp=csml.parser.MetaDataProperty() 20 if csml.parser_extra.isURI(docMetaDataProperty): 21 21 mdp.href=docMetaDataProperty 22 22 else: … … 40 40 parameter = Phenomenon type 41 41 """ 42 feat= PointFeature()42 feat=csml.parser.PointFeature() 43 43 feat.id=id 44 feat.description= Description(description)44 feat.description=csml.parser.Description(description) 45 45 46 46 #Add the domain to the feature 47 p= Position()47 p=csml.parser.Position() 48 48 p.srsName =domainReference[0] 49 49 p.axisLabels=domainReference[1] … … 51 51 p.location=domainReference[3] 52 52 p.time=domainReference[4] 53 ptd= PointDomain()53 ptd=csml.parser.PointDomain() 54 54 ptd.domainReference=p 55 55 feat.domain=ptd 56 56 57 57 #Add the rangeSet to the feature 58 rs= RangeSet()59 rs.quantityList= MeasureOrNullList(uom=rangeSet[0],val = rangeSet[1])58 rs=csml.parser.RangeSet() 59 rs.quantityList=csml.parser.MeasureOrNullList(uom=rangeSet[0],val = rangeSet[1]) 60 60 feat.rangeSet=rs 61 61 62 62 #Add the parameter to the feature 63 feat.parameter= Phenomenon(href=parameter)63 feat.parameter=csml.parser.Phenomenon(href=parameter) 64 64 65 65 self.fm.append(feat) … … 78 78 def addGridSeriesFeature(self,domain,rangeSet,datasetID=None,featureID=None,description=None): 79 79 fms=[] #empty featureMembers list 80 feat= Parser.GridSeriesFeature()80 feat=csml.parser.GridSeriesFeature() 81 81 if featureID: 82 82 feat.id= featureID … … 84 84 feat.id='No ID' 85 85 if description: 86 feat.description= Parser.Description(description)86 feat.description=csml.parser.Description(description) 87 87 else: 88 feat.description= Parser.Description('No Description')88 feat.description=csml.parser.Description('No Description') 89 89 feat.domain=domain 90 90 feat.rangeSet=rangeSet … … 97 97 #handles the addition of file extract classes (can probably get away with one method for all types of extracts for now) 98 98 if extractType=='NetCDFExtract': 99 ex= NetCDFExtract()99 ex=csml.parser.NetCDFExtract() 100 100 if extractType=='NASAAmesExtract': 101 ex= NASAAmesExtract()101 ex=csml.parser.NASAAmesExtract() 102 102 if extractType=='GRIBExtract': 103 ex= GRIBExtract()103 ex=csml.parser.GRIBExtract() 104 104 if extractType=='PPExtract': 105 ex= PPExtract()105 ex=csml.parser.PPExtract() 106 106 ex.id =id 107 107 if arraySize: … … 131 131 def setBoundingEnvelope(self,lowerCorner,upperCorner,timePosition1,timePosition2): 132 132 #set the bounding box envelope of the feature collection. 133 etp = EnvelopeWithTimePeriod()133 etp = csml.parser.EnvelopeWithTimePeriod() 134 134 etp.lowerCorner=lowerCorner 135 135 etp.upperCorner=upperCorner … … 143 143 #when you have finished building the document, need to consolidate it and return a CSML document (string) 144 144 self.ds.arrayDescriptors=self.ad 145 self.ds.featureCollection= FeatureCollection(members=self.fm)146 csml =self.ds.toXML()145 self.ds.featureCollection=csml.parser.FeatureCollection(members=self.fm) 146 csmlout=self.ds.toXML() 147 147 #parse and pretty print the result 148 strCSML= parser_extra.PrettyPrint(csml)149 strCSML= parser_extra.removeInlineNS(strCSML)148 strCSML=csml.parser_extra.PrettyPrint(csmlout) 149 strCSML=csml.parser_extra.removeInlineNS(strCSML) 150 150 return strCSML
Note: See TracChangeset
for help on using the changeset viewer.