# -*- 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;
|
|
|
|
|
|
|
|
|