Once the model has been calibrated (i.e. that the best fit of the calibration process has been found), the only work left is exporting all the relevant results to external files which can be then shared with other modelers or used by third party software.
To begin with, we can export a summary of the calibration process, containing the parameter values which have been used and the goodness of the fit which was obtained with them.
Code Block |
---|
language | py |
---|
title | Export list with calibration summary to csv file |
---|
|
ExportListToCsvFile(rootPath + r"\calibration.csv", listCalibration, ["BC value", "Roughness", "Average deviation"], delimiterChar = ",") |
You can also export the time series corresponding to the results of the best fit.
Code Block |
---|
language | py |
---|
title | Export single time series to a csv file |
---|
|
ExportListToCsvFile(rootPath + r"\bestFit.csv", timeSeriesToCompare[indexBestFit], ["Time", "Water level at Gauging station"]) |
You can also export all the time series found during the calibration to different respective files, indicating which one is the best fit.
Code Block |
---|
language | py |
---|
title | Export multiple time series to multiple files |
---|
|
index = 0
for ts in timeSeriesToCompare:
if index == 0:
flag = " Initial set up "
elif index == indexBestFit:
flag = " best fit "
else:
flag = " "
fileName = rootPath + r"\Water Level at Gauging Station case " + str(index) + flag + ".csv"
ExportListToCsvFile(fileName, ts, ["Time", "Water level at Gauging station"], ",")
index += 1 |