Exercise outline

We want to get a timeserie of the calculated waterlevel at the "station" observation points, and a timeserie for the NetCdf file stations that were added as observation points and show them in one chart.

Extract timeseries from the model output and NetCdf file and plot both in one chart


Add the following import statement to the region Import libs:

# DeltaShell libs
from DelftTools.Functions import IFunction


And add this code to the end of the script :

#region Compare results with astronomical components

waterLevel = GetItemByName(fmModel.OutputHisFileStore.Functions, "Water level (waterlevel)")

timeSeriesToPlot = List[IFunction]()
for station in stationsInEvelope:
	observationPoint = GetItemByName(waterLevel.Features, station.name)

	# Create waterlevel timeseries
	timeSeriesToPlot.Add(waterLevel.GetTimeSeries(observationPoint))

	# Create astronomical components timeseries
	timeSeriesToPlot.Add(GetAstroComponentsTimeSeries(fmModel.StartTime, fmModel.StopTime, fmModel.TimeStep, station, componentNames))

# Show the timeseries
Gui.DocumentViewsResolver.OpenViewForData(timeSeriesToPlot)

#endregion


We start by getting the waterlevel output of the FM model. This is done by getting the "Water level (waterlevel)" function (waterlevel values as function of time) from the "OutputHisFileStore" (His output files)

waterLevel = GetItemByName(fmModel.OutputHisFileStore.Functions, "Water level (waterlevel)")


Then we create a list for the timeseries and add a timeseries for the waterlevel and for the station.

timeSeriesToPlot = List[IFunction]()
for station in stationsInEvelope:
	observationPoint = GetItemByName(waterLevel.Features, station.name)

	# Create waterlevel timeseries
	timeSeriesToPlot.Add(waterLevel.GetTimeSeries(observationPoint))

	# Create astronomical components timeseries
	timeSeriesToPlot.Add(GetAstroComponentsTimeSeries(fmModel.StartTime, fmModel.StopTime, fmModel.TimeStep, station, componentNames))


Now we ask DeltaShell to open a view for list of timeseries:

# Show the timeseries
Gui.DocumentViewsResolver.OpenViewForData(timeSeriesToPlot)



  • No labels