Compare commits

...

3 Commits

Author SHA1 Message Date
冯冬卫 47f1b0cf37 modify2023-4-2 2 years ago
冯冬卫 b981e4fbf0 modify 2023-4-2 2 years ago
冯冬卫 68e719ae97 modify 2023-04-02 2 years ago

3
.idea/.gitignore vendored

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/program_1.iml" filepath="$PROJECT_DIR$/.idea/program_1.iml" />
</modules>
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>871</width>
<height>766</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>8</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>数据名:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="placeholderText">
<string>请输入数据名如data1.pos,data.pos</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>gWeight </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox">
<property name="value">
<number>15</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>levels:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_2">
<property name="minimumSize">
<size>
<width>36</width>
<height>20</height>
</size>
</property>
<property name="minimum">
<number>5</number>
</property>
<property name="stepType">
<enum>QAbstractSpinBox::AdaptiveDecimalStepType</enum>
</property>
<property name="value">
<number>14</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>井文件:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="placeholderText">
<string>请输入井文件名如well.txt</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="text">
<string>绘图</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3"/>
</item>
<item>
<widget class="QGraphicsView" name="graphicsView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,169 @@
168
148.3 51.1 3399.5 181.896
39.9 53.3 3381.6 281.464
56.6 -133.5 3408.2 444.495
-18.7 27.9 3391.1 565.336
-101.9 -40.6 3393.7 633.185
-84.7 -32.6 3395.7 727.757
123.8 13.4 3394.6 872.940
-68.7 -15.1 3390.7 999.104
-8.2 -84.7 3381.7 1101.427
20.6 18.7 3402.1 1250.124
6.6 -23.1 3395.3 1419.339
47 -19.9 3401.8 1608.589
72.5 93.6 3397.8 1700.163
45.5 -48 3391.1 1869.119
-49.8 5.7 3376.6 2065.702
-86.1 14.2 3386.8 2192.653
-8.3 -24.2 3389.6 2315.632
98.1 52.3 3402.5 2447.997
25 -39.9 3404.9 2537.608
-28.6 -101.7 3386.1 2708.270
24.9 -3.4 3397.5 2785.926
-2.3 -52.8 3404.1 2939.141
2.1 -2 3389.8 3045.125
-26 25 3384.5 3110.937
-126 24.7 3390.2 3207.461
-73.8 -62.2 3378.8 3319.875
-42.2 -18.7 3380.4 3437.201
-0.9 -38.3 3381.1 3562.799
-28.1 5.8 3386.9 3636.17
-102.2 93 3398.2 3766.726
17.3 35.2 3387.7 3883.261
-113 73.5 3396.8 4011.833
-33.8 -108.7 3397.6 4154.798
80.2 -76.7 3403.8 4324.489
-43.9 96.5 3386.8 4408.192
-56.4 -3.6 3390.4 4623.528
47.6 -118 3398 4740.353
24.1 39.1 3399.4 4844.247
36.2 55.3 3396.2 5003.832
-19.6 94 3397.9 5111.672
28.9 -7.4 3402.2 5224.29
60.6 -73.3 3384.9 5290.447
29.9 21 3402.1 5405.769
20.9 8.2 3398.1 5523.281
17.2 37.1 3399.4 5590.29
37.4 4.9 3394.3 5757.829
35.7 -77.2 3388.1 5826.650
-32.5 41.8 3387.2 5994.176
-38.2 92.8 3395.2 6176.337
-26.9 -6.1 3389.3 6315.656
30.3 -64.5 3381.6 6467.95
0.4 27.2 3399.2 6653.114
79.4 112.7 3385.5 6778.105
-1.9 102.6 3387.4 6909.2
67.5 2.5 3386.7 7044.364
11.2 9.8 3384.9 7133.658
35 169.3 3393.3 7266.248
-123 -30.2 3401.1 7403.31
33.3 -52.5 3400 7555.890
29.9 -25.8 3393.3 7628.279
-83.8 94 3399.5 7806.154
-20.9 -34.7 3375.7 7994.228
47.1 -25.9 3397.7 8119.363
-87.3 101.1 3388.8 8343.580
-34.6 53.8 3404.2 8505.657
47.9 24.9 3386.4 8594.292
4.4 2.8 3395.8 8713.984
-26.3 -108.1 3386.3 8870.40
5 68.5 3385.3 9029.961
20.2 -86.2 3382.2 9191.356
74.8 -93.4 3379.1 9262.467
-158.8 84.6 3403.3 9373.178
102.1 -64.5 3401.3 9459.657
50.4 46.5 3375.2 9565.598
-35.7 -91.9 3405.7 9699.872
-4.6 -41.2 3387.5 9821.975
-25.5 -62.5 3387.2 9894.588
31.1 -120.2 3378.7 10021.556
10.2 -58.8 3376.6 10119.946
116.2 3.5 3388.5 10270.230
-46.1 46.8 3376.3 10374.513
13.6 3.4 3385 10438.396
20.3 159.5 3400.3 10612.80
-46.8 60.5 3386.1 10686.806
-77.4 -49.9 3400.7 10832.546
77 -22.6 3379 11037.50
63.7 -89.2 3389.5 11218.832
34.2 40.2 3394.6 11355.443
-16.8 -6 3394.5 11482.404
38 -82.7 3393.3 11629.193
-5.8 82.5 3397.5 11733.227
10.5 97 3407 11844.65
13.8 -4.8 3381.2 12025.476
237.2 51.5 3381.5 12151.284
-47.6 39.8 3382 12226.309
22 157.5 3405.1 12351.685
-92.7 0 3393.8 12512.12
36.4 5.8 3373.1 12690.814
-13.7 78.6 3376.7 12814.922
-18.6 63.7 3395.1 12991.739
23.7 -30.5 3400.1 13177.130
-9.4 -61.7 3378.4 13338.450
23.4 53.9 3378.2 13468.281
-22 70.2 3377.6 13573.960
56.2 71.5 3397.4 13664.607
-133.2 21.8 3383.3 13799.479
4.5 85.7 3383.9 13949.509
18.5 15.4 3394 14148.966
-31 -35.1 3395.6 14304.224
-85.2 -37.5 3381.9 14423.342
-11 -40.6 3385.1 14546.236
-91.4 -67.6 3394.2 14694.161
104.6 -38.7 3394.2 14773.47
-33.7 141.6 3384.1 14865.767
105.4 -14.2 3378 15022.698
20 69.6 3377.2 15177.100
-81.6 -30.4 3387.7 15275.678
0.1 92.1 3375.6 15387.988
6.8 -53.7 3380.5 15542.38
98.5 68.7 3394.1 15616.86
5.7 48.3 3384.6 15703.586
-86.4 -79.5 3385 15795.561
-11.1 3.8 3387.6 15882.995
41 -57.3 3384.9 16012.142
-13.4 -120.5 3387.1 16094.985
35.5 14.9 3373.9 16169.788
79.6 -62.4 3379.5 16270.36
-24.4 -66.8 3388.6 16350.149
45.5 -89.7 3396 16468.753
26.7 -6.5 3393 16609.482
47.7 6.4 3383.8 16779.375
-15.4 -77.2 3398.7 16874.711
48.2 20.3 3401.2 17009.701
43.5 9 3380.1 17179.135
57.8 -12.2 3391.3 17273.578
12.1 25.5 3386 17418.895
12.2 -41.2 3389.6 17500.464
-87.6 -46.3 3395.8 17714.984
4.8 -9.6 3387.4 17872.32
-61.5 24.4 3390.5 18053.969
-19.8 -8.5 3402 18208.500
36.2 26.4 3386 18380.499
-13.2 56.4 3390.7 18454.376
14.6 139.4 3379.5 18636.789
-29.6 -75.4 3394.2 18773.720
-18.3 -23 3383.4 18871.590
51.4 -53.2 3394 19015.733
5.1 45.2 3391.8 19125.110
-60.5 0.9 3391.9 19297.574
-33.4 45.5 3388.9 19365.857
-5.2 14.4 3397.6 19529.190
36.1 14.2 3401.3 19661.28
-89.5 -46 3403.4 19818.99
48.2 -48.3 3380.5 19941.707
5.8 -21.1 3393.9 20089.7
36.2 -52.2 3390.2 20228.925
-38.1 -41.6 3379.3 20370.728
166.8 7.2 3378.6 20522.951
-0.2 0.3 3392.3 20587.265
49.2 -105.3 3389 20658.773
152.2 41.8 3381.9 20751.993
76.8 43.4 3388 20907.995
-14 19.3 3382.6 21106.365
-39.2 10.6 3395 21281.649
9.2 -48.1 3395.3 21396.805
12.8 66.7 3374.2 21541.777
-45.6 26.5 3398.1 21755.538
-35.1 9.9 3386.6 21912.614

@ -0,0 +1,192 @@
191
-35.2 -15.6 3382 54.395
-107.6 86.4 3372.1 144.763
66.6 162.1 3380.4 240.820
251.3 -137.4 3394.7 423.347
-152.1 -14.1 3375.9 524.943
-22.4 92.4 3381.7 637.568
157.5 59.1 3385.3 727.265
90 82.8 3374.1 870.392
13.8 30.7 3375.2 978.509
65.6 -134.9 3380.5 1041.359
-216.8 21 3393.1 1118.244
0.7 -87.5 3379.3 1196.407
88.6 -60.6 3380.8 1262.854
38.6 64.5 3390.7 1440.695
96.1 -72.5 3376.4 1497.699
101 -274.9 3381.2 1561.435
127.4 -56.9 3382.1 1632.677
159.3 -102.7 3395.3 1821.443
147.4 106.5 3386.4 1914.295
129.4 -35.4 3406.1 2042.296
-98.5 -96.8 3405.9 2161.491
-46.5 -91 3392 2312.197
-39.4 85.9 3380.3 2365.984
68.5 53.4 3404.6 2430.72
6.5 74.5 3372.6 2543.397
-132.1 121.8 3395.9 2598.169
-10.4 -26 3375.2 2716.174
-48.9 -93.6 3390.7 2796.302
246.3 -9.8 3385 2990.277
-58.1 -157.5 3388.1 3112.714
74.8 -161.8 3400.4 3256.314
-83.8 82.4 3374.6 3439.688
28.7 -134.9 3395.6 3533.169
-161.9 -129.4 3395.4 3678.872
68.2 82.3 3401.9 3869.69
45.5 112.2 3384.2 3930.92
156.9 13.9 3382.9 3991.483
-23.1 -46.1 3387.2 4124.900
121.7 168.5 3394.7 4178.836
77 -23.7 3381 4293.655
93.4 65 3402.3 4406.953
98.1 95.6 3398.7 4502.493
-168.9 66.2 3386.9 4664.161
252.4 148.2 3387.4 4780.228
125.6 13.2 3401.9 4833.596
172.7 84.3 3393.9 4942.853
48.9 -160.2 3371.6 5059.295
61.6 36.6 3383 5169.811
-125.8 123.6 3393.2 5295.327
-10.3 -163.1 3406 5382.191
-120.6 -8.9 3388.3 5464.662
-123.2 11.2 3403.6 5549.166
79.7 17.4 3402.4 5731.526
-145 -10.1 3397.6 5864.299
41.3 -41.8 3392.7 5949.131
-168.3 -280.9 3376.3 6148.218
-58.7 7.5 3407.3 6279.107
146.9 31 3400.7 6356.678
-56.6 81.1 3380.8 6499.252
1.7 170.3 3371.5 6633.223
-28.6 176.2 3391.6 6830.213
-16.4 162.8 3408.3 6902.228
-60 -182.5 3399.7 6955.213
209.5 83.9 3398.8 7060.469
73.9 -55.7 3379.1 7128.377
39.3 -24.4 3373 7232.393
-93.8 15.6 3396.7 7379.994
-169 -24.3 3396.5 7452.312
-159.6 56.3 3382.9 7510.622
-181.1 18.7 3398.4 7672.877
-107.6 101.2 3394.4 7722.559
-155.8 -2.2 3398 7804.675
-107.1 152.2 3385.8 7862.703
130.2 5.6 3374.8 8003.27
146.5 47.4 3384.6 8170.533
-176.4 29 3401.8 8235.483
118.1 168.6 3398.5 8420.588
-109.6 -18.2 3397.7 8539.11
-82.4 130.4 3389.5 8607.699
116.8 92.7 3386.3 8666.982
7.1 283.9 3396.8 8769.769
-46.1 22.5 3393.1 8847.503
-3.4 -65.4 3384 8998.728
201.3 -50.7 3403.7 9137.325
156 -179.5 3391.5 9270.907
-235.3 -1 3385.7 9404.39
87.8 -150.5 3384.3 9524.357
-251.7 2.7 3390 9625.319
-121.4 -21.3 3404.3 9786.325
-274.9 116.4 3391.1 9983.432
23.1 53.7 3399.4 10159.449
68 40.8 3399.5 10219.625
-38.3 134 3383 10338.590
-46.7 -71.6 3378.8 10400.610
251.9 267.7 3387.3 10518.0
183.5 -58.1 3385.6 10703.720
78.2 47.3 3381.8 10819.232
62.1 173.6 3396 10939.836
-20.1 -133.6 3389.4 11033.998
20 9.1 3388.7 11201.868
-64.6 -241.8 3380.7 11394.762
12.3 -167.9 3380.9 11516.445
-38.2 -112.3 3395.5 11593.138
-158.8 -90.5 3397.1 11760.585
-85.2 151.2 3390 11855.544
-35.2 -304.4 3392.8 11944.251
-153.1 -72.4 3401.5 12012.728
6.5 21.7 3387.5 12090.133
-53.7 249.8 3382.7 12173.121
8.9 249.2 3409.4 12363.290
-50.5 -118.2 3396.4 12469.823
-191.1 -120.6 3392.2 12580.427
-57.7 -253.5 3389.9 12733.109
13.4 24.4 3396.6 12864.853
-40.6 -152.6 3392.4 12949.14
-30.9 164.6 3385.5 13059.183
50.5 -19 3396.6 13175.47
-90.7 -308.2 3397.7 13307.662
-198.2 43 3378.3 13385.242
-91.2 104.8 3392.6 13486.976
68.6 180.5 3389.9 13661.668
-43.9 -57.9 3393.4 13838.218
125.7 274.4 3388.8 13908.768
-91.7 31.5 3398.6 14010.520
101.6 -66.4 3396.4 14135.375
44.4 151.9 3391.5 14243.442
20.4 -17.6 3400.2 14336.689
-176.3 333.7 3404.5 14470.233
23 7.8 3396.8 14544.610
-89.7 -159.9 3381.9 14707.751
38.1 -49.9 3400.2 14816.420
23.5 89.8 3382.9 14877.454
87.2 -92.3 3392.8 15063.550
-115.4 -102.2 3388.8 15184.149
285.5 10.6 3380.9 15303.452
93.3 -45.6 3392.1 15431.875
-101.8 -75.8 3390.9 15589.746
188.8 41 3395.7 15652.542
-15.5 -112.6 3398.9 15803.676
-20.3 -14.6 3395.1 15871.695
-202.9 64.6 3388.9 15936.624
53.6 -25.7 3373.9 16076.225
-316.4 -39.5 3394 16190.351
122.7 -26.4 3387.9 16339.851
56.6 106.8 3397.2 16451.496
-157.3 -188.8 3399.9 16597.867
15.2 185.7 3391.2 16694.52
-101.5 94.4 3381.2 16811.236
-17.1 -25.6 3386.3 16938.527
-118.4 189.8 3387 17012.406
-75.2 -25.2 3371.9 17089.853
26.2 194.7 3401.2 17243.194
-17.8 72.6 3394.8 17343.146
-53.6 -113.8 3406.1 17472.8
29.4 -93.3 3398.5 17611.236
-19.3 -21.1 3374.8 17734.236
42.7 -80.1 3388 17859.281
-45.6 194.7 3380.2 18000.553
-73.4 16.7 3394.3 18123.870
243.2 -88.3 3406.2 18303.845
19.9 46.4 3396.9 18360.136
170 7.4 3388 18450.881
159.7 -95.4 3392.4 18606.617
-187.6 -59.4 3387.8 18764.546
-58.3 -1.7 3399.1 18880.288
270.9 -162.3 3387.1 18991.327
141 -193 3388.3 19083.164
258.8 -173.8 3399.6 19224.845
-68.1 -33.7 3375.1 19358.347
-309.6 420.1 3401.4 19412.823
-15.5 -128.3 3392.1 19525.545
90.1 -16.3 3406 19632.654
132.2 -81.5 3386.6 19775.648
-76.7 -163.6 3404.5 19910.70
-4 -117.7 3378.9 20067.947
-95.4 64.5 3389.6 20208.230
151.2 126.9 3394.5 20263.194
-474 -140.6 3395.6 20404.470
0.9 42.4 3387.4 20537.756
183 87.3 3390 20649.171
-153.6 -33.6 3406.3 20737.469
57 77.6 3384.5 20826.565
239.9 24.3 3387 21017.517
2.1 158.2 3392.9 21175.581
-136 -224.1 3392.7 21302.360
163.7 -95.7 3389.1 21421.831
-54.1 10.8 3395.4 21622.320
-199.1 -181.9 3388.5 21825.63
164.9 142.4 3381.2 21922.128
45.7 -140.6 3397.5 21989.360
-254.4 -2.7 3386.4 22055.59

Binary file not shown.

@ -0,0 +1,134 @@
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.stats import gaussian_kde
from scipy.spatial.distance import cdist
import copy
class create():
def __init__(self):
"""
data is the x and y coordinate of data.pos
contours is the edge points
f is the kernel density value
levels is the levels for contours
x_range is the range of x label
y_range is the range of y label
"""
self.data = []
self.contours = []
self.f = []
self.levels = []
self.x_range = []
self.y_range = []
def data_pre(self, data_name):
with open(data_name, 'r') as f:
lines = f.readlines()
L_en=len(lines)
lines= lines[1:L_en]
data = []
for line in lines:
x, y,z,t = line.strip().split("\t")
data.append(list(map(float, [x,y])))
data = np.array(data)
self.data = data
self.x_range = [min(data[:, 0]), max(data[:,0])]
self.y_range = [min(data[:, 1]), max(data[:,1])]
def contours_pre(self, level_nums, gWeight):
x = self.data[:, 0]
y = self.data[:, 1]
# 使用scipy库中的gaussian_kde函数计算密度估计
kde = gaussian_kde(self.data.T)
# 生成网格点坐标
xx, yy = np.mgrid[x.min():x.max():200j, y.min():y.max():200j]
positions = np.vstack([xx.ravel(), yy.ravel()])
# 计算网格点上的密度估计值
f = np.reshape(kde(positions).T, xx.shape)
# 绘制等高线图
levels = []
for i in range(level_nums):
levels.append(f.max() - (level_nums - i - 1) * (f.max() - f.min()) / gWeight)
self.levels = levels
contours = plt.contour(xx, yy, f, levels=[levels[0], levels[level_nums - 1]], cmap='coolwarm', alpha=0)
plt.close()
self_contours = []
for i in range(len(contours.allsegs[0])):
self_contours += contours.allsegs[0][i].tolist()
for i in range(len(self_contours)):
if self_contours[i] not in self.contours:
self.contours += [self_contours[i]]
self.f = f
class well_to_edge():
def __init__(self):
"""
name is used to store the well names
type is the types of the wells
position is the coordinates of wells
min_distance is the minimum distances between wells and edge
welltoedge_points is the points responding to the min_distance
angle is the angles between the shortest distance direction vector from the well to the edge and the positive direction of the y-axis during clockwise rotation;
wells_num: the number of wells
"""
self.name = []
self.type = []
self.position = []
self.min_distance = []
self.welltoedge_points = []
self.angle = []
self.wells_num = 0
def wells_name_and_position(self, wells_name):
# 读取井位信息
with open(wells_name, 'r') as f_j:
j_ing = f_j.readlines()
points = []
typee = []
namee = []
for line in j_ing:
x, y, type, name = line.strip().split("\t")
points.append(list(map(float, [x, y])))
typee.append(list(map(int, [type])))
namee.append(name.split('\n'))
self.position = points
self.name = namee
self.type = typee
self.wells_num = len(points)
def welltoedge_distance(self, contour_points):
min_distance = []
contours_p=[]
angles=[]
wells_num = self.wells_num
points = self.position
# 定义待计算距离的点
for i in range(wells_num):
point = np.array([points[i][0], points[i][1]])
# 计算点到等高线上所有点之间的距离
distances = cdist(point.reshape(1, -1), contour_points)
# 取距离的最小值
min_distance.append(distances.min())
# 记录最短距离对应的点
for ii in range(distances.size):
if distances[0][ii] == min_distance[-1]:
contours_p.append(contour_points[ii])
# 计算角度y轴为正北方向
direct = contours_p[-1] - point
if direct[0] < 0:
angles.append(360-np.arccos(np.dot(direct, np.array(([0, 1]))) / np.linalg.norm(
direct)) / np.pi * 180)
else:
angles.append(np.arccos(np.dot(direct, np.array(([0, 1]))) / np.linalg.norm(
direct)) / np.pi * 180)
self.min_distance = min_distance
self.welltoedge_points = contours_p
self.angle = angles

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>871</width>
<height>766</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>8</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>数据名:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="placeholderText">
<string>请输入数据名如data1.pos,data.pos</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>gWeight </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox">
<property name="value">
<number>15</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>levels:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_2">
<property name="minimumSize">
<size>
<width>36</width>
<height>20</height>
</size>
</property>
<property name="minimum">
<number>5</number>
</property>
<property name="stepType">
<enum>QAbstractSpinBox::AdaptiveDecimalStepType</enum>
</property>
<property name="value">
<number>14</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>井文件:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="placeholderText">
<string>请输入井文件名如well.txt</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="text">
<string>绘图</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3"/>
</item>
<item>
<widget class="QGraphicsView" name="graphicsView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,169 @@
168
148.3 51.1 3399.5 181.896
39.9 53.3 3381.6 281.464
56.6 -133.5 3408.2 444.495
-18.7 27.9 3391.1 565.336
-101.9 -40.6 3393.7 633.185
-84.7 -32.6 3395.7 727.757
123.8 13.4 3394.6 872.940
-68.7 -15.1 3390.7 999.104
-8.2 -84.7 3381.7 1101.427
20.6 18.7 3402.1 1250.124
6.6 -23.1 3395.3 1419.339
47 -19.9 3401.8 1608.589
72.5 93.6 3397.8 1700.163
45.5 -48 3391.1 1869.119
-49.8 5.7 3376.6 2065.702
-86.1 14.2 3386.8 2192.653
-8.3 -24.2 3389.6 2315.632
98.1 52.3 3402.5 2447.997
25 -39.9 3404.9 2537.608
-28.6 -101.7 3386.1 2708.270
24.9 -3.4 3397.5 2785.926
-2.3 -52.8 3404.1 2939.141
2.1 -2 3389.8 3045.125
-26 25 3384.5 3110.937
-126 24.7 3390.2 3207.461
-73.8 -62.2 3378.8 3319.875
-42.2 -18.7 3380.4 3437.201
-0.9 -38.3 3381.1 3562.799
-28.1 5.8 3386.9 3636.17
-102.2 93 3398.2 3766.726
17.3 35.2 3387.7 3883.261
-113 73.5 3396.8 4011.833
-33.8 -108.7 3397.6 4154.798
80.2 -76.7 3403.8 4324.489
-43.9 96.5 3386.8 4408.192
-56.4 -3.6 3390.4 4623.528
47.6 -118 3398 4740.353
24.1 39.1 3399.4 4844.247
36.2 55.3 3396.2 5003.832
-19.6 94 3397.9 5111.672
28.9 -7.4 3402.2 5224.29
60.6 -73.3 3384.9 5290.447
29.9 21 3402.1 5405.769
20.9 8.2 3398.1 5523.281
17.2 37.1 3399.4 5590.29
37.4 4.9 3394.3 5757.829
35.7 -77.2 3388.1 5826.650
-32.5 41.8 3387.2 5994.176
-38.2 92.8 3395.2 6176.337
-26.9 -6.1 3389.3 6315.656
30.3 -64.5 3381.6 6467.95
0.4 27.2 3399.2 6653.114
79.4 112.7 3385.5 6778.105
-1.9 102.6 3387.4 6909.2
67.5 2.5 3386.7 7044.364
11.2 9.8 3384.9 7133.658
35 169.3 3393.3 7266.248
-123 -30.2 3401.1 7403.31
33.3 -52.5 3400 7555.890
29.9 -25.8 3393.3 7628.279
-83.8 94 3399.5 7806.154
-20.9 -34.7 3375.7 7994.228
47.1 -25.9 3397.7 8119.363
-87.3 101.1 3388.8 8343.580
-34.6 53.8 3404.2 8505.657
47.9 24.9 3386.4 8594.292
4.4 2.8 3395.8 8713.984
-26.3 -108.1 3386.3 8870.40
5 68.5 3385.3 9029.961
20.2 -86.2 3382.2 9191.356
74.8 -93.4 3379.1 9262.467
-158.8 84.6 3403.3 9373.178
102.1 -64.5 3401.3 9459.657
50.4 46.5 3375.2 9565.598
-35.7 -91.9 3405.7 9699.872
-4.6 -41.2 3387.5 9821.975
-25.5 -62.5 3387.2 9894.588
31.1 -120.2 3378.7 10021.556
10.2 -58.8 3376.6 10119.946
116.2 3.5 3388.5 10270.230
-46.1 46.8 3376.3 10374.513
13.6 3.4 3385 10438.396
20.3 159.5 3400.3 10612.80
-46.8 60.5 3386.1 10686.806
-77.4 -49.9 3400.7 10832.546
77 -22.6 3379 11037.50
63.7 -89.2 3389.5 11218.832
34.2 40.2 3394.6 11355.443
-16.8 -6 3394.5 11482.404
38 -82.7 3393.3 11629.193
-5.8 82.5 3397.5 11733.227
10.5 97 3407 11844.65
13.8 -4.8 3381.2 12025.476
237.2 51.5 3381.5 12151.284
-47.6 39.8 3382 12226.309
22 157.5 3405.1 12351.685
-92.7 0 3393.8 12512.12
36.4 5.8 3373.1 12690.814
-13.7 78.6 3376.7 12814.922
-18.6 63.7 3395.1 12991.739
23.7 -30.5 3400.1 13177.130
-9.4 -61.7 3378.4 13338.450
23.4 53.9 3378.2 13468.281
-22 70.2 3377.6 13573.960
56.2 71.5 3397.4 13664.607
-133.2 21.8 3383.3 13799.479
4.5 85.7 3383.9 13949.509
18.5 15.4 3394 14148.966
-31 -35.1 3395.6 14304.224
-85.2 -37.5 3381.9 14423.342
-11 -40.6 3385.1 14546.236
-91.4 -67.6 3394.2 14694.161
104.6 -38.7 3394.2 14773.47
-33.7 141.6 3384.1 14865.767
105.4 -14.2 3378 15022.698
20 69.6 3377.2 15177.100
-81.6 -30.4 3387.7 15275.678
0.1 92.1 3375.6 15387.988
6.8 -53.7 3380.5 15542.38
98.5 68.7 3394.1 15616.86
5.7 48.3 3384.6 15703.586
-86.4 -79.5 3385 15795.561
-11.1 3.8 3387.6 15882.995
41 -57.3 3384.9 16012.142
-13.4 -120.5 3387.1 16094.985
35.5 14.9 3373.9 16169.788
79.6 -62.4 3379.5 16270.36
-24.4 -66.8 3388.6 16350.149
45.5 -89.7 3396 16468.753
26.7 -6.5 3393 16609.482
47.7 6.4 3383.8 16779.375
-15.4 -77.2 3398.7 16874.711
48.2 20.3 3401.2 17009.701
43.5 9 3380.1 17179.135
57.8 -12.2 3391.3 17273.578
12.1 25.5 3386 17418.895
12.2 -41.2 3389.6 17500.464
-87.6 -46.3 3395.8 17714.984
4.8 -9.6 3387.4 17872.32
-61.5 24.4 3390.5 18053.969
-19.8 -8.5 3402 18208.500
36.2 26.4 3386 18380.499
-13.2 56.4 3390.7 18454.376
14.6 139.4 3379.5 18636.789
-29.6 -75.4 3394.2 18773.720
-18.3 -23 3383.4 18871.590
51.4 -53.2 3394 19015.733
5.1 45.2 3391.8 19125.110
-60.5 0.9 3391.9 19297.574
-33.4 45.5 3388.9 19365.857
-5.2 14.4 3397.6 19529.190
36.1 14.2 3401.3 19661.28
-89.5 -46 3403.4 19818.99
48.2 -48.3 3380.5 19941.707
5.8 -21.1 3393.9 20089.7
36.2 -52.2 3390.2 20228.925
-38.1 -41.6 3379.3 20370.728
166.8 7.2 3378.6 20522.951
-0.2 0.3 3392.3 20587.265
49.2 -105.3 3389 20658.773
152.2 41.8 3381.9 20751.993
76.8 43.4 3388 20907.995
-14 19.3 3382.6 21106.365
-39.2 10.6 3395 21281.649
9.2 -48.1 3395.3 21396.805
12.8 66.7 3374.2 21541.777
-45.6 26.5 3398.1 21755.538
-35.1 9.9 3386.6 21912.614

@ -0,0 +1,192 @@
191
-35.2 -15.6 3382 54.395
-107.6 86.4 3372.1 144.763
66.6 162.1 3380.4 240.820
251.3 -137.4 3394.7 423.347
-152.1 -14.1 3375.9 524.943
-22.4 92.4 3381.7 637.568
157.5 59.1 3385.3 727.265
90 82.8 3374.1 870.392
13.8 30.7 3375.2 978.509
65.6 -134.9 3380.5 1041.359
-216.8 21 3393.1 1118.244
0.7 -87.5 3379.3 1196.407
88.6 -60.6 3380.8 1262.854
38.6 64.5 3390.7 1440.695
96.1 -72.5 3376.4 1497.699
101 -274.9 3381.2 1561.435
127.4 -56.9 3382.1 1632.677
159.3 -102.7 3395.3 1821.443
147.4 106.5 3386.4 1914.295
129.4 -35.4 3406.1 2042.296
-98.5 -96.8 3405.9 2161.491
-46.5 -91 3392 2312.197
-39.4 85.9 3380.3 2365.984
68.5 53.4 3404.6 2430.72
6.5 74.5 3372.6 2543.397
-132.1 121.8 3395.9 2598.169
-10.4 -26 3375.2 2716.174
-48.9 -93.6 3390.7 2796.302
246.3 -9.8 3385 2990.277
-58.1 -157.5 3388.1 3112.714
74.8 -161.8 3400.4 3256.314
-83.8 82.4 3374.6 3439.688
28.7 -134.9 3395.6 3533.169
-161.9 -129.4 3395.4 3678.872
68.2 82.3 3401.9 3869.69
45.5 112.2 3384.2 3930.92
156.9 13.9 3382.9 3991.483
-23.1 -46.1 3387.2 4124.900
121.7 168.5 3394.7 4178.836
77 -23.7 3381 4293.655
93.4 65 3402.3 4406.953
98.1 95.6 3398.7 4502.493
-168.9 66.2 3386.9 4664.161
252.4 148.2 3387.4 4780.228
125.6 13.2 3401.9 4833.596
172.7 84.3 3393.9 4942.853
48.9 -160.2 3371.6 5059.295
61.6 36.6 3383 5169.811
-125.8 123.6 3393.2 5295.327
-10.3 -163.1 3406 5382.191
-120.6 -8.9 3388.3 5464.662
-123.2 11.2 3403.6 5549.166
79.7 17.4 3402.4 5731.526
-145 -10.1 3397.6 5864.299
41.3 -41.8 3392.7 5949.131
-168.3 -280.9 3376.3 6148.218
-58.7 7.5 3407.3 6279.107
146.9 31 3400.7 6356.678
-56.6 81.1 3380.8 6499.252
1.7 170.3 3371.5 6633.223
-28.6 176.2 3391.6 6830.213
-16.4 162.8 3408.3 6902.228
-60 -182.5 3399.7 6955.213
209.5 83.9 3398.8 7060.469
73.9 -55.7 3379.1 7128.377
39.3 -24.4 3373 7232.393
-93.8 15.6 3396.7 7379.994
-169 -24.3 3396.5 7452.312
-159.6 56.3 3382.9 7510.622
-181.1 18.7 3398.4 7672.877
-107.6 101.2 3394.4 7722.559
-155.8 -2.2 3398 7804.675
-107.1 152.2 3385.8 7862.703
130.2 5.6 3374.8 8003.27
146.5 47.4 3384.6 8170.533
-176.4 29 3401.8 8235.483
118.1 168.6 3398.5 8420.588
-109.6 -18.2 3397.7 8539.11
-82.4 130.4 3389.5 8607.699
116.8 92.7 3386.3 8666.982
7.1 283.9 3396.8 8769.769
-46.1 22.5 3393.1 8847.503
-3.4 -65.4 3384 8998.728
201.3 -50.7 3403.7 9137.325
156 -179.5 3391.5 9270.907
-235.3 -1 3385.7 9404.39
87.8 -150.5 3384.3 9524.357
-251.7 2.7 3390 9625.319
-121.4 -21.3 3404.3 9786.325
-274.9 116.4 3391.1 9983.432
23.1 53.7 3399.4 10159.449
68 40.8 3399.5 10219.625
-38.3 134 3383 10338.590
-46.7 -71.6 3378.8 10400.610
251.9 267.7 3387.3 10518.0
183.5 -58.1 3385.6 10703.720
78.2 47.3 3381.8 10819.232
62.1 173.6 3396 10939.836
-20.1 -133.6 3389.4 11033.998
20 9.1 3388.7 11201.868
-64.6 -241.8 3380.7 11394.762
12.3 -167.9 3380.9 11516.445
-38.2 -112.3 3395.5 11593.138
-158.8 -90.5 3397.1 11760.585
-85.2 151.2 3390 11855.544
-35.2 -304.4 3392.8 11944.251
-153.1 -72.4 3401.5 12012.728
6.5 21.7 3387.5 12090.133
-53.7 249.8 3382.7 12173.121
8.9 249.2 3409.4 12363.290
-50.5 -118.2 3396.4 12469.823
-191.1 -120.6 3392.2 12580.427
-57.7 -253.5 3389.9 12733.109
13.4 24.4 3396.6 12864.853
-40.6 -152.6 3392.4 12949.14
-30.9 164.6 3385.5 13059.183
50.5 -19 3396.6 13175.47
-90.7 -308.2 3397.7 13307.662
-198.2 43 3378.3 13385.242
-91.2 104.8 3392.6 13486.976
68.6 180.5 3389.9 13661.668
-43.9 -57.9 3393.4 13838.218
125.7 274.4 3388.8 13908.768
-91.7 31.5 3398.6 14010.520
101.6 -66.4 3396.4 14135.375
44.4 151.9 3391.5 14243.442
20.4 -17.6 3400.2 14336.689
-176.3 333.7 3404.5 14470.233
23 7.8 3396.8 14544.610
-89.7 -159.9 3381.9 14707.751
38.1 -49.9 3400.2 14816.420
23.5 89.8 3382.9 14877.454
87.2 -92.3 3392.8 15063.550
-115.4 -102.2 3388.8 15184.149
285.5 10.6 3380.9 15303.452
93.3 -45.6 3392.1 15431.875
-101.8 -75.8 3390.9 15589.746
188.8 41 3395.7 15652.542
-15.5 -112.6 3398.9 15803.676
-20.3 -14.6 3395.1 15871.695
-202.9 64.6 3388.9 15936.624
53.6 -25.7 3373.9 16076.225
-316.4 -39.5 3394 16190.351
122.7 -26.4 3387.9 16339.851
56.6 106.8 3397.2 16451.496
-157.3 -188.8 3399.9 16597.867
15.2 185.7 3391.2 16694.52
-101.5 94.4 3381.2 16811.236
-17.1 -25.6 3386.3 16938.527
-118.4 189.8 3387 17012.406
-75.2 -25.2 3371.9 17089.853
26.2 194.7 3401.2 17243.194
-17.8 72.6 3394.8 17343.146
-53.6 -113.8 3406.1 17472.8
29.4 -93.3 3398.5 17611.236
-19.3 -21.1 3374.8 17734.236
42.7 -80.1 3388 17859.281
-45.6 194.7 3380.2 18000.553
-73.4 16.7 3394.3 18123.870
243.2 -88.3 3406.2 18303.845
19.9 46.4 3396.9 18360.136
170 7.4 3388 18450.881
159.7 -95.4 3392.4 18606.617
-187.6 -59.4 3387.8 18764.546
-58.3 -1.7 3399.1 18880.288
270.9 -162.3 3387.1 18991.327
141 -193 3388.3 19083.164
258.8 -173.8 3399.6 19224.845
-68.1 -33.7 3375.1 19358.347
-309.6 420.1 3401.4 19412.823
-15.5 -128.3 3392.1 19525.545
90.1 -16.3 3406 19632.654
132.2 -81.5 3386.6 19775.648
-76.7 -163.6 3404.5 19910.70
-4 -117.7 3378.9 20067.947
-95.4 64.5 3389.6 20208.230
151.2 126.9 3394.5 20263.194
-474 -140.6 3395.6 20404.470
0.9 42.4 3387.4 20537.756
183 87.3 3390 20649.171
-153.6 -33.6 3406.3 20737.469
57 77.6 3384.5 20826.565
239.9 24.3 3387 21017.517
2.1 158.2 3392.9 21175.581
-136 -224.1 3392.7 21302.360
163.7 -95.7 3389.1 21421.831
-54.1 10.8 3395.4 21622.320
-199.1 -181.9 3388.5 21825.63
164.9 142.4 3381.2 21922.128
45.7 -140.6 3397.5 21989.360
-254.4 -2.7 3386.4 22055.59

@ -0,0 +1,131 @@
import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QGraphicsView
from PySide6.QtUiTools import QUiLoader
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
from PySide6.QtWidgets import QVBoxLayout
import CREAT
import numpy as np
import matplotlib as mpl
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.toolbar = None
self.canvas = None
# 加载UI文件
self.ui = QUiLoader().load('QT/PLT2.ui')
# 更新图窗
self.ui.graphicsView.repaint()
self.ui.graphicsView.update()
self.graphics_layout = QVBoxLayout(self.ui.graphicsView)
# 绘制Matplotlib图形
self.ui.pushButton_4.clicked.connect(lambda: self.plot_density())
def plot_density(self):
fig, ax = self.scene_fig()
data_name = self.ui.lineEdit.text().split(',')
level_nums = self.ui.spinBox_2.value()
gWeight = self.ui.spinBox.value()
data = CREAT.create()
zmin = 1
zmax = 0
for i in range(len(data_name)):
data.data_pre(data_name[i])
data.contours_pre(level_nums, gWeight)
"""画出密度等高线"""
f = data.f
x_min, x_max = data.x_range[0], data.x_range[1]
y_min, y_max = data.y_range[0], data.y_range[1]
levels = data.levels
xx, yy = np.mgrid[x_min:x_max:200j, y_min:y_max:200j]
# 填充等高线图中间的区域
cmap = mpl.colormaps.get_cmap('jet')
colors = cmap(np.linspace(0, 1, level_nums))
level = [levels[0], levels[-1]]
ff = ax.contourf(xx, yy, f, levels=level, colors=colors[level_nums - i - 1:level_nums - i], alpha=1,
zorder=len(data_name) - i)
zmin = min(zmin, ff.zmin)
zmax = max(zmax, ff.zmax)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_title('Density Distribution')
# 生成colorbar
sm = mpl.cm.ScalarMappable(cmap=cmap, norm=mpl.colors.Normalize(vmin=zmin, vmax=zmax))
sm.set_array([])
fig.colorbar(sm, ax=ax)
wells_name = self.ui.lineEdit_4.text()
if wells_name == '':
self.canvas_adjust(fig)
else:
wells = CREAT.well_to_edge()
wells.wells_name_and_position(wells_name)
wells.welltoedge_distance(data.contours)
"""画井位信息"""
typee = wells.type
points = wells.position
namee = wells.name
min_distance = wells.min_distance
contours_p = wells.welltoedge_points
for i in range(len(points)):
if typee[i][0] == 0:
ax.scatter(points[i][0], points[i][1], marker='o', edgecolors='black', facecolors='none', s=100)
ax.scatter(points[i][0], points[i][1], marker='o', edgecolors='black', facecolors='none', s=50,
linewidths=1)
ax.scatter(points[i][0], points[i][1], marker='o', edgecolors='black', facecolors='none', s=30)
ax.text(points[i][0] + min_distance[i] / 20, points[i][1] - min_distance[i] / 20, f'{namee[i][0]}',
fontdict={'size': '10', 'color': 'b'}, zorder=len(data_name) + 2) # 井名信息
else:
ax.scatter(points[i][0], points[i][1], marker='o', edgecolors='black', facecolors='black', s=100, zorder=len(data_name)+1)
ax.text(points[i][0] + min_distance[i] / 20, points[i][1] - min_distance[i] / 20, f'{namee[i][0]}',
fontdict={'size': '10', 'color': 'b'}, zorder=len(data_name) + 2) # 井名信息
continue
# 绘制油井边缘最短距离点的箭头并标出距离
ax.quiver(points[i][0], points[i][1], contours_p[i][0] - points[i][0], contours_p[i][1] - points[i][1],
angles='xy', scale=1.03,
scale_units='xy', width=0.002, zorder=len(data_name)+1) # 绘制箭头
ax.text(points[i][0] * 1 / 2 + contours_p[i][0] * 1 / 2 + min_distance[i] / 20,
points[i][1] * 1 / 2 + contours_p[i][1] * 1 / 2 - min_distance[i] / 20, f'{round(min_distance[i], 2)}',
fontdict={'size': '10', 'color': 'g'}) # 标出距离
# ax.text(points[i][0] * 1 / 2 + contours_p[i][0] * 1 / 2 + min_distance[i] / 20,
# points[i][1] * 1 / 2 + contours_p[i][1] * 1 / 2 - min_distance[i] / 20,
# r'$\theta$=' f'{round(wells.angle[i], 2)}', fontdict={'size': '10', 'color': 'y'}) # 标出角度
self.canvas_adjust(fig)
def scene_fig(self):
fig = Figure()
# 在Figure对象中添加子图
ax = fig.add_subplot(111)
return fig, ax
def canvas_adjust(self, fig):
if self.canvas is not None:
# 从布局中删除旧的 canvas 和 toolbar
item = self.graphics_layout.takeAt(0)
while item:
widget = item.widget()
if widget:
widget.setParent(None)
item = self.graphics_layout.takeAt(0)
self.graphics_layout.removeWidget(self.canvas)
self.canvas = FigureCanvas(fig)
self.toolbar = NavigationToolbar(self.canvas, self.ui.graphicsView)
self.toolbar.setParent(self.canvas)
self.graphics_layout.addWidget(self.canvas)
self.adjustSize()
if __name__ == '__main__':
app = QApplication([])
stats = MainWindow()
stats.ui.show()
app.exec()

@ -0,0 +1,6 @@
0 0 1 L40-5
-184 -243 0 L40-4
-258 178 0 L39-5
188 -169 0 L41-5
242 321 0 L40-6
446 180 0 L41-6

@ -93,12 +93,12 @@ class MainWindow(QMainWindow):
ax.quiver(points[i][0], points[i][1], contours_p[i][0] - points[i][0], contours_p[i][1] - points[i][1], ax.quiver(points[i][0], points[i][1], contours_p[i][0] - points[i][0], contours_p[i][1] - points[i][1],
angles='xy', scale=1.03, angles='xy', scale=1.03,
scale_units='xy', width=0.002, zorder=len(data_name)+1) # 绘制箭头 scale_units='xy', width=0.002, zorder=len(data_name)+1) # 绘制箭头
ax.text(points[i][0] * 1 / 9 + contours_p[i][0] * 8 / 9 + min_distance[i] / 20,
points[i][1] * 1 / 9 + contours_p[i][1] * 8 / 9 - min_distance[i] / 20, f'{round(min_distance[i], 2)}',
fontdict={'size': '10', 'color': 'g'}) # 标出距离
ax.text(points[i][0] * 1 / 2 + contours_p[i][0] * 1 / 2 + min_distance[i] / 20, ax.text(points[i][0] * 1 / 2 + contours_p[i][0] * 1 / 2 + min_distance[i] / 20,
points[i][1] * 1 / 2 + contours_p[i][1] * 1 / 2 - min_distance[i] / 20, points[i][1] * 1 / 2 + contours_p[i][1] * 1 / 2 - min_distance[i] / 20, f'{round(min_distance[i], 2)}',
r'$\theta$=' f'{round(wells.angle[i], 2)}', fontdict={'size': '10', 'color': 'y'}) # 标出角度 fontdict={'size': '10', 'color': 'g'}) # 标出距离
# ax.text(points[i][0] * 1 / 2 + contours_p[i][0] * 1 / 2 + min_distance[i] / 20,
# points[i][1] * 1 / 2 + contours_p[i][1] * 1 / 2 - min_distance[i] / 20,
# r'$\theta$=' f'{round(wells.angle[i], 2)}', fontdict={'size': '10', 'color': 'y'}) # 标出角度
self.canvas_adjust(fig) self.canvas_adjust(fig)
def scene_fig(self): def scene_fig(self):

@ -0,0 +1,6 @@
0 0 1 L40-5
-184 -243 0 L40-4
-258 178 0 L39-5
188 -169 0 L41-5
242 321 0 L40-6
446 180 0 L41-6
Loading…
Cancel
Save