Changeset 17655
- Timestamp:
- 04/06/14 14:48:52 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/interp/interp.py
r17598 r17655 2 2 import numpy as npy 3 3 from scipy.interpolate import CloughTocher2DInterpolator, Rbf 4 try: 5 import matplotlib.pyplot as plt 6 except ImportError: 7 print 'could not import matplotlib, no plotting functions enabled.\ 8 Set plotonly=False in function call' 4 9 5 10 def MeshSplineToMesh2d(x,y,data,xi,yi,tol=1e-6,**kwargs):#{{{ … … 66 71 return interpdata 67 72 #}}} 68 def GridSplineToMesh2d(x,y,data,xi,yi,default_value=npy.nan ):#{{{73 def GridSplineToMesh2d(x,y,data,xi,yi,default_value=npy.nan,plotonly=False):#{{{ 69 74 ''' 70 75 python analog to InterpFromGridToMesh. This routine uses … … 84 89 default_value: default value if points lie outside the convex hull of input 85 90 points (defaults to nan if not specified) 91 plotonly: plot the data to be interpolated using imshow (useful for 92 identifying holes in data and problems with interpolation) 86 93 87 94 Usage: 88 interpdata=GridToMesh(x,y,data,xi,yi,default_value=npy.nan )95 interpdata=GridToMesh(x,y,data,xi,yi,default_value=npy.nan,plotonly=False) 89 96 90 97 Examples: … … 115 122 flatsubdata=subdata.ravel() 116 123 124 if plotonly: 125 plt.imshow(npy.flipud(subdata),origin='upper') 126 plt.show() 127 return 128 117 129 # mask out any nan's in the data and corresponding coordinate points 118 130 mask=npy.isnan(flatsubdata)
Note:
See TracChangeset
for help on using the changeset viewer.