tIceModelVec.py - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
HTML git clone git://src.adamsgaard.dk/pism
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
tIceModelVec.py (542B)
---
1 # code extending the IceModelVec class
2
3
4 def regrid(self, filename, critical=False, default_value=0.0):
5 if critical == True:
6 flag = CRITICAL
7 else:
8 flag = OPTIONAL
9 self._regrid(filename, flag, default_value)
10
11
12 def numpy(self):
13 "Return a NumPy array containing data from this field (on rank 0)."
14 tmp = self.allocate_proc0_copy()
15 self.put_on_proc0(tmp.get())
16 import numpy
17
18 if self.grid().ctx().rank() == 0:
19 return numpy.array(tmp.get()).reshape(self.shape())
20 else:
21 return None