Changeset 3327


Ignore:
Timestamp:
08/02/08 18:15:50 (12 years ago)
Author:
mkochan
Message:

Created module Station.py (but untested)

Location:
DPPP/kml/csml2kml/python
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • DPPP/kml/csml2kml/python/csml2kml/StationConvertor.py

    r3323 r3327  
    99from utils import wget 
    1010 
    11 class Station: 
    12     '''Represents a ground meteorological station, identified by id, with description, desc, at (lon,lat) ''' 
    13     def __init__(self, id, desc, lon, lat): 
    14         self.id = id 
    15         self.desc = desc 
    16         self.lon = lon; self.lat = lat 
    17  
    18     def __repr__(self): 
    19         return 'Station %s ("%s")' % (self.id, self.desc) 
    2011 
    2112class StationConvertor: 
  • DPPP/kml/csml2kml/python/notes.txt

    r3325 r3327  
    66 
    77---------------------------------------------------------------------------------------------------------------------------- 
    8 || KMLDocument.py 
     8|| KMLDocument.py / 
    99 
    10 [O] Add KMLDocument.build(), make KMLDocument descended from KMLElement, de-ambiguize to KMLWholeDocument, 
    11     rename KMLDocument.py to KML.py 
     10[O] Make KMLDocument descended from KMLElement, hence add method KMLDocument.build() -- builds only the <kml:Document> 
     11    element -- but also keep KMLDocument.save(filename), which saves to a file with the <kml> wrapping. 
     12    Rename KMLDocument.py to KMLElement.py. 
    1213 
     14---------------------------------------------------------------------------------------------------------------------------- 
     15|| Station.py / 
     16 
     17[O] Write tests for both classes inside; rename Station.py to NPStation.py; make StationConvertor.py and 
     18    psOntoWMS.py use NPStation.py.  
     19     
    1320---------------------------------------------------------------------------------------------------------------------------- 
    1421 
  • DPPP/kml/csml2kml/python/prototypes/psOntoWMS.py

    r3326 r3327  
    44from StringIO import StringIO 
    55import re 
     6from StationConvertor import Station 
     7 
     8def _parseStation(textGml): 
     9    ''' 
     10    Parse the GML returned from GeoServer, return a Station object with info about each station. 
     11    ''' 
     12    root = XML(textGml) 
     13    featureCollectionElement = root 
     14    for featureMember in featureCollectionElement.getchildren(): 
     15        stationElement = featureMember.getchildren()[0] 
     16        (stationNameElement, stationIDElement, locationElement) = stationElement.getchildren() 
     17        pointElement = locationElement.getchildren()[0] 
     18        posElement = pointElement.getchildren()[0] 
     19        (lon,lat) = map(float, posElement.text.split()) 
     20        yield Station(stationElement.get('{http://www.opengis.net/gml}id'), stationNameElement.text, lon, lat) 
    621 
    722requestUrl = 'http://www-devel.ipcc-data.org/maps/wms/obs?request=GetMap&amp;amp;SERVICE=1.1.1&amp;amp;FORMAT=image/png&amp;amp;LAYERS=clim_10/cld&amp;amp;BBOX=-180,-90,180,90&amp;amp;WIDTH=960&amp;amp;HEIGHT=480&amp;amp;SRS=EPSG:4326&amp;TIME=1905-03-15T00:00:00.0Z&amp;amp;STATION=midas.station.1600' 
Note: See TracChangeset for help on using the changeset viewer.