Compare commits
	
		
			No commits in common. '089aa0008dfa1295c43e4adc8d052eb05b49864f' and 'bb80232bc37b8953b4f329932c4d546e0c55c529' have entirely different histories. 
		
	
	
		
			089aa0008d
			...
			bb80232bc3
		
	
		
	| @ -1,113 +0,0 @@ | |||||||
| 112 |  | ||||||
| -45.9	-71.2	1009.9	10.384 |  | ||||||
| -74.3	135.3	1006.9	65.182 |  | ||||||
| 4.1	-38.5	1007.9	96.275 |  | ||||||
| -6	148.3	1006.9	254.818 |  | ||||||
| 26.9	-5.9	1005.9	353.900 |  | ||||||
| -80.9	-10.8	1006.9	400.117 |  | ||||||
| -12.7	-127.7	1006.9	554.83 |  | ||||||
| 66.9	-31.1	1009.9	837.881 |  | ||||||
| -28.1	-39.8	1006.9	1031.90 |  | ||||||
| -32.8	20.5	1006.9	1281.306 |  | ||||||
| 36.5	-25.1	1006.9	1411.553 |  | ||||||
| -92.1	13.7	1006.9	1439.940 |  | ||||||
| -79.2	105.5	1011.9	1500.433 |  | ||||||
| 99.7	63.1	1006.9	1542.607 |  | ||||||
| -26.3	3.3	1006.9	1549.297 |  | ||||||
| -63.1	-0.1	1010.9	1685.309 |  | ||||||
| -11.3	4.1	1004.9	1923.693 |  | ||||||
| 34.6	-51.2	1006.9	2083.725 |  | ||||||
| 36	69.5	1001.9	2136.755 |  | ||||||
| 177.9	0.5	1012.9	2311.923 |  | ||||||
| -3.7	-5.8	1003.9	2345.193 |  | ||||||
| -8.1	-9	1004.9	2497.272 |  | ||||||
| -18.1	-5.2	1001.9	2673.628 |  | ||||||
| 109.9	1.4	1006.9	2687.248 |  | ||||||
| 137.8	-41.5	1006.9	2729.813 |  | ||||||
| 44	-0.5	1008.9	2908.834 |  | ||||||
| -5.2	-32.3	1006.9	2913.675 |  | ||||||
| 198.3	60.8	1006.9	3084.214 |  | ||||||
| 11.1	-91.6	1006.9	3298.919 |  | ||||||
| -4.9	4.9	1013.9	3523.955 |  | ||||||
| 19.6	-35.7	1008.9	3695.617 |  | ||||||
| -37.4	-26.9	1008.9	3916.784 |  | ||||||
| 137.6	-42.9	1008.9	3938.952 |  | ||||||
| 7.1	-10.1	1006.9	4063.108 |  | ||||||
| 80.6	-103.8	1006.9	4107.944 |  | ||||||
| 8.9	-20.9	1006.9	4183.385 |  | ||||||
| -44	-6	1007.9	4310.811 |  | ||||||
| -50.1	28.4	1009.9	4491.107 |  | ||||||
| 104	97.2	1001.9	4715.866 |  | ||||||
| -60.3	-41.4	1006.9	4772.88 |  | ||||||
| 61.3	58.9	1006.9	5042.962 |  | ||||||
| -121.1	-82.8	1006.9	5181.381 |  | ||||||
| 31.5	-22.7	1002.9	5373.757 |  | ||||||
| -41.9	170	1006.9	5472.766 |  | ||||||
| -7.3	5.2	1006.9	5521.58 |  | ||||||
| 82.8	102.9	1011.9	5636.275 |  | ||||||
| 154.7	106.1	1011.9	5756.394 |  | ||||||
| -37.8	18.5	998.9	5880.473 |  | ||||||
| -151.5	-1.2	1005.9	5907.330 |  | ||||||
| 10.2	4.8	1007.9	6024.836 |  | ||||||
| 80.3	26.1	1002.9	6050.715 |  | ||||||
| -144.7	-101.9	1004.9	6163.211 |  | ||||||
| 9.1	-57.8	1006.9	6404.898 |  | ||||||
| -122.7	-22.3	1011.9	6442.493 |  | ||||||
| 8	2.4	1007.9	6652.171 |  | ||||||
| -182.8	-0.4	1004.9	6935.490 |  | ||||||
| 25	48.1	1006.9	7113.943 |  | ||||||
| -93.6	116.2	1006.9	7237.796 |  | ||||||
| -110.2	-14	1006.9	7414.765 |  | ||||||
| -101.6	-19.4	1014.9	7642.493 |  | ||||||
| -76.8	-12.3	1007.9	7755.607 |  | ||||||
| 1.6	-26.1	1008.9	7814.322 |  | ||||||
| -201.5	1.2	1006.9	7915.129 |  | ||||||
| 37.5	63.5	1004.9	8003.43 |  | ||||||
| 21.2	-173.7	1006.9	8089.478 |  | ||||||
| -5.5	143.1	1004.9	8316.296 |  | ||||||
| -67.6	-52.5	1007.9	8394.665 |  | ||||||
| -156.4	15.6	1010.9	8604.577 |  | ||||||
| -89.1	31.6	1007.9	8730.251 |  | ||||||
| -34.6	-29.8	1006.9	8874.838 |  | ||||||
| 11.5	-131.3	1008.9	8938.423 |  | ||||||
| 10.2	4.9	1004.9	8958.814 |  | ||||||
| 9.2	-46.1	1006.9	9135.222 |  | ||||||
| 95.2	171	1010.9	9267.394 |  | ||||||
| 19.3	50.3	1010.9	9344.557 |  | ||||||
| 127.7	-61.9	1010.9	9574.948 |  | ||||||
| 7.5	-96.9	1005.9	9668.554 |  | ||||||
| 6.1	-74.5	1008.9	9855.509 |  | ||||||
| -148.6	22.3	1009.9	9903.75 |  | ||||||
| 39.2	103.1	1010.9	10066.866 |  | ||||||
| -80.4	48	1006.9	10208.58 |  | ||||||
| 157.1	101.1	1006.9	10490.953 |  | ||||||
| -92	30.2	1007.9	10499.380 |  | ||||||
| 111.1	73.2	1009.9	10643.279 |  | ||||||
| 1.4	-29.7	1006.9	10690.866 |  | ||||||
| 9.7	-141.4	1007.9	10804.785 |  | ||||||
| -0.4	2.5	1003.9	11081.846 |  | ||||||
| -8.9	-144.1	1000.9	11233.580 |  | ||||||
| -92.8	-26.4	1009.9	11419.149 |  | ||||||
| -35.8	38.4	1006.9	11657.103 |  | ||||||
| 62.8	149.6	1006.9	11853.628 |  | ||||||
| 40.7	73.8	1009.9	11895.399 |  | ||||||
| -38.8	-56.2	1004.9	12158.102 |  | ||||||
| 69.3	-101.4	1004.9	12196.795 |  | ||||||
| -7.4	-4.4	1000.9	12254.790 |  | ||||||
| -176.5	-81.9	1001.9	12306.909 |  | ||||||
| -34.5	-42.2	1008.9	12375.591 |  | ||||||
| -2.5	3.9	1010.9	12391.64 |  | ||||||
| -2.5	-1	1008.9	12561.584 |  | ||||||
| -128.9	-34.1	1006.9	12669.326 |  | ||||||
| 83.6	52.6	1001.9	12799.414 |  | ||||||
| -48.4	28.4	1005.9	13009.623 |  | ||||||
| -55.2	20.7	1002.9	13277.377 |  | ||||||
| 2	-8.8	1010.9	13432.271 |  | ||||||
| -63.7	62.3	1006.9	13496.217 |  | ||||||
| 29.3	29.6	1007.9	13550.730 |  | ||||||
| 26	-0.2	1009.9	13572.226 |  | ||||||
| 108.2	104.8	1006.9	13675.451 |  | ||||||
| -34.5	129	1006.9	14009.216 |  | ||||||
| 113.9	133.5	1006.9	14096.519 |  | ||||||
| -32.7	-58.4	1006.9	14356.918 |  | ||||||
| 1	45.2	1003.9	14454.743 |  | ||||||
| @ -1,114 +0,0 @@ | |||||||
| 112 |  | ||||||
| -45.9	-71.2	1009.9	10.384 |  | ||||||
| -74.3	135.3	1006.9	65.182 |  | ||||||
| 4.1	-38.5	1007.9	96.275 |  | ||||||
| -6	148.3	1006.9	254.818 |  | ||||||
| 26.9	-5.9	1005.9	353.900 |  | ||||||
| -80.9	-10.8	1006.9	400.117 |  | ||||||
| -12.7	-127.7	1006.9	554.83 |  | ||||||
| 66.9	-31.1	1009.9	837.881 |  | ||||||
| -28.1	-39.8	1006.9	1031.90 |  | ||||||
| -32.8	20.5	1006.9	1281.306 |  | ||||||
| 36.5	-25.1	1006.9	1411.553 |  | ||||||
| -92.1	13.7	1006.9	1439.940 |  | ||||||
| -79.2	105.5	1011.9	1500.433 |  | ||||||
| 99.7	63.1	1006.9	1542.607 |  | ||||||
| -26.3	3.3	1006.9	1549.297 |  | ||||||
| -63.1	-0.1	1010.9	1685.309 |  | ||||||
| -11.3	4.1	1004.9	1923.693 |  | ||||||
| 34.6	-51.2	1006.9	2083.725 |  | ||||||
| 36	69.5	1001.9	2136.755 |  | ||||||
| 177.9	0.5	1012.9	2311.923 |  | ||||||
| -3.7	-5.8	1003.9	2345.193 |  | ||||||
| -8.1	-9	1004.9	2497.272 |  | ||||||
| -18.1	-5.2	1001.9	2673.628 |  | ||||||
| 109.9	1.4	1006.9	2687.248 |  | ||||||
| 137.8	-41.5	1006.9	2729.813 |  | ||||||
| 44	-0.5	1008.9	2908.834 |  | ||||||
| -5.2	-32.3	1006.9	2913.675 |  | ||||||
| 198.3	60.8	1006.9	3084.214 |  | ||||||
| 11.1	-91.6	1006.9	3298.919 |  | ||||||
| -4.9	4.9	1013.9	3523.955 |  | ||||||
| 19.6	-35.7	1008.9	3695.617 |  | ||||||
| -37.4	-26.9	1008.9	3916.784 |  | ||||||
| 137.6	-42.9	1008.9	3938.952 |  | ||||||
| 7.1	-10.1	1006.9	4063.108 |  | ||||||
| 80.6	-103.8	1006.9	4107.944 |  | ||||||
| 8.9	-20.9	1006.9	4183.385 |  | ||||||
| -44	-6	1007.9	4310.811 |  | ||||||
| -50.1	28.4	1009.9	4491.107 |  | ||||||
| 104	97.2	1001.9	4715.866 |  | ||||||
| -60.3	-41.4	1006.9	4772.88 |  | ||||||
| 61.3	58.9	1006.9	5042.962 |  | ||||||
| -121.1	-82.8	1006.9	5181.381 |  | ||||||
| 31.5	-22.7	1002.9	5373.757 |  | ||||||
| -41.9	170	1006.9	5472.766 |  | ||||||
| -7.3	5.2	1006.9	5521.58 |  | ||||||
| 82.8	102.9	1011.9	5636.275 |  | ||||||
| 154.7	106.1	1011.9	5756.394 |  | ||||||
| -37.8	18.5	998.9	5880.473 |  | ||||||
| -151.5	-1.2	1005.9	5907.330 |  | ||||||
| 10.2	4.8	1007.9	6024.836 |  | ||||||
| 80.3	26.1	1002.9	6050.715 |  | ||||||
| -144.7	-101.9	1004.9	6163.211 |  | ||||||
| 9.1	-57.8	1006.9	6404.898 |  | ||||||
| -122.7	-22.3	1011.9	6442.493 |  | ||||||
| 8	2.4	1007.9	6652.171 |  | ||||||
| -182.8	-0.4	1004.9	6935.490 |  | ||||||
| 25	48.1	1006.9	7113.943 |  | ||||||
| -93.6	116.2	1006.9	7237.796 |  | ||||||
| -110.2	-14	1006.9	7414.765 |  | ||||||
| -101.6	-19.4	1014.9	7642.493 |  | ||||||
| -76.8	-12.3	1007.9	7755.607 |  | ||||||
| 1.6	-26.1	1008.9	7814.322 |  | ||||||
| -201.5	1.2	1006.9	7915.129 |  | ||||||
| 47.5	67.5	1001.9	8009.43 |  | ||||||
| 21.3	-173.7	1006.9	8089.478 |  | ||||||
| -1.5	143.1	1004.9	8616.296 |  | ||||||
| -6.6	-52.5	1027.9	8394.665 |  | ||||||
| -16.4	15.6	1310.9	8694.577 |  | ||||||
| -89.1	31.6	1007.9	8730.251 |  | ||||||
| -34.6	-29.8	1006.9	8874.838 |  | ||||||
| 11.5	-131.3	1008.9	8938.423 |  | ||||||
| 10.2	4.9	1004.9	8958.814 |  | ||||||
| 9.2	-46.1	1006.9	9135.222 |  | ||||||
| 95.2	171	1010.9	9267.394 |  | ||||||
| 19.3	50.3	1010.9	9344.557 |  | ||||||
| 127.7	-61.9	1010.9	9574.948 |  | ||||||
| 7.5	-96.9	1005.9	9668.554 |  | ||||||
| 6.1	-74.5	1008.9	9855.509 |  | ||||||
| -148.6	22.3	1009.9	9903.75 |  | ||||||
| 39.2	103.1	1010.9	10066.866 |  | ||||||
| -80.4	48	1006.9	10208.58 |  | ||||||
| 157.1	101.1	1006.9	10490.953 |  | ||||||
| -92	30.2	1007.9	10499.380 |  | ||||||
| 111.1	73.2	1009.9	10643.279 |  | ||||||
| 1.4	-29.7	1006.9	10690.866 |  | ||||||
| 9.7	-141.4	1007.9	10804.785 |  | ||||||
| -0.4	2.5	1003.9	11081.846 |  | ||||||
| -8.9	-144.1	1000.9	11233.580 |  | ||||||
| -92.8	-26.4	1009.9	11419.149 |  | ||||||
| -35.8	38.4	1006.9	11657.103 |  | ||||||
| 62.8	149.6	1006.9	11853.628 |  | ||||||
| 40.7	73.8	1009.9	11895.399 |  | ||||||
| -38.8	-56.2	1004.9	12158.102 |  | ||||||
| 69.3	-101.4	1004.9	12196.795 |  | ||||||
| -7.4	-4.4	1000.9	12254.790 |  | ||||||
| -176.5	-81.9	1001.9	12306.909 |  | ||||||
| -34.5	-42.2	1008.9	12375.591 |  | ||||||
| -2.5	3.9	1010.9	12391.64 |  | ||||||
| -2.5	-1	1008.9	12561.584 |  | ||||||
| -128.9	-34.1	1006.9	12669.326 |  | ||||||
| 83.6	52.6	1001.9	12799.414 |  | ||||||
| -48.4	28.4	1005.9	13009.623 |  | ||||||
| -55.2	20.7	1002.9	13277.377 |  | ||||||
| 2	-8.8	1010.9	13432.271 |  | ||||||
| -63.7	62.3	1006.9	13496.217 |  | ||||||
| 29.3	29.6	1007.9	13550.730 |  | ||||||
| 26	-0.2	1009.9	13572.226 |  | ||||||
| 108.2	104.8	1006.9	13675.451 |  | ||||||
| -34.5	129	1006.9	14009.216 |  | ||||||
| 113.9	133.5	1006.9	14096.519 |  | ||||||
| -32.7	-58.4	1006.9	14356.918 |  | ||||||
| 1	45.2	1003.9	14454.743 |  | ||||||
| -145.3	32.2	1008.9	14323.789 |  | ||||||
| @ -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 / 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, | ||||||
|  |                         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() | ||||||
					Loading…
					
					
				
		Reference in New Issue