Ignore:
Timestamp:
06/07/17 10:50:54 (8 years ago)
Author:
Eric.Larour
Message:

CHG: merged branch back to trunk-jpl 21754.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/branches/trunk-larour-NatGeoScience2016/src/m/exp/expcoarsen.py

    r17480 r21759  
    11import os.path
    2 import numpy as npy
     2import numpy as  np
    33from collections import OrderedDict
    44from expread import expread
     
    3434        for contour in  contours:
    3535               
    36                 numpoints=npy.size(contour['x'])
     36                numpoints=np.size(contour['x'])
    3737
    3838                j=0
     
    4444
    4545                        #see whether we keep this point or not
    46                         distance=npy.sqrt((x[j]-x[j+1])**2+(y[j]-y[j+1])**2)
     46                        distance=np.sqrt((x[j]-x[j+1])**2+(y[j]-y[j+1])**2)
    4747                        if distance<resolution and j<numpoints-2:   #do not remove last point
    48                                 x=npy.delete(x,j+1,0)
    49                                 y=npy.delete(y,j+1,0)
     48                                x=np.delete(x,j+1,0)
     49                                y=np.delete(y,j+1,0)
    5050                                numpoints=numpoints-1
    5151                        else:
    52                                 division=int(npy.floor(distance/resolution)+1)
     52                                division=int(np.floor(distance/resolution)+1)
    5353                                if division>=2:
    54                                         xi=npy.linspace(x[j],x[j+1],division)
    55                                         yi=npy.linspace(y[j],y[j+1],division)
     54                                        xi=np.linspace(x[j],x[j+1],division)
     55                                        yi=np.linspace(y[j],y[j+1],division)
    5656                                       
    57                                         x=npy.hstack((x[0:j+1],xi[1:-1],x[j+1:]))
    58                                         y=npy.hstack((y[0:j+1],yi[1:-1],y[j+1:]))
     57                                        x=np.hstack((x[0:j+1],xi[1:-1],x[j+1:]))
     58                                        y=np.hstack((y[0:j+1],yi[1:-1],y[j+1:]))
    5959
    6060                                        #update current point
     
    6565                                        j=j+1
    6666               
    67                 if npy.size(x)>1:
     67                if np.size(x)>1:
    6868                        #keep the (x,y) contour arond
    6969                        newcontour=OrderedDict()
    70                         newcontour['nods']=npy.size(x)
     70                        newcontour['nods']=np.size(x)
    7171                        newcontour['density']=contour['density']
    7272                        newcontour['x']=x
Note: See TracChangeset for help on using the changeset viewer.