Ignore:
Timestamp:
01/07/13 10:30:35 (12 years ago)
Author:
jschierm
Message:

CHG: Get rid of more ugly Python logical nesting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/test/NightlyRun/test1108.py

    r14134 r14212  
    88from solve import *
    99from MatlabFuncs import *
     10from PythonFuncs import *
    1011
    1112"""
     
    3334        md.diagnostic.spcvz=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
    3435       
    35         pos=numpy.nonzero(numpy.logical_and(md.mesh.vertexonbed,numpy.logical_and(numpy.logical_or(md.mesh.x==0.,md.mesh.x==numpy.max(md.mesh.x)),numpy.logical_or(md.mesh.y==0.,md.mesh.y==numpy.max(md.mesh.y)))))
     36        pos=numpy.nonzero(logical_and_n(md.mesh.vertexonbed,numpy.logical_or(md.mesh.x==0.,md.mesh.x==numpy.max(md.mesh.x)),numpy.logical_or(md.mesh.y==0.,md.mesh.y==numpy.max(md.mesh.y))))
    3637        md.diagnostic.spcvx[pos]=0.
    3738        md.diagnostic.spcvy[pos]=0.
     
    4243        posx2=numpy.nonzero(md.mesh.x==numpy.max(md.mesh.x))[0]
    4344
    44         posy=numpy.nonzero(numpy.logical_and(numpy.logical_and(md.mesh.y==0.,md.mesh.x!=0.),md.mesh.x!=numpy.max(md.mesh.x)))[0]    #Don't take the same nodes two times
    45         posy2=numpy.nonzero(numpy.logical_and(numpy.logical_and(md.mesh.y==numpy.max(md.mesh.y),md.mesh.x!=0.),md.mesh.x!=numpy.max(md.mesh.x)))[0]
     45        posy=numpy.nonzero(logical_and_n(md.mesh.y==0.,md.mesh.x!=0.,md.mesh.x!=numpy.max(md.mesh.x)))[0]    #Don't take the same nodes two times
     46        posy2=numpy.nonzero(logical_and_n(md.mesh.y==numpy.max(md.mesh.y),md.mesh.x!=0.,md.mesh.x!=numpy.max(md.mesh.x)))[0]
    4647
    4748        md.diagnostic.vertex_pairing=numpy.vstack((numpy.hstack((posx.reshape(-1,1)+1,posx2.reshape(-1,1)+1)),numpy.hstack((posy.reshape(-1,1)+1,posy2.reshape(-1,1)+1))))
     
    5859        md.diagnostic.spcvy=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
    5960        md.diagnostic.spcvz=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
    60         pos=numpy.nonzero(numpy.logical_or(numpy.logical_or(md.mesh.y==0.,md.mesh.x==0.),numpy.logical_or(md.mesh.x==numpy.max(md.mesh.x),md.mesh.y==numpy.max(md.mesh.y))))    #Don't take the same nodes two times
     61        pos=numpy.nonzero(logical_or_n(md.mesh.y==0.,md.mesh.x==0.,md.mesh.x==numpy.max(md.mesh.x),md.mesh.y==numpy.max(md.mesh.y)))    #Don't take the same nodes two times
    6162        md.diagnostic.spcvx[pos]=md.results.DiagnosticSolution.Vx[pos]
    6263        md.diagnostic.spcvy[pos]=md.results.DiagnosticSolution.Vy[pos]
Note: See TracChangeset for help on using the changeset viewer.