# zivaCalculusExt

Allows you to perform calculus on numerical and boolean history grids in SkySpark.
zivaCalculusExtAxon funcs

Registered StackHub users may elect to receive email notifications whenever a new package version is released.

There are 0 watchers.

v1.8.0

zivaFindIntervals
zivaFindIntervals(hisGrid)

Find Intervals

• Return the ts, interval of a hisGrid
• Side Effects: Lose first ts of hisGrid
• Input: ts, val grid
• Output: Transmuted history grid of ts, interval
• `read(temp and discharge).hisRead(yesterday).zivaHisFindIntervals()`

Cumulative Integral/Area under the Curve from Rectangle Method Approximation

• Supports a true History Grid with multiple V columns
• Should be exact for COV Points
• Side Effect: Data interpolated
• Input: ts, val*n grid where val*n can be multiple V columns with numbers and/or booleans
• Output: Transmuted history grid of ts, V*n columns
• `readAll(temp and discharge).hisRead(yesterday).zivaHisAddRectIntegral()`

Cumulative Integral/Area under the Curve from Trapezoid Method Approximation

• Supports a true History Grid with multiple V columns
• Should be exact for Linear Points
• Side Effect: Data interpolated
• Input: ts, val*n grid where val*n can be multiple V columns with numbers and/or booleans
• Output: Transmuted history grid of ts, V*n columns
• `readAll(temp and discharge).hisRead(yesterday).zivaHisAddTrapIntegral()`
zivaHisDelta
zivaHisDelta(hisGrid)

Rolling Delta

• Supports a true History Grid with multiple V columns
• Side Effect: Data interpolated
• Input: ts, val*n grid where val*n can be multiple V columns with numbers
• Output: Transmuted history grid of ts, V*n columns
• Example: Get change between samples
• `readAll(temp and discharge).hisRead(yesterday).zivaHisDelta()`
zivaHisDerivative
zivaHisDerivative(hisGrid)

Derivative

• Supports a true History Grid with multiple V columns
• Slope going to ts data-point is used as derivative of ts data-point
• Side Effects: Lose first ts of hisGrid; data interpolated
• Input: ts, val*n grid where val*n can be multiple V columns with numbers and/or booleans
• Output: Transmuted history grid of ts, V*n columns
• `readAll(temp and discharge).hisRead(yesterday).zivaHisDerivative()`
zivaHisRectIntegral
zivaHisRectIntegral(hisGrid)

Integral from Rectangle Method Approximation

• Supports a true History Grid with multiple V columns
• Should be exact for COV Points
• Side Effects: Lose first ts of hisGrid; data interpolated
• Input: ts, val*n grid where val*n can be multiple V columns with numbers and/or booleans
• Output: Transmuted history grid of ts, V*n columns
• `readAll(temp and discharge).hisRead(yesterday).zivaHisRectIntegral()`
zivaHisShiftDataBack
zivaHisShiftDataBack(hisGrid)

Shift Data Back in Time One TS

• Supports a true History Grid with multiple V columns
• Side Effect: Lose last ts
• Input: ts, val*n grid where val*n can be multiple V columns
• Output: Transmuted history grid of ts, V*n columns
• `readAll(temp and discharge).hisRead(yesterday).zivaHisShiftDataBack()`
zivaHisShiftDataForward
zivaHisShiftDataForward(hisGrid, removeTop: true)

Shift Data Forward in Time One TS

• Supports a true History Grid with multiple V columns
• Side Effect: Lose last first ts (see leave it with null value if set 2nd parameter to false)
• Input: ts, val*n grid where val*n can be multiple V columns
• Output: Transmuted history grid of ts, V*n columns
• `readAll(temp and discharge).hisRead(yesterday).zivaHisShiftDataBack()`
• `readAll(temp and discharge).hisRead(yesterday).zivaHisShiftDataBack(false)`
zivaHisSum
zivaHisSum(hisGrid)

Rolling Sum

• Supports a true History Grid with multiple V columns
• Side Effect: Data interpolated
• Input: ts, val*n grid where val*n can be multiple V columns with numbers
• Output: Transmuted history grid of ts, V*n columns
• Example: Turn energy differentials to totalized values
• `readAll(temp and discharge).hisRead(yesterday).zivaHisSum()`
zivaHisTrapIntegral
zivaHisTrapIntegral(hisGrid)

Integral from Trapezoid Method Approximation

• Supports a true History Grid with multiple V columns
• Should be exact for linear Points
• Side Effects: Lose first ts of hisGrid; data interpolated
• Input: ts, val*n grid where val*n can be multiple V columns with numbers and/or booleans
• Output: Transmuted history grid of ts, V*n columns
• `readAll(temp and discharge).hisRead(yesterday).zivaHisTrapIntegral()`
zivaHisZScore
zivaHisZScore(src)

Get each ZScore of each cell of a hisGrid

• Supports a true History Grid with multiple V columns
• Side Effects: None
• Input: ts, v0 grid
• Output: Transmuted history grid of ts, v0 columns
• `read(zone and air and temp and sensor).hisRead(pastMonth).zivaHisZScore`
• `readAll(power).hisRead(pastMonth).zivaHisZScore`
zivaPostUnitFixer
zivaPostUnitFixer(value)

Unit Fixing Function

• Function used to fix time units in calculus functions.
• Fixes resultant units
• Inputs: Number with units
• Output: Number with clean units
zivaPreUnitFixer
zivaPreUnitFixer(value)

Function used to convert booleans and fix null units

• Fixes input units
• Inputs: Number or boolean
• Output: Number with units
zivaSeparatePeriods
zivaSeparatePeriods(hisDurGrid, interval: 15min)

Separate Periods of a HisDurGrid into the Requested Interval

• Useful for passing to hisInterpolate
• Does not support multiple V columns
• Side Effect: Data automatically hisClipped
• Input: ts, dur grid and optional interval (defVal: 15min)
• Output: Transmuted history grid of ts, broken up durs
• `read(temp and discharge).hisRead(yesterday).hisFindPeriods(x => x > 70).zivaSeparatePeriods`
• `read(temp and discharge).hisRead(yesterday).hisFindPeriods(x => x > 70).zivaSeparatePeriods(1hr)`