Changeset 25346
- Timestamp:
- 08/05/20 00:25:08 (5 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/coordsystems/epsg2proj.py
r25189 r25346 1 import shlex 1 2 import subprocess 2 3 3 4 4 5 def epsg2proj(epsg): #{{{ 5 '''6 """ 6 7 FUNCTION EPSG2PROJ - uses gdalsrsinfo to provide PROJ.4 compatible string 7 8 from EPSG code … … 18 19 - In case of Python 2, except socket.timeout: https://docs.python.org/3/library/socket.html?highlight=socket%20timeout#socket.timeout 19 20 - In case of Python 3, except TimeoutExpired: https://docs.python.org/3/library/subprocess.html#subprocess.SubprocessError 20 '''21 """ 21 22 22 23 #First, get GDAL version -
issm/trunk-jpl/src/m/io/loadmodel.py
r25092 r25346 33 33 # try: 34 34 #recover model on file and name it md 35 struc = loadvars(path, OL=onlylast)35 struc = loadvars(path, onlylast=onlylast) 36 36 name = [key for key in list(struc.keys())] 37 37 if len(name) > 1: -
issm/trunk-jpl/src/m/io/loadvars.py
r25125 r25346 15 15 16 16 17 def loadvars(*args, OL):18 '''17 def loadvars(*args, **kwargs): 18 """ 19 19 LOADVARS - function to load variables from a file. 20 20 … … 30 30 nvdict = loadvars('shelve.dat', {'a':None, 'b':None}) 31 31 nvdict = loadvars('shelve.dat') 32 '''32 """ 33 33 34 34 filename = '' … … 55 55 else: 56 56 raise TypeError("Unrecognized input arguments.") 57 58 onlylast = False 59 60 for key, value in kwargs.items(): 61 if key == 'onlylast': 62 onlylast = value 57 63 58 64 if whichdb(filename): #We used python pickle for the save … … 110 116 nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = [OrderedDict() for i in range(max(1, len(curclass.groups)))] 111 117 else: 112 if OL: #we load only the last result to save on time and memory118 if onlylast: #we load only the last result to save on time and memory 113 119 nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = [getattr(__import__(listtype), listtype)()] 114 120 Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] … … 126 132 if AllHaveTime: 127 133 #Time dimension is in all the variables so we take that as stepnumber for the results 128 if OL: #we load only the last result to save on time and memory134 if onlylast: #we load only the last result to save on time and memory 129 135 nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = [getattr(__import__(listtype), listtype)()] 130 136 Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] … … 166 172 NewFormat = 'Time' in NCFile.dimensions 167 173 if type(Tree) == list and NewFormat: 168 if OL:174 if onlylast: 169 175 if vardim == 1: 170 176 Tree[0].__dict__[str(var)] = varval[-1].data
Note:
See TracChangeset
for help on using the changeset viewer.