Changeset 2607 in lmdz_wrf for trunk/tools/geometry_tools.py
- Timestamp:
- Jun 17, 2019, 12:02:20 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/geometry_tools.py
r2606 r2607 1311 1311 cuts[ic] = [icut, ecut, ipt, ept, Ncuts] 1312 1312 1313 for iic in range( 0):1313 for iic in range(1): 1314 1314 cutvs = cuts[iic] 1315 1315 icut = cutvs[0] … … 1362 1362 cutv = cuts[icc] 1363 1363 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 1364 1368 # Length of joining lines 1365 1369 Nadds = [] … … 1395 1399 for ic in range(Ncuts-1): 1396 1400 cutpolygon.append(ipt[ic]) 1397 1398 if ic == 0: 1401 if ic == 0: 1399 1402 for ip in range(icut[ic],N-1): cutpolygon.append(polygon[ip,:]) 1400 1403 for ip in range(icut[ic],ecut[ic]): cutpolygon.append(polygon[ip,:]) 1401 1404 # 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] 1403 1406 dx = (ipt[ic+1][1] - ept[ic][1])/(Nadds[ic]-1) 1404 1407 dy = (ipt[ic+1][0] - ept[ic][0])/(Nadds[ic]-1) 1405 1408 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] 1407 1412 for ip in range(icut[ic],ecut[ic]): cutpolygon.append(polygon[ip,:]) 1408 1413 # right side … … 1417 1422 for ip in range(1,Nadds[ic]-1): 1418 1423 cutpolygon.append([ept[ic,0]+dy*ip, ept[ic,0]+dy*ip]) 1424 ic = Ncuts-1 1419 1425 for ip in range(icut[ic],ecut[ic]): cutpolygon.append(polygon[ip,:]) 1420 1426 for ip in range(ecut[ic],N-1): cutpolygon.append(polygon[ip,:]) 1421 1427 sides[iic] = cutpolygon 1428 for ip in range(len(cutpolygon)): iic, ip, ':', cutpolygon[ip] 1422 1429 1423 1430 # joining sides by e1[Ncuts1-1] --> i2[0]; e2[Ncuts2-1] --> i1[0] 1424 1431 cutv1 = cuts[0] 1425 1432 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] 1428 1435 ept1 = cutv1[3][Ncuts1-1] 1429 ipt1 = cutv1[ 4][0]1436 ipt1 = cutv1[2][0] 1430 1437 1431 1438 cutv2 = cuts[0] 1432 1439 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] 1435 1442 ept2 = cutv2[3][Ncuts1-1] 1436 ipt2 = cutv2[ 4][0]1443 ipt2 = cutv2[2][0] 1437 1444 1438 1445 finalcutpolygon = sides[0]
Note: See TracChangeset
for help on using the changeset viewer.