raain-model 2.6.10 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +94 -7
- package/README.md +14 -13
- package/RELEASE_PROCESS.md +91 -4
- package/cartesian/CartesianMeasureValue.d.ts +46 -0
- package/{src/cartesian/CartesianMeasureValue.ts → cartesian/CartesianMeasureValue.js} +41 -73
- package/cartesian/CartesianMeasureValue.js.map +1 -0
- package/cartesian/CartesianTools.d.ts +32 -0
- package/{src/cartesian/CartesianTools.ts → cartesian/CartesianTools.js} +69 -130
- package/cartesian/CartesianTools.js.map +1 -0
- package/cartesian/CartesianValue.d.ts +14 -0
- package/cartesian/CartesianValue.js +17 -0
- package/cartesian/CartesianValue.js.map +1 -0
- package/cartesian/EarthMap.d.ts +5 -0
- package/cartesian/EarthMap.js +3 -0
- package/cartesian/EarthMap.js.map +1 -0
- package/cartesian/ICartesianMeasureValue.d.ts +23 -0
- package/cartesian/ICartesianMeasureValue.js +3 -0
- package/cartesian/ICartesianMeasureValue.js.map +1 -0
- package/cartesian/LatLng.d.ts +16 -0
- package/cartesian/LatLng.js +34 -0
- package/cartesian/LatLng.js.map +1 -0
- package/cartesian/RadarCartesianMeasureValue.d.ts +27 -0
- package/cartesian/RadarCartesianMeasureValue.js +24 -0
- package/cartesian/RadarCartesianMeasureValue.js.map +1 -0
- package/cartesian/RainCartesianMeasureValue.d.ts +25 -0
- package/cartesian/RainCartesianMeasureValue.js +25 -0
- package/cartesian/RainCartesianMeasureValue.js.map +1 -0
- package/cartesian/index.js +25 -0
- package/cartesian/index.js.map +1 -0
- package/gauge/GaugeMeasure.d.ts +30 -0
- package/gauge/GaugeMeasure.js +30 -0
- package/gauge/GaugeMeasure.js.map +1 -0
- package/gauge/GaugeNode.d.ts +95 -0
- package/{src/gauge/GaugeNode.ts → gauge/GaugeNode.js} +28 -54
- package/gauge/GaugeNode.js.map +1 -0
- package/gauge/GaugeNodeMap.d.ts +35 -0
- package/gauge/GaugeNodeMap.js +42 -0
- package/gauge/GaugeNodeMap.js.map +1 -0
- package/gauge/index.js +20 -0
- package/gauge/index.js.map +1 -0
- package/index.js +24 -0
- package/index.js.map +1 -0
- package/organization/EventNode.d.ts +30 -0
- package/organization/EventNode.js +30 -0
- package/organization/EventNode.js.map +1 -0
- package/organization/IVersion.js +3 -0
- package/organization/IVersion.js.map +1 -0
- package/organization/Link.d.ts +16 -0
- package/{src/organization/Link.ts → organization/Link.js} +15 -15
- package/organization/Link.js.map +1 -0
- package/organization/Measure.d.ts +30 -0
- package/organization/Measure.js +51 -0
- package/organization/Measure.js.map +1 -0
- package/organization/PeopleNode.d.ts +23 -0
- package/{src/organization/PeopleNode.ts → organization/PeopleNode.js} +10 -20
- package/organization/PeopleNode.js.map +1 -0
- package/organization/RaainNode.d.ts +95 -0
- package/{src/organization/RaainNode.ts → organization/RaainNode.js} +38 -63
- package/organization/RaainNode.js.map +1 -0
- package/organization/TeamNode.d.ts +51 -0
- package/organization/TeamNode.js +52 -0
- package/organization/TeamNode.js.map +1 -0
- package/organization/index.js +24 -0
- package/organization/index.js.map +1 -0
- package/package.json +4 -2
- package/polar/AbstractPolarMeasureValue.d.ts +31 -0
- package/{src/polar/AbstractPolarMeasureValue.ts → polar/AbstractPolarMeasureValue.js} +34 -62
- package/polar/AbstractPolarMeasureValue.js.map +1 -0
- package/polar/IPolarMeasureValue.d.ts +19 -0
- package/polar/IPolarMeasureValue.js +3 -0
- package/polar/IPolarMeasureValue.js.map +1 -0
- package/polar/MeasureValuePolarContainer.d.ts +24 -0
- package/{src/polar/MeasureValuePolarContainer.ts → polar/MeasureValuePolarContainer.js} +13 -29
- package/polar/MeasureValuePolarContainer.js.map +1 -0
- package/polar/PolarFilter.d.ts +16 -0
- package/polar/PolarFilter.js +45 -0
- package/polar/PolarFilter.js.map +1 -0
- package/polar/PolarMeasureValue.d.ts +51 -0
- package/{src/polar/PolarMeasureValue.ts → polar/PolarMeasureValue.js} +62 -125
- package/polar/PolarMeasureValue.js.map +1 -0
- package/polar/PolarMeasureValueMap.d.ts +45 -0
- package/{src/polar/PolarMeasureValueMap.ts → polar/PolarMeasureValueMap.js} +88 -165
- package/polar/PolarMeasureValueMap.js.map +1 -0
- package/polar/PolarValue.d.ts +10 -0
- package/polar/PolarValue.js +12 -0
- package/polar/PolarValue.js.map +1 -0
- package/polar/RadarPolarMeasureValue.d.ts +33 -0
- package/{src/polar/RadarPolarMeasureValue.ts → polar/RadarPolarMeasureValue.js} +31 -39
- package/polar/RadarPolarMeasureValue.js.map +1 -0
- package/polar/RainPolarMeasureValue.d.ts +24 -0
- package/polar/RainPolarMeasureValue.js +46 -0
- package/polar/RainPolarMeasureValue.js.map +1 -0
- package/polar/index.js +25 -0
- package/polar/index.js.map +1 -0
- package/quality/QualityPoint.d.ts +37 -0
- package/{src/quality/QualityPoint.ts → quality/QualityPoint.js} +33 -56
- package/quality/QualityPoint.js.map +1 -0
- package/quality/SpeedMatrix.d.ts +83 -0
- package/{src/quality/SpeedMatrix.ts → quality/SpeedMatrix.js} +76 -117
- package/quality/SpeedMatrix.js.map +1 -0
- package/quality/SpeedMatrixContainer.d.ts +102 -0
- package/{src/quality/SpeedMatrixContainer.ts → quality/SpeedMatrixContainer.js} +103 -210
- package/quality/SpeedMatrixContainer.js.map +1 -0
- package/quality/history/CartesianGaugeHistory.d.ts +15 -0
- package/quality/history/CartesianGaugeHistory.js +14 -0
- package/quality/history/CartesianGaugeHistory.js.map +1 -0
- package/quality/history/CartesianRainHistory.d.ts +9 -0
- package/quality/history/CartesianRainHistory.js +11 -0
- package/quality/history/CartesianRainHistory.js.map +1 -0
- package/quality/history/PositionHistory.d.ts +20 -0
- package/quality/history/PositionHistory.js +17 -0
- package/quality/history/PositionHistory.js.map +1 -0
- package/{src/quality/index.ts → quality/index.d.ts} +0 -3
- package/quality/index.js +26 -0
- package/quality/index.js.map +1 -0
- package/quality/position/Position.d.ts +22 -0
- package/quality/position/Position.js +50 -0
- package/quality/position/Position.js.map +1 -0
- package/quality/position/PositionValue.d.ts +9 -0
- package/quality/position/PositionValue.js +12 -0
- package/quality/position/PositionValue.js.map +1 -0
- package/quality/tools/QualityTools.d.ts +9 -0
- package/{src/quality/tools/QualityTools.ts → quality/tools/QualityTools.js} +17 -18
- package/quality/tools/QualityTools.js.map +1 -0
- package/radar/RadarMeasure.d.ts +38 -0
- package/radar/RadarMeasure.js +33 -0
- package/radar/RadarMeasure.js.map +1 -0
- package/radar/RadarNode.d.ts +41 -0
- package/radar/RadarNode.js +58 -0
- package/radar/RadarNode.js.map +1 -0
- package/radar/RadarNodeMap.d.ts +51 -0
- package/radar/RadarNodeMap.js +50 -0
- package/radar/RadarNodeMap.js.map +1 -0
- package/radar/index.js +20 -0
- package/radar/index.js.map +1 -0
- package/rain/MergeStrategy.d.ts +13 -0
- package/rain/MergeStrategy.js +11 -0
- package/rain/MergeStrategy.js.map +1 -0
- package/rain/RainComputation.d.ts +59 -0
- package/rain/RainComputation.js +68 -0
- package/rain/RainComputation.js.map +1 -0
- package/rain/RainComputationAbstract.d.ts +89 -0
- package/rain/RainComputationAbstract.js +207 -0
- package/rain/RainComputationAbstract.js.map +1 -0
- package/rain/RainComputationMap.d.ts +113 -0
- package/{src/rain/RainComputationMap.ts → rain/RainComputationMap.js} +26 -60
- package/rain/RainComputationMap.js.map +1 -0
- package/rain/RainComputationQuality.d.ts +58 -0
- package/{src/rain/RainComputationQuality.ts → rain/RainComputationQuality.js} +52 -89
- package/rain/RainComputationQuality.js.map +1 -0
- package/rain/RainMeasure.d.ts +17 -0
- package/rain/RainMeasure.js +18 -0
- package/rain/RainMeasure.js.map +1 -0
- package/rain/RainNode.d.ts +60 -0
- package/rain/RainNode.js +198 -0
- package/rain/RainNode.js.map +1 -0
- package/{src/rain/index.ts → rain/index.d.ts} +1 -0
- package/rain/index.js +24 -0
- package/rain/index.js.map +1 -0
- package/.cursorignore +0 -10
- package/.github/workflows/ci.yml +0 -29
- package/LICENSE +0 -21
- package/RELEASE.md +0 -19
- package/specs/REQUIREMENTS.md +0 -42
- package/specs/TECHNICAL.md +0 -57
- package/specs/cartesian/Cartesian.spec.ts +0 -82
- package/specs/cartesian/CartesianTools.spec.ts +0 -121
- package/specs/gauge/Gauge.spec.ts +0 -39
- package/specs/organization/Organization.spec.ts +0 -38
- package/specs/polar/Polar.spec.ts +0 -267
- package/specs/quality/Position.spec.ts +0 -18
- package/specs/quality/QualityPointEdgeCases.spec.ts +0 -215
- package/specs/quality/QualityTools.spec.ts +0 -67
- package/specs/quality/SpeedMatrix.spec.ts +0 -214
- package/specs/radar/Radar.spec.ts +0 -129
- package/specs/rain/Rain.spec.ts +0 -334
- package/specs/tsconfig.json +0 -12
- package/src/cartesian/CartesianValue.ts +0 -26
- package/src/cartesian/EarthMap.ts +0 -5
- package/src/cartesian/ICartesianMeasureValue.ts +0 -22
- package/src/cartesian/LatLng.ts +0 -43
- package/src/cartesian/RadarCartesianMeasureValue.ts +0 -32
- package/src/cartesian/RainCartesianMeasureValue.ts +0 -32
- package/src/gauge/GaugeMeasure.ts +0 -42
- package/src/gauge/GaugeNodeMap.ts +0 -55
- package/src/organization/EventNode.ts +0 -43
- package/src/organization/Measure.ts +0 -61
- package/src/organization/TeamNode.ts +0 -91
- package/src/polar/IPolarMeasureValue.ts +0 -21
- package/src/polar/PolarFilter.ts +0 -46
- package/src/polar/PolarValue.ts +0 -16
- package/src/polar/RainPolarMeasureValue.ts +0 -57
- package/src/quality/history/CartesianGaugeHistory.ts +0 -23
- package/src/quality/history/CartesianRainHistory.ts +0 -15
- package/src/quality/history/PositionHistory.ts +0 -31
- package/src/quality/position/Position.ts +0 -59
- package/src/quality/position/PositionValue.ts +0 -15
- package/src/radar/RadarMeasure.ts +0 -41
- package/src/radar/RadarNode.ts +0 -78
- package/src/radar/RadarNodeMap.ts +0 -61
- package/src/rain/MergeStrategy.ts +0 -15
- package/src/rain/RainComputation.ts +0 -96
- package/src/rain/RainComputationAbstract.ts +0 -262
- package/src/rain/RainMeasure.ts +0 -25
- package/src/rain/RainNode.ts +0 -235
- package/tsconfig.json +0 -17
- package/tslint.json +0 -79
- package/typedoc.json +0 -31
- /package/{src/cartesian/index.ts → cartesian/index.d.ts} +0 -0
- /package/{src/gauge/index.ts → gauge/index.d.ts} +0 -0
- /package/{src/index.ts → index.d.ts} +0 -0
- /package/{src/organization/IVersion.ts → organization/IVersion.d.ts} +0 -0
- /package/{src/organization/index.ts → organization/index.d.ts} +0 -0
- /package/{src/polar/index.ts → polar/index.d.ts} +0 -0
- /package/{src/radar/index.ts → radar/index.d.ts} +0 -0
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {expect} from 'chai';
|
|
2
|
-
import {CartesianTools, LatLng, Position, QualityTools} from '../../src';
|
|
3
|
-
|
|
4
|
-
describe('QualityTools', () => {
|
|
5
|
-
|
|
6
|
-
it('should MapPositionToLatLng and MapLatLngToPosition', () => {
|
|
7
|
-
|
|
8
|
-
let point = new Position({x: 0, y: 0});
|
|
9
|
-
let latLng = QualityTools.MapPositionToLatLng(point);
|
|
10
|
-
expect(QualityTools.MapLatLngToPosition(latLng).x).eq(point.x);
|
|
11
|
-
expect(QualityTools.MapLatLngToPosition(latLng).y).eq(point.y);
|
|
12
|
-
expect(latLng.lat).eq(0);
|
|
13
|
-
expect(latLng.lng).eq(0);
|
|
14
|
-
|
|
15
|
-
point = new Position({x: 10, y: -10});
|
|
16
|
-
latLng = QualityTools.MapPositionToLatLng(point);
|
|
17
|
-
expect(QualityTools.MapLatLngToPosition(latLng).x).eq(point.x);
|
|
18
|
-
expect(QualityTools.MapLatLngToPosition(latLng).y).eq(point.y);
|
|
19
|
-
expect(latLng.lat).eq(-10);
|
|
20
|
-
expect(latLng.lng).eq(10);
|
|
21
|
-
|
|
22
|
-
point = new Position({x: 11.0003, y: -11.03});
|
|
23
|
-
latLng = QualityTools.MapPositionToLatLng(point);
|
|
24
|
-
expect(QualityTools.MapLatLngToPosition(latLng).x).eq(point.x);
|
|
25
|
-
expect(QualityTools.MapLatLngToPosition(latLng).y).eq(point.y);
|
|
26
|
-
|
|
27
|
-
point = new Position({x: 11.0003, y: -11.03});
|
|
28
|
-
const cartesianWidthDefault = new LatLng({lat: CartesianTools.DEFAULT_SCALE, lng: CartesianTools.DEFAULT_SCALE});
|
|
29
|
-
latLng = QualityTools.MapPositionToLatLng(point);
|
|
30
|
-
// expect(QualityTools.MapLatLngToPosition(latLng).x).eq(11);
|
|
31
|
-
expect(QualityTools.MapLatLngToPosition(latLng).y).eq(-11.03);
|
|
32
|
-
|
|
33
|
-
const cartesianWidth = new LatLng({lat: 0.01426, lng: 0.00898});
|
|
34
|
-
// expect(QualityTools.MapLatLngToPosition(latLng).y).eq(-11.02298);
|
|
35
|
-
// expect(QualityTools.MapLatLngToPosition(latLng).x).eq(11.0005);
|
|
36
|
-
|
|
37
|
-
latLng = new LatLng({lat: 48.86420972077865, lng: 2.2681507839189115});
|
|
38
|
-
// expect(QualityTools.MapLatLngToPosition(latLng).x).eq(2.27194);
|
|
39
|
-
// expect(QualityTools.MapLatLngToPosition(latLng).y).eq(48.86902);
|
|
40
|
-
latLng = new LatLng({lat: 48.86423959124331, lng: 2.254480156320581});
|
|
41
|
-
// expect(QualityTools.MapLatLngToPosition(latLng).x).eq(2.25398);
|
|
42
|
-
// expect(QualityTools.MapLatLngToPosition(latLng).y).eq(48.86902);
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should CreateNDimArray', () => {
|
|
47
|
-
const createdEmptyNDimArray = QualityTools.CreateNDimArray([1, 2, 3]);
|
|
48
|
-
expect(createdEmptyNDimArray.length).eq(1);
|
|
49
|
-
expect(createdEmptyNDimArray[0].length).eq(2);
|
|
50
|
-
expect(createdEmptyNDimArray[0][1].length).eq(3);
|
|
51
|
-
expect(createdEmptyNDimArray[0][1][2]).eq(undefined);
|
|
52
|
-
|
|
53
|
-
const createdFilledNDimArray = QualityTools.CreateNDimArray([1, 2, 3], 4321);
|
|
54
|
-
expect(createdFilledNDimArray.length).eq(1);
|
|
55
|
-
expect(createdFilledNDimArray[0].length).eq(2);
|
|
56
|
-
expect(createdFilledNDimArray[0][1].length).eq(3);
|
|
57
|
-
expect(createdFilledNDimArray[0][1][2]).eq(4321);
|
|
58
|
-
|
|
59
|
-
const createdFilledWithZeroNDimArray = QualityTools.CreateNDimArray([1, 2, 3], 0);
|
|
60
|
-
expect(createdFilledWithZeroNDimArray[0][1][2]).eq(0);
|
|
61
|
-
|
|
62
|
-
const createdFilledWithAnyNDimArray = QualityTools.CreateNDimArray([1, 2, 3], []);
|
|
63
|
-
createdFilledWithAnyNDimArray[0][1][2].push('test');
|
|
64
|
-
expect(createdFilledWithAnyNDimArray[0][1][2][0]).eq('test');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
});
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import {expect} from 'chai';
|
|
2
|
-
import {CartesianTools, CartesianValue, Position, QualityPoint, RainComputationQuality, SpeedMatrix, SpeedMatrixContainer} from '../../src';
|
|
3
|
-
|
|
4
|
-
describe('SpeedMatrix', () => {
|
|
5
|
-
|
|
6
|
-
const optionalTrace = (...log: any[]) => {
|
|
7
|
-
// console.log(new Date().toISOString(), log)
|
|
8
|
-
}
|
|
9
|
-
const optionalLogger = null; // console;
|
|
10
|
-
|
|
11
|
-
it('should SpeedMatrixContainer CreateFromJson, merge and renderMergedMatrix', () => {
|
|
12
|
-
|
|
13
|
-
const speedMatrices = [];
|
|
14
|
-
speedMatrices.push(new SpeedMatrix('1', '', []));
|
|
15
|
-
speedMatrices.push(new SpeedMatrix('2', '', []));
|
|
16
|
-
const speedMatrixContainer = new SpeedMatrixContainer({matrices: speedMatrices});
|
|
17
|
-
|
|
18
|
-
const speedMatrixContainerTwin = SpeedMatrixContainer.CreateFromJson(speedMatrixContainer.toJSON());
|
|
19
|
-
const optionsForFairCompare = {
|
|
20
|
-
removeFlatten: true,
|
|
21
|
-
removeMatrices: true,
|
|
22
|
-
removeIndicators: true,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
expect(JSON.stringify(speedMatrixContainer.toJSON(optionsForFairCompare)))
|
|
26
|
-
.equal(JSON.stringify(speedMatrixContainerTwin.toJSON(optionsForFairCompare)));
|
|
27
|
-
|
|
28
|
-
const qualityPoint1 = new QualityPoint({
|
|
29
|
-
gaugeId: 'id1',
|
|
30
|
-
gaugeLabel: 'label1',
|
|
31
|
-
gaugeDate: null,
|
|
32
|
-
rainDate: null,
|
|
33
|
-
gaugeCartesianValue: new CartesianValue({value: 1, lat: 0, lng: 0}),
|
|
34
|
-
rainCartesianValues: [new CartesianValue({value: 2, lat: 0, lng: 0}), new CartesianValue({value: 3, lat: 0.01, lng: 0.02})],
|
|
35
|
-
speed: null,
|
|
36
|
-
remark: 'none',
|
|
37
|
-
});
|
|
38
|
-
const qualityPoint2 = new QualityPoint({
|
|
39
|
-
gaugeId: 'id2',
|
|
40
|
-
gaugeLabel: 'label2',
|
|
41
|
-
gaugeDate: null,
|
|
42
|
-
rainDate: null,
|
|
43
|
-
gaugeCartesianValue: new CartesianValue({value: 10, lat: 0, lng: 0}),
|
|
44
|
-
rainCartesianValues: [new CartesianValue({value: 20, lat: 0, lng: 0}), new CartesianValue({value: 30, lat: 0.01, lng: 0.02})],
|
|
45
|
-
speed: null,
|
|
46
|
-
remark: 'none',
|
|
47
|
-
});
|
|
48
|
-
const qualityPoints = [qualityPoint1, qualityPoint2];
|
|
49
|
-
|
|
50
|
-
const speedMatrixContainerToMerge = SpeedMatrixContainer.CreateFromJson({
|
|
51
|
-
matrices: [new SpeedMatrix('3', '', qualityPoints)],
|
|
52
|
-
trustedIndicator: 0.85
|
|
53
|
-
});
|
|
54
|
-
speedMatrixContainer.merge(speedMatrixContainerToMerge);
|
|
55
|
-
|
|
56
|
-
expect(speedMatrixContainer.getQualityPoints().length).eq(2);
|
|
57
|
-
expect(speedMatrixContainer.getQualityPoints('1').length).eq(0);
|
|
58
|
-
expect(speedMatrixContainer.getQualityPoints('2').length).eq(0);
|
|
59
|
-
expect(speedMatrixContainer.getQualityPoints('3').length).eq(2);
|
|
60
|
-
expect(speedMatrixContainer.getQualityPoints('3')[0].rainCartesianValues.length).eq(2);
|
|
61
|
-
|
|
62
|
-
expect(speedMatrixContainer.getQualityPointsByHistoricalPosition(0).length).eq(0);
|
|
63
|
-
expect(speedMatrixContainer.getQualityPointsByHistoricalPosition(2).length).eq(2);
|
|
64
|
-
expect(speedMatrixContainer.getQualityPointsByHistoricalPosition(20).length).eq(0);
|
|
65
|
-
|
|
66
|
-
const mergedMatrix = speedMatrixContainer.renderMergedMatrix();
|
|
67
|
-
expect(mergedMatrix.length).eq(Math.pow(SpeedMatrix.DEFAULT_MATRIX_RANGE * 2 + 1, 2));
|
|
68
|
-
expect(mergedMatrix[611].value).eq(1);
|
|
69
|
-
expect(mergedMatrix[611].x).eq(2);
|
|
70
|
-
expect(mergedMatrix[611].y).eq(1);
|
|
71
|
-
speedMatrixContainer.logMergedMatrix({normalize: false, logger: optionalLogger});
|
|
72
|
-
speedMatrixContainer.logMergedMatrix({normalize: true, logger: optionalLogger});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should SpeedMatrixContainer merge and compare', async () => {
|
|
76
|
-
|
|
77
|
-
const dateG1 = new Date(1.1 * 60 * 1000);
|
|
78
|
-
const dateG2 = new Date(7.1 * 60 * 1000);
|
|
79
|
-
const dateG3 = new Date(10.1 * 60 * 1000);
|
|
80
|
-
const dateR1 = new Date(2.1 * 60 * 1000);
|
|
81
|
-
const dateR2 = new Date(5.2 * 60 * 1000);
|
|
82
|
-
const dateR3 = new Date(8.2 * 60 * 1000);
|
|
83
|
-
|
|
84
|
-
const speed = {angleInDegrees: 1, pixelsPerPeriod: 2};
|
|
85
|
-
const qp = {
|
|
86
|
-
gaugeId: 'gaugeId1',
|
|
87
|
-
gaugeLabel: 'gaugeLabel',
|
|
88
|
-
gaugeDate: dateG1,
|
|
89
|
-
rainDate: dateR1,
|
|
90
|
-
gaugeCartesianValue: new CartesianValue({value: 10, lat: 1, lng: 2}),
|
|
91
|
-
rainCartesianValues: [new CartesianValue({value: 8, lat: 1, lng: 2}), new CartesianValue({value: 13, lat: 1.01, lng: 2.02})],
|
|
92
|
-
speed: {x: 1, y: 2},
|
|
93
|
-
remark: 'none',
|
|
94
|
-
};
|
|
95
|
-
const qualityPoint1 = new QualityPoint(JSON.parse(JSON.stringify(qp)));
|
|
96
|
-
const qualityPoints1: QualityPoint[] = [qualityPoint1];
|
|
97
|
-
const roundScale: Position = new Position({x: CartesianTools.DEFAULT_SCALE, y: CartesianTools.DEFAULT_SCALE});
|
|
98
|
-
|
|
99
|
-
const flattenPositionRange = {xMin: -4, xMax: 4, yMin: -4, yMax: 4};
|
|
100
|
-
const speedMatrix1 = new SpeedMatrix('0', '', qualityPoints1, speed, 1, flattenPositionRange, roundScale);
|
|
101
|
-
const qualitySpeedMatrixContainer1 = new SpeedMatrixContainer({matrices: [speedMatrix1]});
|
|
102
|
-
|
|
103
|
-
// 1) Verify creation
|
|
104
|
-
qualitySpeedMatrixContainer1.logMergedMatrix({normalize: false, logger: optionalLogger});
|
|
105
|
-
speedMatrix1.logFlatten({logger: optionalLogger, simplify: false});
|
|
106
|
-
expect(qualitySpeedMatrixContainer1.getQuality()).eq(0.5);
|
|
107
|
-
expect(qualitySpeedMatrixContainer1.getMaxGauge()).eq(10);
|
|
108
|
-
expect(qualitySpeedMatrixContainer1.getMaxRain()).eq(10.5);
|
|
109
|
-
expect(qualitySpeedMatrixContainer1.getQualityPoints().length).eq(1);
|
|
110
|
-
expect(qualitySpeedMatrixContainer1.getQualityPoints()[0].getGaugeValue()).eq(10);
|
|
111
|
-
expect(qualitySpeedMatrixContainer1.getQualityPoints()[0].getRainValue()).eq(10.5);
|
|
112
|
-
expect(qualityPoint1.getTimeDeltaInMinutes()).eq(1);
|
|
113
|
-
|
|
114
|
-
// Second and Third container to merge
|
|
115
|
-
qp.gaugeDate = dateG2;
|
|
116
|
-
const qualityPoint2_1 = new QualityPoint(JSON.parse(JSON.stringify(qp)));
|
|
117
|
-
qp.gaugeId = 'gaugeId2';
|
|
118
|
-
const qualityPoint2_2 = new QualityPoint(JSON.parse(JSON.stringify(qp)));
|
|
119
|
-
const qualityPoints2: QualityPoint[] = [qualityPoint2_1, qualityPoint2_2];
|
|
120
|
-
const speedMatrix2 = new SpeedMatrix('-2', '', qualityPoints2, speed, 1, flattenPositionRange, roundScale);
|
|
121
|
-
const qualitySpeedMatrixContainer2 = new SpeedMatrixContainer({matrices: [speedMatrix2]});
|
|
122
|
-
qualitySpeedMatrixContainer2.merge(qualitySpeedMatrixContainer1);
|
|
123
|
-
|
|
124
|
-
qp.gaugeId = 'gaugeId1';
|
|
125
|
-
qp.gaugeCartesianValue.value += 0.2;
|
|
126
|
-
qp.gaugeDate = dateG3;
|
|
127
|
-
const qualityPoint3_1 = new QualityPoint(JSON.parse(JSON.stringify(qp)));
|
|
128
|
-
qp.gaugeId = 'gaugeId2';
|
|
129
|
-
qp.gaugeCartesianValue.value += 0.2;
|
|
130
|
-
qp.gaugeDate = dateG3;
|
|
131
|
-
const qualityPoint3_2 = new QualityPoint(JSON.parse(JSON.stringify(qp)));
|
|
132
|
-
const qualityPoints3: QualityPoint[] = [qualityPoint3_1, qualityPoint3_2];
|
|
133
|
-
const speedMatrix3 = new SpeedMatrix('3', '', qualityPoints3, speed, 1, flattenPositionRange, roundScale);
|
|
134
|
-
const qualitySpeedMatrixContainer3 = new SpeedMatrixContainer({matrices: [speedMatrix3]});
|
|
135
|
-
qualitySpeedMatrixContainer2.merge(qualitySpeedMatrixContainer3);
|
|
136
|
-
|
|
137
|
-
// 2) Verify merging
|
|
138
|
-
qualitySpeedMatrixContainer2.logMergedMatrix({normalize: false, logger: optionalLogger});
|
|
139
|
-
expect(qualitySpeedMatrixContainer2.getQuality()).eq(0.38000000000000045);
|
|
140
|
-
expect(qualitySpeedMatrixContainer2.getMaxGauge()).eq(10.399999999999999);
|
|
141
|
-
expect(qualitySpeedMatrixContainer2.getMaxRain()).eq(10.5);
|
|
142
|
-
const qps = qualitySpeedMatrixContainer2.getQualityPoints();
|
|
143
|
-
expect(qps.length).eq(5);
|
|
144
|
-
expect(qps[0].getGaugeValue()).eq(10);
|
|
145
|
-
expect(qps[0].getRainValue()).eq(10.5);
|
|
146
|
-
|
|
147
|
-
expect(qualitySpeedMatrixContainer2.getQualityPoints('0').length).eq(1);
|
|
148
|
-
expect(qualitySpeedMatrixContainer2.getQualityPoints('0')[0].getGaugeValue()).eq(10);
|
|
149
|
-
expect(qualitySpeedMatrixContainer2.getQualityPoints('0')[0].getRainValue()).eq(10.5);
|
|
150
|
-
|
|
151
|
-
expect(qualitySpeedMatrixContainer2.getQualityPoints('-2').length).eq(2);
|
|
152
|
-
expect(qualitySpeedMatrixContainer2.getQualityPoints('-2')[0].getGaugeValue()).eq(10);
|
|
153
|
-
expect(qualitySpeedMatrixContainer2.getQualityPoints('-2')[0].getRainValue()).eq(10.5);
|
|
154
|
-
|
|
155
|
-
expect(qualitySpeedMatrixContainer2.getQualityPoints('3').length).eq(2);
|
|
156
|
-
expect(qualitySpeedMatrixContainer2.getQualityPoints('3')[0].getGaugeValue()).eq(10.2);
|
|
157
|
-
expect(qualitySpeedMatrixContainer2.getQualityPoints('3')[0].getRainValue()).eq(10.5);
|
|
158
|
-
|
|
159
|
-
// 3) Verify compare
|
|
160
|
-
const rainComputationQuality1 = new RainComputationQuality({
|
|
161
|
-
id: 'rcq1',
|
|
162
|
-
date: dateR1,
|
|
163
|
-
isReady: true,
|
|
164
|
-
qualitySpeedMatrixContainer: new SpeedMatrixContainer({matrices: [speedMatrix1, speedMatrix2]})
|
|
165
|
-
});
|
|
166
|
-
const rainComputationQuality2 = new RainComputationQuality({
|
|
167
|
-
id: 'rcq2',
|
|
168
|
-
date: dateR2,
|
|
169
|
-
isReady: true,
|
|
170
|
-
qualitySpeedMatrixContainer: qualitySpeedMatrixContainer2
|
|
171
|
-
});
|
|
172
|
-
const rainComputationQuality3 = new RainComputationQuality({
|
|
173
|
-
id: 'rcq3',
|
|
174
|
-
date: dateR3,
|
|
175
|
-
isReady: true,
|
|
176
|
-
qualitySpeedMatrixContainer: new SpeedMatrixContainer({matrices: [speedMatrix2, speedMatrix3]})
|
|
177
|
-
});
|
|
178
|
-
const compares = SpeedMatrixContainer.BuildCompares([rainComputationQuality1, rainComputationQuality2, rainComputationQuality3]);
|
|
179
|
-
|
|
180
|
-
// comparesPerDate
|
|
181
|
-
expect(compares.comparesPerDate.length).eq(3);
|
|
182
|
-
expect(compares.comparesPerDate[0].date.getTime()).eq(126000);
|
|
183
|
-
expect(compares.comparesPerDate[1].date.getTime()).eq(312000);
|
|
184
|
-
expect(compares.comparesPerDate[2].date.getTime()).eq(491999);
|
|
185
|
-
expect(compares.comparesPerDate[0].compareTimeline.length).eq(2);
|
|
186
|
-
expect(compares.comparesPerDate[1].compareTimeline.length).eq(3);
|
|
187
|
-
expect(compares.comparesPerDate[2].compareTimeline.length).eq(1);
|
|
188
|
-
expect(compares.comparesPerDate[0].compareTimeline[0].name).contains('in 2');
|
|
189
|
-
expect(compares.comparesPerDate[0].compareTimeline[1].name).contains('in 0');
|
|
190
|
-
expect(compares.comparesPerDate[1].compareTimeline[0].name).contains('in 2');
|
|
191
|
-
expect(compares.comparesPerDate[1].compareTimeline[1].name).contains('in 0');
|
|
192
|
-
expect(compares.comparesPerDate[1].compareTimeline[2].name).contains('since 3');
|
|
193
|
-
expect(compares.comparesPerDate[2].compareTimeline[0].name).contains('since 3');
|
|
194
|
-
expect(compares.comparesPerDate[0].compareTimeline[0].qualityPoints.length).eq(2);
|
|
195
|
-
expect(compares.comparesPerDate[0].compareTimeline[1].qualityPoints.length).eq(1);
|
|
196
|
-
expect(compares.comparesPerDate[1].compareTimeline[0].qualityPoints.length).eq(0);
|
|
197
|
-
expect(compares.comparesPerDate[1].compareTimeline[1].qualityPoints.length).eq(0);
|
|
198
|
-
expect(compares.comparesPerDate[1].compareTimeline[2].qualityPoints.length).eq(2);
|
|
199
|
-
expect(compares.comparesPerDate[2].compareTimeline[0].qualityPoints.length).eq(0);
|
|
200
|
-
|
|
201
|
-
// cumulative
|
|
202
|
-
expect(compares.compareCumulative.qualityPoints.length).eq(2);
|
|
203
|
-
expect(compares.compareCumulative.qualityPointsLegacy.length).eq(2);
|
|
204
|
-
expect(compares.compareCumulative.qualityPoints[0].gaugeId).eq('gaugeId2');
|
|
205
|
-
expect(compares.compareCumulative.qualityPoints[0].getGaugeValue()).eq(20.4);
|
|
206
|
-
expect(compares.compareCumulative.qualityPoints[0].getRainValue()).eq(21);
|
|
207
|
-
expect(compares.compareCumulative.qualityPoints[1].gaugeId).eq('gaugeId1');
|
|
208
|
-
expect(compares.compareCumulative.qualityPoints[1].getGaugeValue()).eq(30.2);
|
|
209
|
-
expect(compares.compareCumulative.qualityPoints[1].getRainValue()).eq(31.5);
|
|
210
|
-
expect(compares.compareCumulative.maxValue).eq(31.5);
|
|
211
|
-
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
});
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import {expect} from 'chai';
|
|
2
|
-
import {MeasureValuePolarContainer, PolarMeasureValue, RadarMeasure, RadarNode, RadarPolarMeasureValue, TeamNode} from '../../src';
|
|
3
|
-
import {promisify} from 'util';
|
|
4
|
-
|
|
5
|
-
const sleep = promisify(setTimeout);
|
|
6
|
-
|
|
7
|
-
describe('Radar', () => {
|
|
8
|
-
|
|
9
|
-
const optionalTrace = (...log: any[]) => {
|
|
10
|
-
// console.log(new Date().toISOString(), log)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const optionalTable = (a: any[]) => {
|
|
14
|
-
// console.table(a)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
it('should create ones', () => {
|
|
18
|
-
const team1 = new TeamNode({
|
|
19
|
-
id: 'tid1',
|
|
20
|
-
name: 'team1',
|
|
21
|
-
description: 'team...',
|
|
22
|
-
contracts: ['basic'],
|
|
23
|
-
contacts: []
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const radarNode = new RadarNode({
|
|
27
|
-
id: 'RadarNode looks OK.', name: 'name', links: [],
|
|
28
|
-
latitude: 1, longitude: 1,
|
|
29
|
-
team: team1
|
|
30
|
-
});
|
|
31
|
-
expect(radarNode.id).eq('RadarNode looks OK.');
|
|
32
|
-
expect(JSON.stringify(radarNode.toJSON()))
|
|
33
|
-
.eq('{"id":"RadarNode looks OK.","links":[],"name":"name","latitude":1,"longitude":1,"team":"tid1"}');
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should transform Polar', () => {
|
|
37
|
-
|
|
38
|
-
const measureValuePolarContainer = new MeasureValuePolarContainer({azimuth: 0, distance: 1, polarEdges: [33, 45.5]});
|
|
39
|
-
const polarMeasureValue = new PolarMeasureValue({
|
|
40
|
-
measureValuePolarContainers: [measureValuePolarContainer],
|
|
41
|
-
azimuthsCount: 720,
|
|
42
|
-
polarEdgesCount: 250
|
|
43
|
-
});
|
|
44
|
-
const radarPolarMeasureValue1 = new RadarPolarMeasureValue({polarMeasureValue, angle: 1, axis: 0});
|
|
45
|
-
expect(radarPolarMeasureValue1.getAzimuthsCount()).equal(720);
|
|
46
|
-
expect(radarPolarMeasureValue1.getPolarEdgesCount()).equal(250);
|
|
47
|
-
|
|
48
|
-
const radarPolarMeasureValue2 = new RadarPolarMeasureValue({polarMeasureValue: radarPolarMeasureValue1, angle: 1, axis: 0});
|
|
49
|
-
expect(radarPolarMeasureValue2.getAzimuthsCount()).equal(720);
|
|
50
|
-
expect(radarPolarMeasureValue2.getPolarEdgesCount()).equal(250);
|
|
51
|
-
expect(JSON.stringify(radarPolarMeasureValue2.toJSON({stringify: true})))
|
|
52
|
-
.eq(JSON.stringify(radarPolarMeasureValue1.toJSON({stringify: true})));
|
|
53
|
-
expect(JSON.stringify(radarPolarMeasureValue2.toJSON({stringify: true})))
|
|
54
|
-
.eq('{"polarMeasureValue":"{\\"measureValuePolarContainers\\":\\"[{\\\\\\"azimuth\\\\\\":0,\\\\\\"distance\\\\\\":1,\\\\\\"polarEdges\\\\\\":[33,45.5],\\\\\\"edgeOffset\\\\\\":0}]\\",\\"azimuthsCount\\":720,\\"polarEdgesCount\\":250}","angle":1,"axis":0}');
|
|
55
|
-
|
|
56
|
-
const radarPolarMeasureValue3 = new RadarPolarMeasureValue({
|
|
57
|
-
polarMeasureValue: radarPolarMeasureValue1.toJSONWithPolarStringified(),
|
|
58
|
-
angle: 1,
|
|
59
|
-
axis: 0
|
|
60
|
-
});
|
|
61
|
-
expect(radarPolarMeasureValue3.getAzimuthsCount()).equal(720);
|
|
62
|
-
expect(radarPolarMeasureValue3.getPolarEdgesCount()).equal(250);
|
|
63
|
-
expect(JSON.stringify(radarPolarMeasureValue3.toJSON({stringify: true})))
|
|
64
|
-
.eq(JSON.stringify(radarPolarMeasureValue1.toJSON({stringify: true})));
|
|
65
|
-
expect(JSON.stringify(radarPolarMeasureValue3.toJSON({stringify: true})))
|
|
66
|
-
.eq('{"polarMeasureValue":"{\\"measureValuePolarContainers\\":\\"[{\\\\\\"azimuth\\\\\\":0,\\\\\\"distance\\\\\\":1,\\\\\\"polarEdges\\\\\\":[33,45.5],\\\\\\"edgeOffset\\\\\\":0}]\\",\\"azimuthsCount\\":720,\\"polarEdgesCount\\":250}","angle":1,"axis":0}');
|
|
67
|
-
|
|
68
|
-
const radarMeasure = new RadarMeasure({id: 'measureId', values: [polarMeasureValue], date: new Date(100000)});
|
|
69
|
-
expect(JSON.stringify(radarMeasure.toJSON()))
|
|
70
|
-
.eq('{"id":"measureId","links":[],"date":"1970-01-01T00:01:40.000Z","validity":-1,"values":[{"measureValuePolarContainers":[{"azimuth":0,"distance":1,"polarEdges":[33,45.5],"edgeOffset":0}],"azimuthsCount":720,"polarEdgesCount":250}]}');
|
|
71
|
-
|
|
72
|
-
const polarMeasureValue1 = radarMeasure.values[0] as PolarMeasureValue;
|
|
73
|
-
const radarPolarMeasureValue4 = new RadarPolarMeasureValue({polarMeasureValue: polarMeasureValue1, angle: 1, axis: 0});
|
|
74
|
-
expect(JSON.stringify(radarPolarMeasureValue4.toJSON()))
|
|
75
|
-
.eq('{"polarMeasureValue":{"measureValuePolarContainers":[{"azimuth":0,"distance":1,"polarEdges":[33,45.5],"edgeOffset":0}],"azimuthsCount":720,"polarEdgesCount":250},"angle":1,"axis":0}');
|
|
76
|
-
expect(radarPolarMeasureValue4.getAzimuthsCount()).equal(720);
|
|
77
|
-
expect(radarPolarMeasureValue4.getPolarEdgesCount()).equal(250);
|
|
78
|
-
|
|
79
|
-
const radarPolarMeasureValue5 = new RadarPolarMeasureValue({
|
|
80
|
-
polarMeasureValue: JSON.stringify(radarMeasure.values[0]),
|
|
81
|
-
angle: 1, axis: 90
|
|
82
|
-
});
|
|
83
|
-
expect(radarPolarMeasureValue5.getAzimuthsCount()).equal(720);
|
|
84
|
-
expect(radarPolarMeasureValue5.getPolarEdgesCount()).equal(250);
|
|
85
|
-
|
|
86
|
-
const team1 = new TeamNode({
|
|
87
|
-
id: 'tid1',
|
|
88
|
-
name: 'team1',
|
|
89
|
-
description: 'team...',
|
|
90
|
-
contracts: ['basic'],
|
|
91
|
-
contacts: []
|
|
92
|
-
});
|
|
93
|
-
const radarNode = new RadarNode({
|
|
94
|
-
id: 'RadarNode looks OK.',
|
|
95
|
-
name: 'name',
|
|
96
|
-
links: [radarMeasure],
|
|
97
|
-
latitude: 1, longitude: 1,
|
|
98
|
-
team: team1
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
expect(JSON.stringify(radarNode.toJSON()))
|
|
102
|
-
.eq('{"id":"RadarNode looks OK.","links":[{"rel":"radar-measure","href":"../radar-measures/1970-01-01T00:01:40.000Z/measureId"}],"name":"name","latitude":1,"longitude":1,"team":"tid1"}');
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('should use multi-dimension image', async () => {
|
|
106
|
-
|
|
107
|
-
const testOneFake = (move: number) => {
|
|
108
|
-
const radarPolarMeasureValues = RadarPolarMeasureValue.BuildFakeRadarPolarMeasureValues(move);
|
|
109
|
-
expect(radarPolarMeasureValues.length).equal(6);
|
|
110
|
-
const polars = radarPolarMeasureValues[0].polarMeasureValue.getPolars();
|
|
111
|
-
expect(polars.length).equal(720);
|
|
112
|
-
expect(polars[0].polarEdges.length).equal(250);
|
|
113
|
-
optionalTable(polars
|
|
114
|
-
.filter((p, pi) => pi % 10 === 0)
|
|
115
|
-
.map(m =>
|
|
116
|
-
m.polarEdges
|
|
117
|
-
.filter((n, ni) => ni % 10 === 0)));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// for (let move = 0; move < 90; move++) {
|
|
121
|
-
testOneFake(0);
|
|
122
|
-
testOneFake(45);
|
|
123
|
-
testOneFake(90);
|
|
124
|
-
// await sleep(1000);
|
|
125
|
-
// }
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
});
|