1 | |
---|
2 | class CRSystem(object): |
---|
3 | def __init__(self, srsName, axes): |
---|
4 | self.srsName=srsName |
---|
5 | self.axes=axes |
---|
6 | self.timeAxis=None |
---|
7 | self.lonAxis=None |
---|
8 | self.latAxis=None |
---|
9 | self.srsDimension=len[axes] |
---|
10 | |
---|
11 | |
---|
12 | class CRSCatalogue(object): |
---|
13 | def __init__(self): |
---|
14 | # dictionary to hold known CRSystems: |
---|
15 | self.systems={} |
---|
16 | |
---|
17 | # define lon lat pressure time CRS: |
---|
18 | crs=CRSystem(srsName='ndg:crs:xypt', srsDimension='4', axes =['Long', 'Lat','Pressure','Time']) |
---|
19 | crs.lonAxis=0 |
---|
20 | crs.latAxis=1 |
---|
21 | crs.timeAxis=3 |
---|
22 | self.systems['ndg:crs:xypt']=crs |
---|
23 | |
---|
24 | # define lon lat height time CRS: |
---|
25 | crs=CRSystem(srsName='ndg:crs:xyht', srsDimension='4', axes =['Long', 'Lat','Height','Time']) |
---|
26 | crs.lonAxis=0 |
---|
27 | crs.latAxis=1 |
---|
28 | crs.timeAxis=3 |
---|
29 | self.systems['ndg:crs:xyht']=crs |
---|
30 | |
---|
31 | # define test CRS: |
---|
32 | crs=CRSystem(srsName='ndg:crs:abcde', srsDimension='5', axes =['Apple', 'Banana','Cat','Dog','Elephant']) |
---|
33 | self.systems.['ndg:crs:abcde']=crs |
---|
34 | |
---|
35 | |
---|
36 | def getCRS(self, axes, units): |
---|
37 | #given any list of axis names and a list of units for these axes return the name of the CRS |
---|
38 | pass |
---|
39 | |
---|
40 | def main(): |
---|
41 | cat=CRSCatalogue() |
---|
42 | #test getCRS |
---|
43 | print getCRS(axes=['longitude', 'latitude', 'pressure', 't'], units=['','','Pa','s']) |
---|
44 | |
---|
45 | if __name__=="__main__": |
---|
46 | main() |
---|