- Timestamp:
- 07/09/06 15:01:05 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TI02-CSML/trunk/Examples/BODC/demoCreateBODCPointSeries.py
r1366 r1499 2 2 Dominic Lowe 07 August 2006, (c) BADC, CCLRC ''' 3 3 4 from Parser import * 5 import parser_extra4 import csml.parser 5 import csml.parser_extra 6 6 7 7 … … 43 43 44 44 # #### add a PointSeriesFeature: ##### 45 ptsf= PointSeriesFeature()45 ptsf=csml.parser.PointSeriesFeature() 46 46 ptsf.id=ID 47 ptsf.description= Description(DESC2)47 ptsf.description=csml.parser.Description(DESC2) 48 48 #domain: 49 ptsd= PointSeriesDomain()50 t= Trajectory()49 ptsd=csml.parser.PointSeriesDomain() 50 t=csml.parser.Trajectory() 51 51 t.srsName=SRSNAME 52 t.locations= DirectPositionList(vals=TRAJECTORY_LOCATIONS)53 t.times= TimePositionList(TRAJECTORY_TIMES)52 t.locations=csml.parser.DirectPositionList(vals=TRAJECTORY_LOCATIONS) 53 t.times=csml.parser.TimePositionList(TRAJECTORY_TIMES) 54 54 ptsd.domainReference=t 55 55 56 56 #rangeSet 57 rs= RangeSet()58 ncExtract= NetCDFExtract()57 rs=csml.parser.RangeSet() 58 ncExtract=csml.parser.NetCDFExtract() 59 59 ncExtract.arraySize = ARRAYSIZE 60 60 ncExtract.fileName=FILENAME … … 71 71 72 72 # #instantiate FeatureCollection object: 73 fc= FeatureCollection(members=fms)73 fc=csml.parser.FeatureCollection(members=fms) 74 74 #etp is the bounding box for the feature. Again I've hard coded some values into variables. 75 75 … … 80 80 81 81 82 etp = EnvelopeWithTimePeriod()82 etp = csml.parser.EnvelopeWithTimePeriod() 83 83 etp.srsName=SRSNAME 84 etp.lowerCorner= DirectPosition(LOWER ,uomLabels='deg deg',axisLabels='lat lon')85 etp.upperCorner= DirectPosition(UPPER ,uomLabels='deg deg',axisLabels='lat lon')84 etp.lowerCorner=csml.parser.DirectPosition(LOWER ,uomLabels='deg deg',axisLabels='lat lon') 85 etp.upperCorner=csml.parser.DirectPosition(UPPER ,uomLabels='deg deg',axisLabels='lat lon') 86 86 etp.timePosition=T1 87 87 etp.timePosition2=T2 … … 94 94 #list to hold multiple metaDataProperty elements 95 95 mds = [] 96 md = MetaDataProperty()96 md =csml.parser.MetaDataProperty() 97 97 md.href = DESC 98 98 mds.append(md) … … 100 100 ########### The Dataset ############## 101 101 #Create an Empty Dataset 102 ds = Dataset()102 ds = csml.parser.Dataset() 103 103 #Set objects as attributes of dataset 104 104 #NOTE: you can equally write this in the form: ds.id = 'Test001' as used above. 105 105 ds.id=DSID 106 106 ds.metaDataProperty=mds 107 ds.name = Name(val=[NAME],codeSpace=CODESPACE)108 ds.description= Description(DESC) #this is a description object!107 ds.name = csml.parser.Name(val=[NAME],codeSpace=CODESPACE) 108 ds.description=csml.parser.Description(DESC) #this is a description object! 109 109 ds.featureCollection = fc 110 110 … … 114 114 115 115 #call the toXML method of the Dataset object: 116 csml = ds.toXML()116 csmldoc = ds.toXML() 117 117 #parse and pretty print the result 118 strCSML= parser_extra.PrettyPrint(csml)119 strCSML= parser_extra.removeInlineNS(strCSML)118 strCSML=csml.parser_extra.PrettyPrint(csmldoc) 119 strCSML=csml.parser_extra.removeInlineNS(strCSML) 120 120 print strCSML 121 121
Note: See TracChangeset
for help on using the changeset viewer.