zmk
2024-08-28 1ae38ab34bcbdff622c7623119ee54bad419f4ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 20 16:15:23 2023
 
@author: ZMK
"""
 
import numpy as np
import os
 
 
 
#成果模型的默认名字
not_allowed_model="202001_202212"
 
archive_models=["SP0-0","SP1-1","SP1-2","SP1-3","SP2-1","SP2-2","SP2-3","SP3-1",
            "SP3-2","SP3-4","SP3-5","SP3-6","SP3-7","SP4-1","SP4-7"]
 
# 生成的流场图文件
flow_file ="D:\\javaCode\\xishan\\xishan\\xishan\\xinshanFlow\\"
 
prefix ='C:\\Users\\ZMK\\Desktop\\xsModel2\\'
 
ZoneBudget64Exe= prefix + "zonebuget\\ZoneBudget64.exe"
 
water_bal_zones = prefix +"zonebuget\\water_bal.zones\n"
water_res_zones = prefix +"zonebuget\\water_res.zones\n"
 
water_lsh_path = prefix + "water_lsh.ini"
water_yhy_path = prefix + "water_yhy.ini"
water_dbw_path = prefix + "water_dbw.ini"
 
 
baseModel = prefix + 'verifyModel\\'
baseModel2 = prefix + 'verifyModel2\\'
 
predictModel= prefix + 'predictModel\\'
predictModel60 = prefix + 'predictModel60\\'
 
predictParamModel= prefix + 'predictParamModel\\'
 
muiltyModel =  prefix + 'muiltyModel\\'
 
model_dir = prefix + '0612Model\\'
 
obswellpath = prefix + '监测井.ini'
obswell_data_path=  prefix + 'water_obs_data.ini'
 
well_scale_path =  prefix + 'well_scale.ini'
 
obs_well = np.loadtxt(obswellpath, dtype=str,encoding='utf-8')
 
district_path = prefix +"区县.ini"
 
district= np.loadtxt(district_path, dtype=str,encoding='utf-8')
 
pumpwellpath = prefix +'抽水井.ini'
 
pump_well = np.loadtxt(pumpwellpath, dtype=str,encoding='utf-8')
 
period_path = prefix  +"period.json"
 
areapath = prefix + '分区.ini'
area_array = np.loadtxt(areapath, dtype=str,encoding='utf-8')
 
#水均衡路径
water_equ_path = prefix + 'water_equ.ini'
water_equ = np.loadtxt(water_equ_path, dtype=str,encoding='utf-8')
 
water_equ_path2022 = prefix + 'water_equ2022.ini'
water_equ2022 = np.loadtxt(water_equ_path2022, dtype=str,encoding='utf-8')
 
#地表高程数据
dis_top_path = prefix + 'md_dis_top.ini'
 
#分区的储水系数
lpf_path =  prefix + 'md_lpf.ini'
md_lpf =  np.loadtxt(lpf_path, dtype=str,encoding='utf-8')
 
# #玉泉山矩阵数据
yqs_path=  prefix + '玉泉山泉划分.ini'
xs_yqs_matrix =  np.loadtxt(yqs_path, dtype=str,encoding='utf-8')
 
# #山区平原区矩阵
xs_mp_path = prefix + '山区平原区划分.ini'
xs_mp_matrix =  np.loadtxt(xs_mp_path, dtype=str,encoding='utf-8')
 
           
model_config ='C:\\Users\\ZMK\\Desktop\\objclipdig\\ModelFlow_xishan\\config.ini'
 
model3d_path='D:/javaCode/xishan/xishan/xishan/output2/'
 
modeldata_csv_path ="C:/Users/ZMK/Desktop/xsModel2/0612Model/"
 
exe_path = 'C:/Users/ZMK/Desktop/objclipdig/ModelFlow_xishan/ModelFlow_xishan.exe'
 
#调动 exe 程序
def callModelexe():
    os.system(exe_path)
 
 
#更新模型的exe配置
def updateModelConfig(model_name):
    conf = np.loadtxt(model_config, dtype=str,encoding='utf-8')
    outpath = "outpath=" + model3d_path + model_name
    csvpath = "csvpath=" + modeldata_csv_path + model_name +"/output"
    conf[1]=outpath
    conf[2]=csvpath
    np.savetxt(model_config,conf, newline='\n', fmt='%s' , encoding='utf-8')
 
 
 
def getPumpWellName(row,column):
  
    for index, r, c,ids, qu ,name in pump_well:
        if r==row and c == column:
            return name
    
    return "NONE"
 
 
#获取矩阵分组的字典结构
def getAreas():
    arr = np.loadtxt(areapath, dtype=int)
    dict ={}
    for i in range(len(arr)):
        for j in range(len(arr[i])):  
            zb = str(arr[i][j])
            if arr[i][j] == -9999:         
                continue        
            if zb not in dict:
                dict[zb] = [(i,j)]         
            else:
                dict[zb].append((i,j))  
    return dict
 
 
def getAreaDictFirstIndex():
    arr = np.loadtxt(areapath, dtype=int)
    dict ={}
    for i in range(len(arr)):
        for j in range(len(arr[i])):           
            if arr[i][j] == -9999:         
                continue        
            if arr[i][j] not in dict:
                dict[arr[i][j]] = [(i,j)]         
             
    return dict
    
 
#获取分组小标字典数据
def getAreaDictIndexArray():
    arr = np.loadtxt(areapath, dtype=int)
    dict_array={}
    for i in range(len(arr)):
        for j in range(len(arr[i])):  
            zb= str(arr[i][j])
            if arr[i][j] == -9999:         
                continue        
            if zb not in dict_array:
                array= []
                index = getCellIdByRC(i+1,j+1)
                array.append(index)    
                dict_array[zb] = array                              
            else:            
                index = getCellIdByRC(i+1,j+1)
                dict_array[zb].append(index)
            
    return dict_array
 
 
def getCellIdByRC(rowVal, columnVal):   
    return (rowVal - 1) * 114 + columnVal - 1;