source: qesdi/data_processing/COORDDataTable.py @ 5419

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/qesdi/data_processing/COORDDataTable.py@5419
Revision 5419, 621 bytes checked in by dgrant, 12 years ago (diff)

Code following grid - except that I don't think it is a grid

Line 
1
2class COORDDataTable:
3    """Class to store a lookup tree (dict of dicts) of data by latlon"""
4   
5    def __init__(self):
6        self.lookupTable={}
7       
8    def insert(self,dataPt, lat, lon):
9        self.lookupTable.setdefault(lat,dict())[lon]=dataPt
10       
11    def lookup(self, lat, lon):
12            return self.lookupTable[lat][lon]
13
14    def getLats(self):
15        return sorted(self.lookupTable.keys())
16
17    def getLons(self):
18        return sorted(self.lookupTable.values()[0].keys())
19
20    def getLatSize(self):
21        return len(self.lookupTable)
22
23    def getLonSize(self):
24        return len(self.lookupTable.values()[0])
Note: See TracBrowser for help on using the repository browser.