y = yc + yr * r * N.sin(a) return N.asarray([x, y, N.exp(-(x - xc) ** 2 / xr ** 2 - (y - yc) ** 2 / yr ** 2) * amp + noise]) # - creations xyz1 = XYZBathy(gene_bathy(-5, 48.3, 0.3, 0.15)) # top right xyz2 = XYZBathy(gene_bathy(-5.45, 48.1, 0.45, 0.25, n=1000, amp=20), transp=False) # bot left # Recuperation de donnees x = xyz1.x y = xyz1.y z = xyz1.z # Exclusions/selections xyz1.select([[-5.4, 48.1], [-4.8, 48.1], [-5.1, 48.5]]) xyz1.exclude([-5.2, 48.0, -5, 48.25]) # Infos print xyz1.xmin # -> essayer get_xmin avec mask print xyz1.resol() # -> essayer avec deg=... # Plot kwp = dict(size=40, map_res=None, masked_alpha=0.1) xyz1.plot(mode="both", **kwp) # -> essayer autre mode # Fichier fbathy = __file__[:-2] + "xyz" xyz1.save(fbathy) xyz3 = XYZBathy(fbathy) xyz3.plot(title="XYZ3", **kwp)
]) # - creations xyz1 = XYZBathy(gene_bathy(-5, 48.3, .3, .15)) # top right xyz2 = XYZBathy(gene_bathy(-5.45, 48.1, .45, .25, n=1000, amp=20), transp=False) # bot left # Recuperation de donnees x = xyz1.x y = xyz1.y z = xyz1.z # Exclusions/selections xyz1.select([[-5.4, 48.1], [-4.8, 48.1], [-5.1, 48.5]]) xyz1.exclude([-5.2, 48., -5, 48.25]) # Infos print xyz1.xmin # -> essayer get_xmin avec mask print xyz1.resol() # -> essayer avec deg=... # Plot kwp = dict(size=40, map_res=None, masked_alpha=.1) xyz1.plot(mode='both', **kwp) # -> essayer autre mode # Fichier fbathy = __file__[:-2] + 'xyz' xyz1.save(fbathy) xyz3 = XYZBathy(fbathy) xyz3.plot(title='XYZ3', **kwp)
bathy = N.asarray([x, y, N.exp(-(x-xc)**2/xr**2-(y-yc)**2/yr**2)*30.+noise]).transpose() fbathy = __file__[:-2]+'xyz' N.savetxt(fbathy, bathy) # Chargement dans XYZ avec sous echantillonage xyz = XYZBathy(fbathy, long_name='My XYZ', rsamp=0.01) # on aurait pu charger directement : # >>> xyz = XYZBathy(bathy) # Ajout d'une zone de selection # -> triangulaire, par coordonnees [[x1,y1],...] xyz.select([[-5.4, 48.1], [-4.8, 48.1], [-5.1, 48.5]]) # Ajout d'une zone d'exclusion # -> rectangulaire, par coins [xmin,ymin,xmax,ymax] xyz.exclude([-5.2, 48., -5, 48.25]) # Infos print xyz # Recuperation des valeurs x = xyz.x y = xyz.y z = xyz.z # Extensions # - en tenant compte des zones de selection et exclusion print 'Limites :', xyz.xmin, xyz.xmax, xyz.ymin, xyz.ymax # - donnees brutes print 'X min brut :', xyz.get_xmin(mask=False), xyz.get_x(mask=False).min()