你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 23:14:03 +08:00
Implemented searching for available outputs.
这个提交包含在:
@@ -30,40 +30,34 @@ args = parser.parse_args()
|
|||||||
|
|
||||||
basefilename = args.basefilename
|
basefilename = args.basefilename
|
||||||
modelruns = args.modelruns
|
modelruns = args.modelruns
|
||||||
outputfile = basefilename + '_all.out'
|
outputfile = basefilename + '_merge.out'
|
||||||
path = '/rxs/rx1'
|
path = '/rxs/rx1'
|
||||||
|
|
||||||
# Combined output file
|
# Combined output file
|
||||||
fout = h5py.File(outputfile, 'w')
|
fout = h5py.File(outputfile, 'w')
|
||||||
|
|
||||||
# Add positional data for rxs
|
# Add positional data for rxs
|
||||||
for rx in range(modelruns):
|
for model in range(modelruns):
|
||||||
fin = h5py.File(basefilename + str(rx + 1) + '.out', 'r')
|
fin = h5py.File(basefilename + str(model + 1) + '.out', 'r')
|
||||||
if rx == 0:
|
availableoutputs = list(fin[path].keys())
|
||||||
|
if model == 0:
|
||||||
fout.attrs['Iterations'] = fin.attrs['Iterations']
|
fout.attrs['Iterations'] = fin.attrs['Iterations']
|
||||||
fout.attrs['dt'] = fin.attrs['dt']
|
fout.attrs['dt'] = fin.attrs['dt']
|
||||||
fields = fout.create_group(path)
|
fields = fout.create_group(path)
|
||||||
fields['Ex'] = np.zeros((fout.attrs['Iterations'], modelruns), dtype=fin[path + '/Ex'].dtype)
|
for output in availableoutputs:
|
||||||
fields['Ey'] = np.zeros((fout.attrs['Iterations'], modelruns), dtype=fin[path + '/Ex'].dtype)
|
fields[output] = np.zeros((fout.attrs['Iterations'], modelruns), dtype=fin[path + '/' + output].dtype)
|
||||||
fields['Ez'] = np.zeros((fout.attrs['Iterations'], modelruns), dtype=fin[path + '/Ex'].dtype)
|
|
||||||
fields['Hx'] = np.zeros((fout.attrs['Iterations'], modelruns), dtype=fin[path + '/Ex'].dtype)
|
for output in availableoutputs:
|
||||||
fields['Hy'] = np.zeros((fout.attrs['Iterations'], modelruns), dtype=fin[path + '/Ex'].dtype)
|
fields[path + '/' + output][:,model] = fin[path + '/' + output][:]
|
||||||
fields['Hz'] = np.zeros((fout.attrs['Iterations'], modelruns), dtype=fin[path + '/Ex'].dtype)
|
|
||||||
|
|
||||||
fields[path + '/Ex'][:,rx] = fin[path + '/Ex'][:]
|
|
||||||
fields[path + '/Ey'][:,rx] = fin[path + '/Ey'][:]
|
|
||||||
fields[path + '/Ez'][:,rx] = fin[path + '/Ez'][:]
|
|
||||||
fields[path + '/Hx'][:,rx] = fin[path + '/Hx'][:]
|
|
||||||
fields[path + '/Hy'][:,rx] = fin[path + '/Hy'][:]
|
|
||||||
fields[path + '/Hz'][:,rx] = fin[path + '/Hz'][:]
|
|
||||||
fin.close()
|
fin.close()
|
||||||
|
|
||||||
fout.close()
|
fout.close()
|
||||||
|
|
||||||
check = input('Do you want to remove the multiple individual output files? [y] or n:')
|
check = input('Do you want to remove the multiple individual output files? [y] or n:')
|
||||||
if not check or check == 'y':
|
if not check or check == 'y':
|
||||||
for rx in range(modelruns):
|
for model in range(modelruns):
|
||||||
file = basefilename + str(rx + 1) + '.out'
|
file = basefilename + str(model + 1) + '.out'
|
||||||
os.remove(file)
|
os.remove(file)
|
||||||
|
|
||||||
|
|
||||||
|
在新工单中引用
屏蔽一个用户