Changeset 2607 in lmdz_wrf for trunk/tools/geometry_tools.py


Ignore:
Timestamp:
Jun 17, 2019, 12:02:20 AM (5 years ago)
Author:
lfita
Message:

Working ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/geometry_tools.py

    r2606 r2607  
    13111311            cuts[ic] = [icut, ecut, ipt, ept, Ncuts]
    13121312
    1313     for iic in range(0):
     1313    for iic in range(1):
    13141314        cutvs = cuts[iic]
    13151315        icut = cutvs[0]
     
    13621362        cutv = cuts[icc]
    13631363        Ncuts = cutv[4]
     1364        print '  icc:', icc, 'ic ec ipt ept _______'
     1365        for ic in range(Ncuts):
     1366            print ic, ':', cutv[0][ic], cutv[1][ic], cutv[2][ic], cutv[3][ic]
     1367
    13641368        # Length of joining lines
    13651369        Nadds = []
     
    13951399            for ic in range(Ncuts-1):
    13961400                cutpolygon.append(ipt[ic])
    1397 
    1398                 if ic == 0:
     1401                if ic == 0:
    13991402                    for ip in range(icut[ic],N-1): cutpolygon.append(polygon[ip,:])
    14001403                for ip in range(icut[ic],ecut[ic]): cutpolygon.append(polygon[ip,:])
    14011404                # line
    1402                 print 'Lluis ipt+1', ipt[ic+1], 'ept', ept[ic], 'Nadds:', Nadds[ic]
     1405                print 'Lluis ept', ept[ic], 'ipt+1', ipt[ic+1], 'Nadds:', Nadds[ic]
    14031406                dx = (ipt[ic+1][1] - ept[ic][1])/(Nadds[ic]-1)
    14041407                dy = (ipt[ic+1][0] - ept[ic][0])/(Nadds[ic]-1)
    14051408                for ip in range(1,Nadds[ic]-1):
    1406                     cutpolygon.append([ept[ic][0]+dy*ip, ept[ic][0]+dy*ip])
     1409                    cutpolygon.append([ept[ic][0]+dy*ip, ept[ic][1]+dy*ip])
     1410            ic = Ncuts-1
     1411            print ic, 'final', iic,' :', icut[ic], ecut[ic]
    14071412            for ip in range(icut[ic],ecut[ic]): cutpolygon.append(polygon[ip,:])
    14081413        # right side
     
    14171422                for ip in range(1,Nadds[ic]-1):
    14181423                    cutpolygon.append([ept[ic,0]+dy*ip, ept[ic,0]+dy*ip])
     1424            ic = Ncuts-1
    14191425            for ip in range(icut[ic],ecut[ic]): cutpolygon.append(polygon[ip,:])
    14201426            for ip in range(ecut[ic],N-1): cutpolygon.append(polygon[ip,:])
    14211427        sides[iic] = cutpolygon
     1428        for ip in range(len(cutpolygon)): iic, ip, ':', cutpolygon[ip]
    14221429       
    14231430    # joining sides by e1[Ncuts1-1] --> i2[0]; e2[Ncuts2-1] --> i1[0]
    14241431    cutv1 = cuts[0]
    14251432    Ncuts1 = cutv1[4]
    1426     ec1 = cutv1[2][Ncuts1-1]
    1427     ic1 = cutv1[1][0]
     1433    ec1 = cutv1[1][Ncuts1-1]
     1434    ic1 = cutv1[0][0]
    14281435    ept1 = cutv1[3][Ncuts1-1]
    1429     ipt1 = cutv1[4][0]
     1436    ipt1 = cutv1[2][0]
    14301437
    14311438    cutv2 = cuts[0]
    14321439    Ncuts2 = cutv2[4]
    1433     ec2 = cutv2[2][Ncuts1-1]
    1434     ic2 = cutv2[1][0]
     1440    ec2 = cutv2[1][Ncuts1-1]
     1441    ic2 = cutv2[0][0]
    14351442    ept2 = cutv2[3][Ncuts1-1]
    1436     ipt2 = cutv2[4][0]
     1443    ipt2 = cutv2[2][0]
    14371444
    14381445    finalcutpolygon = sides[0]
Note: See TracChangeset for help on using the changeset viewer.