tIceModelVec2S.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
---
tIceModelVec2S.py (752B)
---
1 def __getitem__(self, *args):
2 return self.getitem(args[0][0], args[0][1])
3
4
5 def __setitem__(self, *args):
6 if(len(args) == 2):
7 self.setitem(args[0][0], args[0][1], args[1])
8 else:
9 raise ValueError("__setitem__ requires 2 arguments; received %d" % len(args))
10
11
12 def imshow(self, **kwargs):
13 "Plot a 2D field using matplotlib.pylab.imshow()."
14
15 try:
16 import matplotlib.pylab as plt
17 except:
18 raise RuntimeError("Failed to import matplotlib.pylab. Please make sure that matplotlib is installed!")
19
20 m = plt.imshow(self.numpy(), origin="lower", **kwargs)
21 plt.colorbar(m)
22 md = self.metadata()
23 plt.title("{}, {}".format(md.get_string("long_name"), md.get_string("units")))
24 plt.axis("equal")