@aguacerowx/react-native 0.0.31 → 0.0.32
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/android/build/.transforms/42e9b8fa82d77a1c205db5bf0d0ed519/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayerView.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderManager.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/WeatherFrameProcessorModule.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/lib/commonjs/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/lib/commonjs/package.json +1 -1
- package/lib/commonjs/src/WeatherLayerManager.js +72 -0
- package/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/lib/module/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/lib/module/lib/commonjs/package.json +1 -1
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js +72 -0
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/package.json +1 -1
- package/lib/module/src/WeatherLayerManager.js +73 -1
- package/lib/module/src/WeatherLayerManager.js.map +1 -1
- package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/WeatherLayerManager.js +79 -4
- package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// packages/react-native/src/WeatherLayerManager.js
|
|
2
2
|
|
|
3
3
|
import React, { useState, useRef, useContext, useEffect, forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
4
|
-
import { AguaceroCore, getUnitConversionFunction } from '@aguacerowx/javascript-sdk';
|
|
4
|
+
import { AguaceroCore, getUnitConversionFunction, DICTIONARIES } from '@aguacerowx/javascript-sdk';
|
|
5
5
|
import { AguaceroContext } from './AguaceroContext';
|
|
6
6
|
import { GridRenderLayer } from './GridRenderLayer';
|
|
7
7
|
import { fromByteArray } from 'base64-js';
|
|
@@ -282,13 +282,38 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
const { baseUnit } = core._getColormapForVariable(variable);
|
|
285
|
-
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
286
285
|
|
|
286
|
+
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
287
|
+
|
|
288
|
+
const fieldInfo = DICTIONARIES?.fld?.[variable] || {};
|
|
289
|
+
const serverDataUnit = fieldInfo.defaultUnit || baseUnit;
|
|
290
|
+
|
|
287
291
|
let dataScale = result.scale;
|
|
288
292
|
let dataOffset = result.offset;
|
|
289
|
-
|
|
293
|
+
|
|
290
294
|
let convertedScale = dataScale;
|
|
291
295
|
let convertedOffset = dataOffset;
|
|
296
|
+
|
|
297
|
+
if (serverDataUnit !== baseUnit) {
|
|
298
|
+
const conversionFunc = getUnitConversionFunction(serverDataUnit, baseUnit);
|
|
299
|
+
if (conversionFunc) {
|
|
300
|
+
if (result.scaleType === 'sqrt') {
|
|
301
|
+
const physicalAtOffset = dataOffset * dataOffset;
|
|
302
|
+
const physicalAtOffsetPlusScale = (dataOffset + dataScale) * (dataOffset + dataScale);
|
|
303
|
+
const convertedPhysicalAtOffset = conversionFunc(physicalAtOffset);
|
|
304
|
+
const convertedPhysicalAtOffsetPlusScale = conversionFunc(physicalAtOffsetPlusScale);
|
|
305
|
+
convertedOffset = Math.sqrt(Math.abs(convertedPhysicalAtOffset)) * Math.sign(convertedPhysicalAtOffset);
|
|
306
|
+
const newOffsetPlusScale = Math.sqrt(Math.abs(convertedPhysicalAtOffsetPlusScale)) * Math.sign(convertedPhysicalAtOffsetPlusScale);
|
|
307
|
+
convertedScale = newOffsetPlusScale - convertedOffset;
|
|
308
|
+
} else {
|
|
309
|
+
convertedOffset = conversionFunc(dataOffset);
|
|
310
|
+
const convertedOffsetPlusScale = conversionFunc(dataOffset + dataScale);
|
|
311
|
+
convertedScale = convertedOffsetPlusScale - convertedOffset;
|
|
312
|
+
}
|
|
313
|
+
dataScale = convertedScale;
|
|
314
|
+
dataOffset = convertedOffset;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
292
317
|
|
|
293
318
|
if (baseUnit !== toUnit) {
|
|
294
319
|
const conversionFunc = getUnitConversionFunction(baseUnit, toUnit);
|
|
@@ -307,7 +332,7 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
|
|
|
307
332
|
convertedScale = convertedOffsetPlusScale - convertedOffset;
|
|
308
333
|
}
|
|
309
334
|
}
|
|
310
|
-
}
|
|
335
|
+
}
|
|
311
336
|
|
|
312
337
|
const frameData = {
|
|
313
338
|
filePath: result.filePath,
|
|
@@ -378,8 +403,11 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
|
|
|
378
403
|
return;
|
|
379
404
|
}
|
|
380
405
|
|
|
406
|
+
// ADD: Same two-step conversion as the current frame
|
|
381
407
|
const { baseUnit } = core._getColormapForVariable(variable);
|
|
382
408
|
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
409
|
+
const fieldInfo = DICTIONARIES?.fld?.[variable] || {};
|
|
410
|
+
const serverDataUnit = fieldInfo.defaultUnit || baseUnit;
|
|
383
411
|
|
|
384
412
|
let dataScale = result.scale;
|
|
385
413
|
let dataOffset = result.offset;
|
|
@@ -387,6 +415,29 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
|
|
|
387
415
|
let convertedScale = dataScale;
|
|
388
416
|
let convertedOffset = dataOffset;
|
|
389
417
|
|
|
418
|
+
// Step 1: Convert from server unit to colormap base unit
|
|
419
|
+
if (serverDataUnit !== baseUnit) {
|
|
420
|
+
const conversionFunc = getUnitConversionFunction(serverDataUnit, baseUnit);
|
|
421
|
+
if (conversionFunc) {
|
|
422
|
+
if (result.scaleType === 'sqrt') {
|
|
423
|
+
const physicalAtOffset = dataOffset * dataOffset;
|
|
424
|
+
const physicalAtOffsetPlusScale = (dataOffset + dataScale) * (dataOffset + dataScale);
|
|
425
|
+
const convertedPhysicalAtOffset = conversionFunc(physicalAtOffset);
|
|
426
|
+
const convertedPhysicalAtOffsetPlusScale = conversionFunc(physicalAtOffsetPlusScale);
|
|
427
|
+
convertedOffset = Math.sqrt(Math.abs(convertedPhysicalAtOffset)) * Math.sign(convertedPhysicalAtOffset);
|
|
428
|
+
const newOffsetPlusScale = Math.sqrt(Math.abs(convertedPhysicalAtOffsetPlusScale)) * Math.sign(convertedPhysicalAtOffsetPlusScale);
|
|
429
|
+
convertedScale = newOffsetPlusScale - convertedOffset;
|
|
430
|
+
} else {
|
|
431
|
+
convertedOffset = conversionFunc(dataOffset);
|
|
432
|
+
const convertedOffsetPlusScale = conversionFunc(dataOffset + dataScale);
|
|
433
|
+
convertedScale = convertedOffsetPlusScale - convertedOffset;
|
|
434
|
+
}
|
|
435
|
+
dataScale = convertedScale;
|
|
436
|
+
dataOffset = convertedOffset;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Step 2: Convert from colormap base unit to target display unit
|
|
390
441
|
if (baseUnit !== toUnit) {
|
|
391
442
|
const conversionFunc = getUnitConversionFunction(baseUnit, toUnit);
|
|
392
443
|
if (conversionFunc) {
|
|
@@ -815,9 +866,33 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
|
|
|
815
866
|
if (cachedData && cachedData.originalScale !== undefined && cachedData.originalOffset !== undefined) {
|
|
816
867
|
const { baseUnit } = core._getColormapForVariable(variable);
|
|
817
868
|
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
869
|
+
const fieldInfo = DICTIONARIES?.fld?.[variable] || {};
|
|
870
|
+
const serverDataUnit = fieldInfo.defaultUnit || baseUnit;
|
|
871
|
+
|
|
818
872
|
let dataScale = cachedData.originalScale;
|
|
819
873
|
let dataOffset = cachedData.originalOffset;
|
|
820
874
|
|
|
875
|
+
if (serverDataUnit !== baseUnit) {
|
|
876
|
+
const conversionFunc = getUnitConversionFunction(serverDataUnit, baseUnit);
|
|
877
|
+
if (conversionFunc) {
|
|
878
|
+
if (cachedData.scaleType === 'sqrt') {
|
|
879
|
+
const physicalAtOffset = dataOffset * dataOffset;
|
|
880
|
+
const physicalAtOffsetPlusScale = (dataOffset + dataScale) * (dataOffset + dataScale);
|
|
881
|
+
const convertedPhysicalAtOffset = conversionFunc(physicalAtOffset);
|
|
882
|
+
const convertedPhysicalAtOffsetPlusScale = conversionFunc(physicalAtOffsetPlusScale);
|
|
883
|
+
const newOffset = Math.sqrt(Math.abs(convertedPhysicalAtOffset)) * Math.sign(convertedPhysicalAtOffset);
|
|
884
|
+
const newOffsetPlusScale = Math.sqrt(Math.abs(convertedPhysicalAtOffsetPlusScale)) * Math.sign(convertedPhysicalAtOffsetPlusScale);
|
|
885
|
+
dataScale = newOffsetPlusScale - newOffset;
|
|
886
|
+
dataOffset = newOffset;
|
|
887
|
+
} else {
|
|
888
|
+
const convertedOffset = conversionFunc(dataOffset);
|
|
889
|
+
const convertedOffsetPlusScale = conversionFunc(dataOffset + dataScale);
|
|
890
|
+
dataScale = convertedOffsetPlusScale - convertedOffset;
|
|
891
|
+
dataOffset = convertedOffset;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
|
|
821
896
|
if (baseUnit !== toUnit) {
|
|
822
897
|
const conversionFunc = getUnitConversionFunction(baseUnit, toUnit);
|
|
823
898
|
if (conversionFunc) {
|
|
Binary file
|