bluemodel / BlueM.Wave

Wave is a tool for displaying, analyzing and importing and exporting time series.
https://wiki.bluemodel.org/index.php/BlueM.Wave
GNU Lesser General Public License v3.0
4 stars 2 forks source link

Volume calculation should respect interpretation type #112

Closed TobiasRosskopf closed 1 year ago

TobiasRosskopf commented 1 year ago

The volume of a time series is calculated in the function below:

https://github.com/bluemodel/BlueM.Wave/blob/037010d9aea669d614f9bfdf5eff9f175948d54c/source/Classes/TimeSeries.vb#L402-L429

But this will always calculate the volume with linear interpretation. If it's a time series with block interpretation the volume of its should be calculated blockwise.

Additionally the volume is just calculateted if the unit of the time series matches "/s". It may be usefull to recognize "/min", "/h", "/d" as well.

Instantenious (linear) interpretation instantenious

Block Interpretation blockright

jamaa commented 1 year ago

yeah, thanks for the reminder, will fix asap!

jamaa commented 1 year ago

there are some tricky situations:

jamaa commented 1 year ago

I am a bit unsure about the following: For interpretations such as CumulativePerTimestep and Cumulative, I am implementing that the volume will be NaN. Theoretically we could also return the sum and the last value, respectively, as the volume, but I think that would cause more confusion than be helpful?

jamaa commented 1 year ago

For reference, the new implementation is as follows (taken from wiki):

Wave calculates and displays the Volume property of a time series (e.g. for GoodnessOfFit analysis or in the properties window), if a time series' unit ends with "/s", "/min", "/h" or "/d" (e.g. "m³/s", "mm/h", etc.) and its interpretation is either Instantaneous, BlockLeft or BlockRight, by integrating the values over time while respecting the interpretation. Time series with other units or interpretations only have the Sum property. NaN nodes cause the adjacent timesteps to not contribute to the volume (depends on the interpretation).

Additional technical details: