@aguacerowx/react-native 0.0.20 → 0.0.22
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/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +42 -5
- package/android/src/main/res/raw/fragment_shader.glsl +18 -8
- package/ios/FragmentUniforms.swift +2 -0
- package/ios/GridRenderLayer.swift +24 -4
- package/ios/GridRenderLayerManager.mm +12 -0
- package/ios/GridRenderLayerView.h +1 -7
- package/ios/GridRenderLayerView.m +7 -1
- package/ios/Shaders.metal +131 -71
- package/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +42 -5
- package/lib/commonjs/android/src/main/res/raw/fragment_shader.glsl +18 -8
- package/lib/commonjs/ios/FragmentUniforms.swift +2 -0
- package/lib/commonjs/ios/GridRenderLayer.swift +24 -4
- package/lib/commonjs/ios/GridRenderLayerManager.mm +12 -0
- package/lib/commonjs/ios/GridRenderLayerView.h +1 -7
- package/lib/commonjs/ios/GridRenderLayerView.m +7 -1
- package/lib/commonjs/ios/Shaders.metal +131 -71
- package/lib/commonjs/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/lib/commonjs/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/commonjs/package.json +3 -3
- package/lib/commonjs/scripts/compile-shaders.js +62 -0
- package/lib/commonjs/scripts/compile-shaders.js.map +1 -0
- package/lib/commonjs/scripts/compile-shaders.sh +12 -0
- package/lib/commonjs/src/WeatherLayerManager.js +51 -17
- package/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +42 -5
- package/lib/module/android/src/main/res/raw/fragment_shader.glsl +18 -8
- package/lib/module/ios/FragmentUniforms.swift +2 -0
- package/lib/module/ios/GridRenderLayer.swift +24 -4
- package/lib/module/ios/GridRenderLayerManager.mm +12 -0
- package/lib/module/ios/GridRenderLayerView.h +1 -7
- package/lib/module/ios/GridRenderLayerView.m +7 -1
- package/lib/module/ios/Shaders.metal +131 -71
- package/lib/module/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/lib/module/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/module/lib/commonjs/package.json +3 -3
- package/lib/module/lib/commonjs/scripts/compile-shaders.js +62 -0
- package/lib/module/lib/commonjs/scripts/compile-shaders.js.map +1 -0
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js +51 -17
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/package.json +3 -3
- package/lib/module/scripts/compile-shaders.js +60 -0
- package/lib/module/scripts/compile-shaders.js.map +1 -0
- package/lib/module/scripts/compile-shaders.sh +12 -0
- package/lib/module/src/WeatherLayerManager.js +51 -17
- package/lib/module/src/WeatherLayerManager.js.map +1 -1
- package/lib/typescript/scripts/compile-shaders.d.ts +3 -0
- package/lib/typescript/scripts/compile-shaders.d.ts.map +1 -0
- package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/WeatherLayerManager.js +192 -151
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +0 -1063
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +0 -381
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +0 -1256
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +0 -4041
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js +0 -38
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +0 -30
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +0 -27
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js +0 -41
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +0 -301
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +0 -126
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/package.json +0 -48
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +0 -1055
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +0 -381
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +0 -1256
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +0 -4041
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js +0 -38
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +0 -30
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +0 -27
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js +0 -41
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +0 -301
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +0 -126
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +0 -1
- package/lib/module/lib/commonjs/android/build.gradle +0 -108
- package/lib/module/lib/commonjs/android/src/main/AndroidManifest.xml +0 -7
- package/lib/module/lib/commonjs/ios/FragmentUniforms.swift +0 -14
- package/lib/module/lib/commonjs/ios/GridRenderLayer.swift +0 -983
- package/lib/module/lib/commonjs/ios/GridRenderLayerBridge.swift +0 -30
- package/lib/module/lib/commonjs/ios/GridRenderLayerManager.mm +0 -146
- package/lib/module/lib/commonjs/ios/GridRenderLayerView.h +0 -23
- package/lib/module/lib/commonjs/ios/GridRenderLayerView.m +0 -199
- package/lib/module/lib/commonjs/ios/InspectorDataCache.swift +0 -66
- package/lib/module/lib/commonjs/ios/InspectorModule.m +0 -10
- package/lib/module/lib/commonjs/ios/InspectorModule.swift +0 -64
- package/lib/module/lib/commonjs/ios/Shaders.metal +0 -131
- package/lib/module/lib/commonjs/ios/WeatherFrameProcessorModule.m +0 -16
- package/lib/module/lib/commonjs/ios/WeatherFrameProcessorModule.swift +0 -104
- package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders.metallib +0 -0
- package/lib/module/lib/commonjs/ios/generated/AguaceroWxReactNativeSpec-generated.mm +0 -0
- package/lib/module/lib/commonjs/ios/generated/AguaceroWxReactNativeSpec.h +0 -0
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +0 -1063
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +0 -381
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +0 -1256
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +0 -4041
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js +0 -38
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +0 -30
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +0 -27
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js +0 -41
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +0 -301
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +0 -126
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/package.json +0 -48
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +0 -1059
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +0 -381
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +0 -1256
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +0 -4041
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js +0 -38
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +0 -30
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +0 -27
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js +0 -41
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +0 -301
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +0 -126
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +0 -1
- package/lib/module/lib/commonjs/scripts/compile-shaders.sh +0 -27
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +0 -1063
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +0 -381
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +0 -1256
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +0 -4041
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/events.js +0 -38
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +0 -30
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +0 -27
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/index.js +0 -41
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +0 -301
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +0 -126
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/package.json +0 -48
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +0 -1047
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +0 -375
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +0 -1250
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +0 -4035
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/events.js +0 -31
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +0 -29
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +0 -21
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/index.js +0 -12
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +0 -295
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +0 -119
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aguacerowx/react-native",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"description": "Native weather rendering for React Native",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Michael Barletta",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"android/src/main/java/com/facebook/react/viewmanagers"
|
|
29
29
|
],
|
|
30
30
|
"scripts": {
|
|
31
|
-
"compile-shaders": "
|
|
31
|
+
"compile-shaders": "node scripts/compile-shaders.js",
|
|
32
32
|
"clean": "node -e \"require('fs').rmSync('lib', {recursive: true, force: true})\"",
|
|
33
33
|
"build": "npm run compile-shaders && npm run clean && bob build",
|
|
34
34
|
"prepare": "npm run build"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"react-native-device-info": ">=10.0.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@aguacerowx/javascript-sdk": "^0.0.
|
|
47
|
+
"@aguacerowx/javascript-sdk": "^0.0.15",
|
|
48
48
|
"base64-js": "^1.5.1"
|
|
49
49
|
},
|
|
50
50
|
"react-native-builder-bob": {
|
|
@@ -134,171 +134,194 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
|
|
|
134
134
|
};
|
|
135
135
|
}, [core]);
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
const preloadAllFramesToDisk = (state) => {
|
|
138
|
+
|
|
139
|
+
if (hasPreloadedRef.current) {
|
|
140
|
+
console.log('✅ [Preload] Gating preload; already initiated for this dataset.');
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
hasPreloadedRef.current = true;
|
|
144
|
+
console.log('🚀 [Preload] Initiating parallel preload for new dataset...');
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
const { isMRMS, model, date, run, variable, units, availableHours, availableTimestamps, forecastHour, mrmsTimestamp } = state;
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
// NEW: Fix the current forecast hour if it's invalid for this variable/model combo
|
|
149
|
+
let effectiveForecastHour = forecastHour;
|
|
150
|
+
if (!isMRMS && variable === 'ptypeRefl' && model === 'hrrr' && forecastHour === 0) {
|
|
151
|
+
const validHours = availableHours.filter(hour => hour !== 0);
|
|
152
|
+
effectiveForecastHour = validHours.length > 0 ? validHours[0] : 0;
|
|
153
|
+
console.log(`⚠️ [Preload] Correcting invalid hour 0 to ${effectiveForecastHour} for HRRR ptypeRefl`);
|
|
154
|
+
}
|
|
153
155
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
156
|
+
if (!cachedGeometry.current || !cachedColormap.current) {
|
|
157
|
+
const gridModel = isMRMS ? 'mrms' : model;
|
|
158
|
+
const { corners, gridDef } = core._getGridCornersAndDef(gridModel);
|
|
159
|
+
gridLayerRef.current.updateGeometry(corners, gridDef);
|
|
160
|
+
cachedGeometry.current = { model: gridModel, variable };
|
|
161
|
+
|
|
162
|
+
const { colormap, baseUnit } = core._getColormapForVariable(variable);
|
|
163
|
+
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
164
|
+
const finalColormap = core._convertColormapUnits(colormap, baseUnit, toUnit);
|
|
165
|
+
let dataRange;
|
|
166
|
+
if (variable === 'ptypeRefl' || variable === 'ptypeRate') {
|
|
167
|
+
if (isMRMS) {
|
|
168
|
+
console.log('🔧 Using MRMS ptype data range: 5-380');
|
|
169
|
+
dataRange = [5, 380];
|
|
170
|
+
} else {
|
|
171
|
+
console.log('🔧 Using Model ptype data range: 5-380');
|
|
172
|
+
dataRange = [5, 380];
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
dataRange = [finalColormap[0], finalColormap[finalColormap.length - 2]];
|
|
167
176
|
}
|
|
177
|
+
const colormapBytes = _generateColormapBytes(finalColormap);
|
|
178
|
+
const colormapAsBase64 = fromByteArray(colormapBytes);
|
|
179
|
+
|
|
180
|
+
gridLayerRef.current.updateColormapTexture(colormapAsBase64);
|
|
181
|
+
cachedColormap.current = { key: `${variable}-${units}` };
|
|
182
|
+
cachedDataRange.current = dataRange;
|
|
183
|
+
|
|
184
|
+
setRenderProps({ opacity: state.opacity, dataRange: dataRange });
|
|
185
|
+
hasInitialLoad.current = true;
|
|
186
|
+
}
|
|
168
187
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
188
|
+
// Apply the same filtering logic as in AguaceroCore._emitStateChange
|
|
189
|
+
let filteredHours = availableHours;
|
|
190
|
+
if (!isMRMS && variable === 'ptypeRefl' && model === 'hrrr' && availableHours && availableHours.length > 0) {
|
|
191
|
+
filteredHours = availableHours.filter(hour => hour !== 0);
|
|
192
|
+
}
|
|
174
193
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
console.log(`[Preload] Prioritizing frame: ${currentFrame}. Total frames: ${prioritizedFrames.length}`);
|
|
194
|
+
const allFrames = isMRMS ? availableTimestamps : filteredHours;
|
|
195
|
+
if (!allFrames || allFrames.length === 0) {
|
|
196
|
+
console.warn('🟡 [preloadAllFramesToDisk] No frames available to download.');
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
181
199
|
|
|
182
|
-
|
|
183
|
-
|
|
200
|
+
const currentFrame = isMRMS ? mrmsTimestamp : effectiveForecastHour;
|
|
201
|
+
const prioritizedFrames = [
|
|
202
|
+
currentFrame,
|
|
203
|
+
...allFrames.filter(frame => frame !== currentFrame)
|
|
204
|
+
];
|
|
205
|
+
console.log(`[Preload] Prioritizing frame: ${currentFrame}. Total frames: ${prioritizedFrames.length}`);
|
|
184
206
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if (preloadedDataCache.current.has(cacheKey)) {
|
|
188
|
-
return; // Use 'return' here as it's a forEach loop
|
|
189
|
-
}
|
|
207
|
+
const { corners, gridDef } = core._getGridCornersAndDef(isMRMS ? 'mrms' : model);
|
|
208
|
+
const { nx, ny } = gridDef.grid_params;
|
|
190
209
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const d = frameDate.getUTCDate().toString().padStart(2, '0');
|
|
197
|
-
resourcePath = `/grids/mrms/${y}${m}${d}/${frame}/0/${variable}/0`;
|
|
198
|
-
} else {
|
|
199
|
-
resourcePath = `/grids/${model}/${date}/${run}/${frame}/${variable}/0`;
|
|
200
|
-
}
|
|
210
|
+
prioritizedFrames.forEach((frame, index) => {
|
|
211
|
+
const cacheKey = isMRMS ? `mrms-${frame}-${variable}` : `${model}-${date}-${run}-${frame}-${variable}`;
|
|
212
|
+
if (preloadedDataCache.current.has(cacheKey)) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
201
215
|
|
|
202
|
-
|
|
203
|
-
|
|
216
|
+
let resourcePath;
|
|
217
|
+
if (isMRMS) {
|
|
218
|
+
const frameDate = new Date(frame * 1000);
|
|
219
|
+
const y = frameDate.getUTCFullYear();
|
|
220
|
+
const m = (frameDate.getUTCMonth() + 1).toString().padStart(2, '0');
|
|
221
|
+
const d = frameDate.getUTCDate().toString().padStart(2, '0');
|
|
222
|
+
resourcePath = `/grids/mrms/${y}${m}${d}/${frame}/0/${variable}/0`;
|
|
223
|
+
} else {
|
|
224
|
+
resourcePath = `/grids/${model}/${date}/${run}/${frame}/${variable}/0`;
|
|
225
|
+
}
|
|
204
226
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
227
|
+
const url = `${core.baseGridUrl}${resourcePath}?apiKey=${core.apiKey}`;
|
|
228
|
+
const options = { url, apiKey: core.apiKey, bundleId: core.bundleId };
|
|
229
|
+
|
|
230
|
+
WeatherFrameProcessorModule.processFrame(options)
|
|
231
|
+
.then(result => {
|
|
232
|
+
if (!result || !result.filePath) {
|
|
233
|
+
console.warn(`⚠️ [preloadAllFramesToDisk] Failed frame ${frame}: No filePath`);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const { baseUnit } = core._getColormapForVariable(variable);
|
|
238
|
+
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
239
|
+
|
|
240
|
+
let dataScale = result.scale;
|
|
241
|
+
let dataOffset = result.offset;
|
|
242
|
+
|
|
243
|
+
let convertedScale = dataScale;
|
|
244
|
+
let convertedOffset = dataOffset;
|
|
245
|
+
|
|
246
|
+
if (baseUnit !== toUnit) {
|
|
247
|
+
const conversionFunc = getUnitConversionFunction(baseUnit, toUnit);
|
|
248
|
+
if (conversionFunc) {
|
|
249
|
+
if (result.scaleType === 'sqrt') {
|
|
250
|
+
const physicalAtOffset = dataOffset * dataOffset;
|
|
251
|
+
const physicalAtOffsetPlusScale = (dataOffset + dataScale) * (dataOffset + dataScale);
|
|
252
|
+
const convertedPhysicalAtOffset = conversionFunc(physicalAtOffset);
|
|
253
|
+
const convertedPhysicalAtOffsetPlusScale = conversionFunc(physicalAtOffsetPlusScale);
|
|
254
|
+
convertedOffset = Math.sqrt(Math.abs(convertedPhysicalAtOffset)) * Math.sign(convertedPhysicalAtOffset);
|
|
255
|
+
const newOffsetPlusScale = Math.sqrt(Math.abs(convertedPhysicalAtOffsetPlusScale)) * Math.sign(convertedPhysicalAtOffsetPlusScale);
|
|
256
|
+
convertedScale = newOffsetPlusScale - convertedOffset;
|
|
257
|
+
} else {
|
|
258
|
+
convertedOffset = conversionFunc(dataOffset);
|
|
259
|
+
const convertedOffsetPlusScale = conversionFunc(dataOffset + dataScale);
|
|
260
|
+
convertedScale = convertedOffsetPlusScale - convertedOffset;
|
|
238
261
|
}
|
|
239
262
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const frameData = {
|
|
266
|
+
filePath: result.filePath,
|
|
267
|
+
nx, ny,
|
|
268
|
+
scale: convertedScale,
|
|
269
|
+
offset: convertedOffset,
|
|
270
|
+
missing: result.missing,
|
|
271
|
+
corners,
|
|
272
|
+
gridDef,
|
|
273
|
+
scaleType: result.scaleType,
|
|
274
|
+
originalScale: result.scale,
|
|
275
|
+
originalOffset: result.offset
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
preloadedDataCache.current.set(cacheKey, frameData);
|
|
279
|
+
|
|
280
|
+
const isCurrentFrame = index === 0;
|
|
281
|
+
|
|
282
|
+
if (isCurrentFrame) {
|
|
283
|
+
console.log(`🎯 [Preload] Using FAST LANE to process and draw current frame (${frame}) immediately.`);
|
|
284
|
+
gridLayerRef.current.updateDataTextureFromFile(
|
|
285
|
+
frameData.filePath,
|
|
286
|
+
frameData.nx, frameData.ny,
|
|
287
|
+
frameData.scale, frameData.offset, frameData.missing,
|
|
288
|
+
frameData.scaleType
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
currentGridDataRef.current = {
|
|
292
|
+
nx: frameData.nx,
|
|
293
|
+
ny: frameData.ny,
|
|
294
|
+
scale: frameData.scale,
|
|
295
|
+
offset: frameData.offset,
|
|
296
|
+
missing: frameData.missing,
|
|
297
|
+
gridDef: frameData.gridDef,
|
|
298
|
+
variable: variable,
|
|
299
|
+
units: units
|
|
253
300
|
};
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
currentGridDataRef.current = {
|
|
269
|
-
nx: frameData.nx,
|
|
270
|
-
ny: frameData.ny,
|
|
271
|
-
scale: frameData.scale,
|
|
272
|
-
offset: frameData.offset,
|
|
273
|
-
missing: frameData.missing,
|
|
274
|
-
gridDef: frameData.gridDef,
|
|
275
|
-
variable: variable,
|
|
276
|
-
units: units
|
|
301
|
+
} else {
|
|
302
|
+
if (Platform.OS === 'ios' && gridLayerRef.current.primeGpuCache) {
|
|
303
|
+
const frameInfoForGpu = {
|
|
304
|
+
[cacheKey]: {
|
|
305
|
+
filePath: frameData.filePath,
|
|
306
|
+
nx: frameData.nx,
|
|
307
|
+
ny: frameData.ny,
|
|
308
|
+
scale: frameData.scale,
|
|
309
|
+
offset: frameData.offset,
|
|
310
|
+
missing: frameData.missing,
|
|
311
|
+
scaleType: frameData.scaleType || 'linear',
|
|
312
|
+
originalScale: frameData.originalScale,
|
|
313
|
+
originalOffset: frameData.originalOffset
|
|
314
|
+
}
|
|
277
315
|
};
|
|
278
|
-
|
|
279
|
-
if (Platform.OS === 'ios' && gridLayerRef.current.primeGpuCache) {
|
|
280
|
-
const frameInfoForGpu = {
|
|
281
|
-
[cacheKey]: {
|
|
282
|
-
filePath: frameData.filePath,
|
|
283
|
-
nx: frameData.nx,
|
|
284
|
-
ny: frameData.ny,
|
|
285
|
-
scale: frameData.scale, // Current converted scale
|
|
286
|
-
offset: frameData.offset, // Current converted offset
|
|
287
|
-
missing: frameData.missing,
|
|
288
|
-
scaleType: frameData.scaleType || 'linear',
|
|
289
|
-
originalScale: frameData.originalScale, // ADD THIS
|
|
290
|
-
originalOffset: frameData.originalOffset // ADD THIS
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
gridLayerRef.current.primeGpuCache(frameInfoForGpu);
|
|
294
|
-
}
|
|
316
|
+
gridLayerRef.current.primeGpuCache(frameInfoForGpu);
|
|
295
317
|
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
};
|
|
318
|
+
}
|
|
319
|
+
})
|
|
320
|
+
.catch(error => {
|
|
321
|
+
console.warn(`⚠️ [preloadAllFramesToDisk] Failed frame ${frame}:`, error);
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
};
|
|
302
325
|
|
|
303
326
|
const updateGPUWithCachedData = (state) => {
|
|
304
327
|
const { model, date, run, forecastHour, variable, units, isMRMS, mrmsTimestamp } = state;
|
|
@@ -359,7 +382,16 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
|
|
|
359
382
|
const { colormap, baseUnit } = core._getColormapForVariable(variable);
|
|
360
383
|
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
361
384
|
const finalColormap = core._convertColormapUnits(colormap, baseUnit, toUnit);
|
|
362
|
-
|
|
385
|
+
let dataRange;
|
|
386
|
+
if (variable === 'ptypeRefl' || variable === 'ptypeRate') {
|
|
387
|
+
if (isMRMS) {
|
|
388
|
+
dataRange = [5, 380];
|
|
389
|
+
} else {
|
|
390
|
+
dataRange = [5, 380];
|
|
391
|
+
}
|
|
392
|
+
} else {
|
|
393
|
+
dataRange = [finalColormap[0], finalColormap[finalColormap.length - 2]];
|
|
394
|
+
}
|
|
363
395
|
const colormapBytes = _generateColormapBytes(finalColormap);
|
|
364
396
|
const colormapAsBase64 = fromByteArray(colormapBytes);
|
|
365
397
|
|
|
@@ -606,7 +638,16 @@ export const WeatherLayerManager = forwardRef((props, ref) => {
|
|
|
606
638
|
// Update the colormap AND data range
|
|
607
639
|
const { colormap } = core._getColormapForVariable(variable);
|
|
608
640
|
const finalColormap = core._convertColormapUnits(colormap, baseUnit, toUnit);
|
|
609
|
-
|
|
641
|
+
let dataRange;
|
|
642
|
+
if (variable === 'ptypeRefl' || variable === 'ptypeRate') {
|
|
643
|
+
if (isMRMS) {
|
|
644
|
+
dataRange = [5, 380];
|
|
645
|
+
} else {
|
|
646
|
+
dataRange = [5, 380];
|
|
647
|
+
}
|
|
648
|
+
} else {
|
|
649
|
+
dataRange = [finalColormap[0], finalColormap[finalColormap.length - 2]];
|
|
650
|
+
}
|
|
610
651
|
|
|
611
652
|
const colormapBytes = _generateColormapBytes(finalColormap);
|
|
612
653
|
const colormapAsBase64 = fromByteArray(colormapBytes);
|