Once the model has been calibrated (i.e. 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.

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.

Export single time series to a csv file
 ExportListToCsvFile(rootPath + r"\bestFit.csv", timeSeriesToCompare[indexBestFit], ["Time", "Water level at Gauging station"])

All the time series found during the calibration can be exported to different respective files, indicating in the file name which one corresponds to the best fit.

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

Finally, also the plots produced during the calibration process can be saved to external image files. For example:

Export figures as image files
  chartCalibration.ExportAsImage(rootPath + r"\Calibration.png",1250,650)

 

This is the end of the SOBEK 3 scripting tutorial.

 

  • No labels