Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
h2.
scrollbar

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:

Code Block
languagepython
{color}:

{code:language=python}
# DeltaShell libs
from DelftTools.Functions import IFunction
{


And add this code to the end of the script :

Code Block
languagepython
code}

\\
And add this code to the end of the script :
{code:language=python}
#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
{code}
\\
We start by getting the waterlevel output of the FM model. This is done by getting the "Water level 


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)

{:=
Code Block
language
python
}
waterLevel = GetItemByName(fmModel.OutputHisFileStore.Functions, "Water level (waterlevel)")
{code}
\\
Then we create a list for the timeseries and add a timeseries for the waterlevel and for the station.
{code:language=python}


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

Code Block
languagepython
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:

Code Block
languagepython
{code}
\\
Now we ask DeltaShell to open a view for list of timeseries:
{code:language=python}
# Show the timeseries
Gui.DocumentViewsResolver.OpenViewForData(timeSeriesToPlot)
{code}
\\
\\



scrollbar