source: CSML/trunk/Coapec/csmllibs/csmlextra.py @ 45

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/CSML/trunk/Coapec/csmllibs/csmlextra.py@45
Revision 45, 1.2 KB checked in by domlowe, 14 years ago (diff)

removed old csmlscan.py
renamed newcsmlscan.py to csmlscan.py

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1#Stuff with nowhere better to go
2
3
4def getSeqRule(nDims):
5        #returns a sequenceRule
6        #*****************very simplified version*****************
7        #This really needs more work to see if the +s and -s are correct. and the x/y/z s in right order
8        #nDims = spatial dimensions + time dimension
9        if nDims == 2:
10                seq = "Linear"
11        elif nDims ==3:
12                seq = "+x+y"
13        elif nDims ==4:
14                seq = "+x+y+z"
15        else:
16                seq="not sure"
17        return seq
18       
19       
20def getMappingRule(nDims):
21        #again, this needs a lot of work.
22        if nDims == 2:
23                mr = "+ gridI + series"
24        elif nDims ==3:
25                mr = "+ gridI + gridJ +series"
26        elif nDims ==4:
27                mr = "+ gridI + gridJ +gridK +series"
28        else:
29                mr="not sure"
30        return mr
31       
32       
33# a couple of string cleaning functions:
34def cleanString1(messystring):
35        #removes outer brackets and changes commas to spaces
36        cleanstring = messystring[1:-1]
37        cleanstring = cleanstring.replace(',',' ')
38        #strip off first (time) dimension.
39        #note, this might need rethinking for other datasets
40        cleanstring = cleanstring[3:]
41        return cleanstring
42       
43def cleanString2(messystring):
44        #removes outer brackets and 's, but leaves commas.
45        cleanstring = messystring[1:-1]
46        cleanstring = cleanstring.replace("'",'')
47        return cleanstring
48       
Note: See TracBrowser for help on using the repository browser.