Changeset 1499 for TI02-CSML


Ignore:
Timestamp:
07/09/06 15:01:05 (13 years ago)
Author:
domlowe
Message:

Fixed BODC demo create csml example

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/Examples/BODC/demoCreateBODCPointSeries.py

    r1366 r1499  
    22 Dominic Lowe 07 August 2006, (c) BADC, CCLRC ''' 
    33 
    4 from Parser import * 
    5 import parser_extra 
     4import csml.parser 
     5import csml.parser_extra 
    66 
    77 
     
    4343 
    4444# #### add a PointSeriesFeature: ##### 
    45 ptsf=PointSeriesFeature() 
     45ptsf=csml.parser.PointSeriesFeature() 
    4646ptsf.id=ID 
    47 ptsf.description=Description(DESC2) 
     47ptsf.description=csml.parser.Description(DESC2) 
    4848#domain: 
    49 ptsd=PointSeriesDomain() 
    50 t=Trajectory() 
     49ptsd=csml.parser.PointSeriesDomain() 
     50t=csml.parser.Trajectory() 
    5151t.srsName=SRSNAME 
    52 t.locations=DirectPositionList(vals=TRAJECTORY_LOCATIONS) 
    53 t.times=TimePositionList(TRAJECTORY_TIMES) 
     52t.locations=csml.parser.DirectPositionList(vals=TRAJECTORY_LOCATIONS) 
     53t.times=csml.parser.TimePositionList(TRAJECTORY_TIMES) 
    5454ptsd.domainReference=t 
    5555 
    5656#rangeSet 
    57 rs=RangeSet() 
    58 ncExtract=NetCDFExtract() 
     57rs=csml.parser.RangeSet() 
     58ncExtract=csml.parser.NetCDFExtract() 
    5959ncExtract.arraySize = ARRAYSIZE 
    6060ncExtract.fileName=FILENAME 
     
    7171 
    7272# #instantiate FeatureCollection object: 
    73 fc=FeatureCollection(members=fms) 
     73fc=csml.parser.FeatureCollection(members=fms) 
    7474#etp is the bounding box for the feature. Again I've hard coded some values into variables.  
    7575 
     
    8080 
    8181 
    82 etp = EnvelopeWithTimePeriod() 
     82etp = csml.parser.EnvelopeWithTimePeriod() 
    8383etp.srsName=SRSNAME 
    84 etp.lowerCorner=DirectPosition(LOWER ,uomLabels='deg deg',axisLabels='lat lon') 
    85 etp.upperCorner=DirectPosition(UPPER ,uomLabels='deg deg',axisLabels='lat lon') 
     84etp.lowerCorner=csml.parser.DirectPosition(LOWER ,uomLabels='deg deg',axisLabels='lat lon') 
     85etp.upperCorner=csml.parser.DirectPosition(UPPER ,uomLabels='deg deg',axisLabels='lat lon') 
    8686etp.timePosition=T1 
    8787etp.timePosition2=T2 
     
    9494#list to hold multiple metaDataProperty elements 
    9595mds = [] 
    96 md =MetaDataProperty() 
     96md =csml.parser.MetaDataProperty() 
    9797md.href = DESC 
    9898mds.append(md) 
     
    100100########### The Dataset  ############## 
    101101#Create an Empty Dataset 
    102 ds = Dataset() 
     102ds = csml.parser.Dataset() 
    103103#Set objects as attributes of dataset 
    104104#NOTE: you can equally write this in the form: ds.id = 'Test001'  as used above. 
    105105ds.id=DSID 
    106106ds.metaDataProperty=mds 
    107 ds.name = Name(val=[NAME],codeSpace=CODESPACE) 
    108 ds.description=Description(DESC)  #this is a description object! 
     107ds.name = csml.parser.Name(val=[NAME],codeSpace=CODESPACE) 
     108ds.description=csml.parser.Description(DESC)  #this is a description object! 
    109109ds.featureCollection = fc 
    110110 
     
    114114 
    115115#call the toXML method of the Dataset object: 
    116 csml = ds.toXML() 
     116csmldoc = ds.toXML() 
    117117#parse and pretty print the result 
    118 strCSML=parser_extra.PrettyPrint(csml) 
    119 strCSML=parser_extra.removeInlineNS(strCSML) 
     118strCSML=csml.parser_extra.PrettyPrint(csmldoc) 
     119strCSML=csml.parser_extra.removeInlineNS(strCSML) 
    120120print strCSML 
    121121 
Note: See TracChangeset for help on using the changeset viewer.