Ignore:
Timestamp:
02/04/07 16:48:19 (13 years ago)
Author:
lawrence
Message:

Improvements on DIF rendering, Source and Sensor display.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/PythonCode/wsgi/DIF.py

    r2332 r2366  
    2020debug=1 
    2121     
     22def shortLong(targetList,s,l): 
     23    ''' Format a short-long name combination as a string, and add to a list if non-empty, 
     24    and a non-duplicate''' 
     25    if l<>'': 
     26        if s<>'':  
     27            r='%s (%s)'%(l,s) 
     28        else: 
     29            r=l 
     30    elif s<>'': r=s 
     31    if r not in targetList: targetList.append(r) 
     32    return targetList 
     33 
    2234class DIF: 
    2335    ''' Supports the NASA GCMD DIF format for python operations, 
     
    8496                    while len(name.split('>'))<5:name+='>' 
    8597            self.parameters.append(name) 
    86              
     98         
     99        #sensors are pretty important too 
     100        self.sensors=[] 
     101        for sensor in helper.findall(self.tree,'Sensor_Name'): 
     102            s,l=helper.getText(sensor,'Short_Name'),helper.getText(sensor,'Long_Name') 
     103            self.sensors=shortLong(self.sensors,s,l) 
     104                 
     105        #and sources 
     106        self.sources=[] 
     107        for source in helper.findall(self.tree,'Source_Name'): 
     108            s,l=helper.getText(source,'Short_Name'),helper.getText(source,'Long_Name') 
     109            self.sources=shortLong(self.sources,s,l) 
    87110 
    88111        #load up information about spatial bounding box  
Note: See TracChangeset for help on using the changeset viewer.