@aguacerowx/react-native 0.0.31 → 0.0.33

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.
Files changed (34) hide show
  1. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AguaceroPackage.class.uniqueId1 +0 -0
  2. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{GridRenderLayer$VertexInfo.class.uniqueId0 → GridRenderLayer$VertexInfo.class.uniqueId2} +0 -0
  3. package/{lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1 → android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId3} +0 -0
  4. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId4 +0 -0
  5. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderManager.class.uniqueId0 +0 -0
  6. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/InspectorModule.class.uniqueId5 +0 -0
  7. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AguaceroPackage.class.uniqueId1 +0 -0
  8. package/lib/{module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0 → commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId2} +0 -0
  9. package/{android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1 → lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId3} +0 -0
  10. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId4 +0 -0
  11. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderManager.class.uniqueId0 +0 -0
  12. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/InspectorModule.class.uniqueId5 +0 -0
  13. package/lib/commonjs/package.json +1 -1
  14. package/lib/commonjs/src/WeatherLayerManager.js +75 -3
  15. package/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
  16. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AguaceroPackage.class.uniqueId1 +0 -0
  17. package/lib/{commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0 → module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId2} +0 -0
  18. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{GridRenderLayer.class.uniqueId1 → GridRenderLayer.class.uniqueId3} +0 -0
  19. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId4 +0 -0
  20. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderManager.class.uniqueId0 +0 -0
  21. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/InspectorModule.class.uniqueId5 +0 -0
  22. package/lib/module/lib/commonjs/ios/generated/AguaceroWxReactNativeSpec.h +0 -0
  23. package/lib/module/lib/commonjs/package.json +1 -1
  24. package/lib/module/lib/commonjs/src/WeatherLayerManager.js +75 -3
  25. package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
  26. package/lib/module/package.json +1 -1
  27. package/lib/module/src/WeatherLayerManager.js +76 -4
  28. package/lib/module/src/WeatherLayerManager.js.map +1 -1
  29. package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/src/WeatherLayerManager.js +82 -7
  32. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
  33. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
  34. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +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';
@@ -81,6 +81,7 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
81
81
  initialVariable,
82
82
  autoRefresh,
83
83
  autoRefreshInterval,
84
+ initialModel,
84
85
  ...restProps
85
86
  } = props;
86
87
  const context = useContext(AguaceroContext);
@@ -92,7 +93,8 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
92
93
  // ADD: Pass layerOptions to the core's constructor
93
94
  layerOptions: {
94
95
  mode: initialMode,
95
- variable: initialVariable
96
+ variable: initialVariable,
97
+ model: initialModel
96
98
  }
97
99
  }), [apiKey]);
98
100
 
@@ -246,7 +248,6 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
246
248
  // Double-check currentFrame is valid
247
249
  if (currentFrame == null) {
248
250
  hasPreloadedRef.current = false;
249
- return;
250
251
  }
251
252
 
252
253
  // Reverse the frame order to load from last to first
@@ -282,13 +283,38 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
282
283
  }
283
284
 
284
285
  const { baseUnit } = core._getColormapForVariable(variable);
285
- const toUnit = core._getTargetUnit(baseUnit, units);
286
286
 
287
+ const toUnit = core._getTargetUnit(baseUnit, units);
288
+
289
+ const fieldInfo = DICTIONARIES?.fld?.[variable] || {};
290
+ const serverDataUnit = fieldInfo.defaultUnit || baseUnit;
291
+
287
292
  let dataScale = result.scale;
288
293
  let dataOffset = result.offset;
289
-
294
+
290
295
  let convertedScale = dataScale;
291
296
  let convertedOffset = dataOffset;
297
+
298
+ if (serverDataUnit !== baseUnit) {
299
+ const conversionFunc = getUnitConversionFunction(serverDataUnit, baseUnit);
300
+ if (conversionFunc) {
301
+ if (result.scaleType === 'sqrt') {
302
+ const physicalAtOffset = dataOffset * dataOffset;
303
+ const physicalAtOffsetPlusScale = (dataOffset + dataScale) * (dataOffset + dataScale);
304
+ const convertedPhysicalAtOffset = conversionFunc(physicalAtOffset);
305
+ const convertedPhysicalAtOffsetPlusScale = conversionFunc(physicalAtOffsetPlusScale);
306
+ convertedOffset = Math.sqrt(Math.abs(convertedPhysicalAtOffset)) * Math.sign(convertedPhysicalAtOffset);
307
+ const newOffsetPlusScale = Math.sqrt(Math.abs(convertedPhysicalAtOffsetPlusScale)) * Math.sign(convertedPhysicalAtOffsetPlusScale);
308
+ convertedScale = newOffsetPlusScale - convertedOffset;
309
+ } else {
310
+ convertedOffset = conversionFunc(dataOffset);
311
+ const convertedOffsetPlusScale = conversionFunc(dataOffset + dataScale);
312
+ convertedScale = convertedOffsetPlusScale - convertedOffset;
313
+ }
314
+ dataScale = convertedScale;
315
+ dataOffset = convertedOffset;
316
+ }
317
+ }
292
318
 
293
319
  if (baseUnit !== toUnit) {
294
320
  const conversionFunc = getUnitConversionFunction(baseUnit, toUnit);
@@ -307,7 +333,7 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
307
333
  convertedScale = convertedOffsetPlusScale - convertedOffset;
308
334
  }
309
335
  }
310
- }
336
+ }
311
337
 
312
338
  const frameData = {
313
339
  filePath: result.filePath,
@@ -346,7 +372,6 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
346
372
  } catch (error) {
347
373
  console.warn(`⚠️ [preloadAllFramesToDisk] Failed frame ${currentFrame}:`, error);
348
374
  hasPreloadedRef.current = false;
349
- return;
350
375
  }
351
376
  }
352
377
 
@@ -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) {