@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
|
@@ -22,7 +22,9 @@ struct FragmentUniforms {
|
|
|
22
22
|
float missingQuantized;
|
|
23
23
|
float2 textureSize;
|
|
24
24
|
int smoothing;
|
|
25
|
-
int scaleType;
|
|
25
|
+
int scaleType;
|
|
26
|
+
int isPtype;
|
|
27
|
+
int isMRMS;
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
// --- Vertex Shader (Unchanged) ---
|
|
@@ -34,52 +36,56 @@ vertex RasterizerData vertex_main(const Vertex in [[stage_in]],
|
|
|
34
36
|
return out;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
float2 pixel_floor = floor(pixel_coord - 0.5);
|
|
49
|
-
float2 f = fract(pixel_coord - 0.5);
|
|
50
|
-
|
|
51
|
-
// Calculate the precise UV coordinates for the CENTER of the four surrounding texels.
|
|
52
|
-
float2 uv00 = (pixel_floor + float2(0.5, 0.5)) * texel_size;
|
|
53
|
-
float2 uv10 = (pixel_floor + float2(1.5, 0.5)) * texel_size;
|
|
54
|
-
float2 uv01 = (pixel_floor + float2(0.5, 1.5)) * texel_size;
|
|
55
|
-
float2 uv11 = (pixel_floor + float2(1.5, 1.5)) * texel_size;
|
|
56
|
-
|
|
57
|
-
// Sample the four corner texels.
|
|
58
|
-
float s00 = dataTexture.sample(dataSampler, uv00).r * 255.0;
|
|
59
|
-
float s10 = dataTexture.sample(dataSampler, uv10).r * 255.0;
|
|
60
|
-
float s01 = dataTexture.sample(dataSampler, uv01).r * 255.0;
|
|
61
|
-
float s11 = dataTexture.sample(dataSampler, uv11).r * 255.0;
|
|
62
|
-
|
|
63
|
-
// THE CRITICAL CHECK: If any surrounding pixel is a "missing" value,
|
|
64
|
-
// treat this entire fragment as missing to prevent interpolation.
|
|
65
|
-
if (abs(s00 - missing_value) < 0.5 ||
|
|
66
|
-
abs(s10 - missing_value) < 0.5 ||
|
|
67
|
-
abs(s01 - missing_value) < 0.5 ||
|
|
68
|
-
abs(s11 - missing_value) < 0.5)
|
|
69
|
-
{
|
|
70
|
-
return missing_value;
|
|
39
|
+
|
|
40
|
+
// --- HELPER FUNCTIONS FOR FRAGMENT SHADER ---
|
|
41
|
+
|
|
42
|
+
// Dequantizes a signed value (-127 to 127) into a physical value
|
|
43
|
+
float dequantize_val(float q_val, constant FragmentUniforms &uniforms) {
|
|
44
|
+
if (abs(q_val - uniforms.missingQuantized) < 0.5) {
|
|
45
|
+
return -9999.0;
|
|
46
|
+
}
|
|
47
|
+
float intermediate = q_val * uniforms.scale + uniforms.offset;
|
|
48
|
+
if (uniforms.scaleType == 1) { // 1 = sqrt
|
|
49
|
+
return intermediate * abs(intermediate);
|
|
71
50
|
}
|
|
51
|
+
return intermediate;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Samples texture, converts 0-255 to signed -128-127 range.
|
|
55
|
+
// Returns a quantized value, or a large positive sentinel for missing data.
|
|
56
|
+
float get_value(texture2d<float, access::sample> dataTexture, sampler dataSampler, float2 coord, constant FragmentUniforms &uniforms) {
|
|
57
|
+
// Note: The sampler should be set to 'nearest' when calling this for ptype logic.
|
|
58
|
+
float value_0_to_255 = dataTexture.sample(dataSampler, coord).r * 255.0;
|
|
59
|
+
float val = value_0_to_255 - 128.0;
|
|
60
|
+
float missing_in_texture_range_0_255 = uniforms.missingQuantized + 128.0;
|
|
61
|
+
if (abs(value_0_to_255 - missing_in_texture_range_0_255) < 0.5) {
|
|
62
|
+
return 99999.0; // Sentinel for "missing"
|
|
63
|
+
}
|
|
64
|
+
return val;
|
|
65
|
+
}
|
|
72
66
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
// Maps a physical value to a precipitation type category
|
|
68
|
+
// Maps a physical value to a precipitation type category
|
|
69
|
+
float get_ptype_from_physical(float val, constant FragmentUniforms &uniforms) { // ADD uniforms parameter
|
|
70
|
+
if (val < 0.0) return -1.0;
|
|
76
71
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
if (uniforms.isMRMS == 1) { // ADD THIS BRANCH
|
|
73
|
+
// MRMS: 0-100 rain, 100-200 snow, 200-300 freezing rain
|
|
74
|
+
if (val < 100.0) return 0.0;
|
|
75
|
+
if (val < 200.0) return 1.0;
|
|
76
|
+
if (val < 300.0) return 2.0;
|
|
77
|
+
return -1.0;
|
|
78
|
+
} else {
|
|
79
|
+
// Models: 0-100 rain, 100-200 snow, 200-300 freezing rain, 300-400 ice pellets
|
|
80
|
+
if (val < 100.0) return 0.0;
|
|
81
|
+
if (val < 200.0) return 1.0;
|
|
82
|
+
if (val < 300.0) return 2.0;
|
|
83
|
+
if (val < 400.0) return 3.0;
|
|
84
|
+
return -1.0;
|
|
85
|
+
}
|
|
80
86
|
}
|
|
81
87
|
|
|
82
|
-
// --- Fragment Shader
|
|
88
|
+
// --- Main Fragment Shader ---
|
|
83
89
|
fragment float4 fragment_main(RasterizerData in [[stage_in]],
|
|
84
90
|
constant FragmentUniforms &uniforms [[buffer(0)]],
|
|
85
91
|
texture2d<float, access::sample> dataTexture [[texture(0)]],
|
|
@@ -87,45 +93,99 @@ fragment float4 fragment_main(RasterizerData in [[stage_in]],
|
|
|
87
93
|
sampler dataSampler [[sampler(0)]],
|
|
88
94
|
sampler colormapSampler [[sampler(1)]])
|
|
89
95
|
{
|
|
90
|
-
|
|
91
|
-
float
|
|
92
|
-
if (uniforms.smoothing == 1) {
|
|
93
|
-
// Use our custom function that prevents edge artifacts.
|
|
94
|
-
value_in_texture = sampleDataTextureSmooth(dataTexture, dataSampler, in.texCoord, uniforms);
|
|
95
|
-
} else {
|
|
96
|
-
// Smoothing is off. The sampler is already set to 'nearest' by the Swift code,
|
|
97
|
-
// so a standard sample call produces the correct pixelated result.
|
|
98
|
-
value_in_texture = dataTexture.sample(dataSampler, in.texCoord).r * 255.0;
|
|
99
|
-
}
|
|
96
|
+
float raw_value;
|
|
97
|
+
float alpha_multiplier = 1.0; // Used for alpha feathering at data edges
|
|
100
98
|
|
|
101
|
-
|
|
99
|
+
if (uniforms.smoothing == 0) { // Nearest neighbor
|
|
100
|
+
float quantized_value = get_value(dataTexture, dataSampler, in.texCoord, uniforms);
|
|
101
|
+
if (quantized_value >= 99999.0) {
|
|
102
|
+
discard_fragment();
|
|
103
|
+
}
|
|
104
|
+
raw_value = dequantize_val(quantized_value, uniforms);
|
|
102
105
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
} else { // Bilinear interpolation
|
|
107
|
+
float2 texel_size = 1.0 / uniforms.textureSize;
|
|
108
|
+
float2 tex_coord_in_texels = in.texCoord * uniforms.textureSize;
|
|
109
|
+
float2 bl_texel_index = floor(tex_coord_in_texels - 0.5);
|
|
110
|
+
float2 f = fract(tex_coord_in_texels - 0.5); // Interpolation factors
|
|
107
111
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
// Coordinates of the 4 neighboring texels
|
|
113
|
+
float2 v00_coord = (bl_texel_index + float2(0.5, 0.5)) * texel_size;
|
|
114
|
+
float2 v10_coord = (bl_texel_index + float2(1.5, 0.5)) * texel_size;
|
|
115
|
+
float2 v01_coord = (bl_texel_index + float2(0.5, 1.5)) * texel_size;
|
|
116
|
+
float2 v11_coord = (bl_texel_index + float2(1.5, 1.5)) * texel_size;
|
|
117
|
+
|
|
118
|
+
if (uniforms.isPtype == 1) {
|
|
119
|
+
// --- PTYPE-SPECIFIC INTERPOLATION (CATEGORICAL) ---
|
|
120
|
+
float v00 = dequantize_val(get_value(dataTexture, dataSampler, v00_coord, uniforms), uniforms);
|
|
121
|
+
float v10 = dequantize_val(get_value(dataTexture, dataSampler, v10_coord, uniforms), uniforms);
|
|
122
|
+
float v01 = dequantize_val(get_value(dataTexture, dataSampler, v01_coord, uniforms), uniforms);
|
|
123
|
+
float v11 = dequantize_val(get_value(dataTexture, dataSampler, v11_coord, uniforms), uniforms);
|
|
124
|
+
|
|
125
|
+
float p00 = get_ptype_from_physical(v00, uniforms);
|
|
126
|
+
float p10 = get_ptype_from_physical(v10, uniforms);
|
|
127
|
+
float p01 = get_ptype_from_physical(v01, uniforms);
|
|
128
|
+
float p11 = get_ptype_from_physical(v11, uniforms);
|
|
129
|
+
|
|
130
|
+
// Determine the dominant precipitation type for this pixel
|
|
131
|
+
float dominant_ptype = -1.0;
|
|
132
|
+
if (p00 != -1.0) dominant_ptype = p00;
|
|
133
|
+
else if (p10 != -1.0) dominant_ptype = p10;
|
|
134
|
+
else if (p01 != -1.0) dominant_ptype = p01;
|
|
135
|
+
else if (p11 != -1.0) dominant_ptype = p11;
|
|
136
|
+
|
|
137
|
+
if (dominant_ptype == -1.0) discard_fragment();
|
|
138
|
+
|
|
139
|
+
// Interpolate ONLY the values that match the dominant ptype
|
|
140
|
+
float total_value = 0.0;
|
|
141
|
+
float total_weight = 0.0;
|
|
142
|
+
if (p00 == dominant_ptype) { float w = (1.0-f.x)*(1.0-f.y); total_value+=v00*w; total_weight+=w; }
|
|
143
|
+
if (p10 == dominant_ptype) { float w = f.x*(1.0-f.y); total_value+=v10*w; total_weight+=w; }
|
|
144
|
+
if (p01 == dominant_ptype) { float w = (1.0-f.x)*f.y; total_value+=v01*w; total_weight+=w; }
|
|
145
|
+
if (p11 == dominant_ptype) { float w = f.x*f.y; total_value+=v11*w; total_weight+=w; }
|
|
146
|
+
|
|
147
|
+
if (total_weight <= 0.0) discard_fragment();
|
|
148
|
+
raw_value = total_value / total_weight;
|
|
149
|
+
|
|
150
|
+
// Force full alpha to prevent dark borders between ptype regions
|
|
151
|
+
alpha_multiplier = 1.0;
|
|
152
|
+
|
|
153
|
+
} else {
|
|
154
|
+
// --- STANDARD INTERPOLATION (CONTINUOUS) ---
|
|
155
|
+
float v00_q = get_value(dataTexture, dataSampler, v00_coord, uniforms);
|
|
156
|
+
float v10_q = get_value(dataTexture, dataSampler, v10_coord, uniforms);
|
|
157
|
+
float v01_q = get_value(dataTexture, dataSampler, v01_coord, uniforms);
|
|
158
|
+
float v11_q = get_value(dataTexture, dataSampler, v11_coord, uniforms);
|
|
159
|
+
|
|
160
|
+
float total_value_q = 0.0;
|
|
161
|
+
float total_weight = 0.0;
|
|
162
|
+
if (v00_q < 99999.0) { float w = (1.0-f.x)*(1.0-f.y); total_value_q+=v00_q*w; total_weight+=w; }
|
|
163
|
+
if (v10_q < 99999.0) { float w = f.x*(1.0-f.y); total_value_q+=v10_q*w; total_weight+=w; }
|
|
164
|
+
if (v01_q < 99999.0) { float w = (1.0-f.x)*f.y; total_value_q+=v01_q*w; total_weight+=w; }
|
|
165
|
+
if (v11_q < 99999.0) { float w = f.x*f.y; total_value_q+=v11_q*w; total_weight+=w; }
|
|
166
|
+
|
|
167
|
+
if (total_weight <= 0.0) discard_fragment();
|
|
168
|
+
raw_value = dequantize_val(total_value_q / total_weight, uniforms);
|
|
169
|
+
alpha_multiplier = total_weight; // Feather the edges of the data
|
|
170
|
+
}
|
|
116
171
|
}
|
|
117
|
-
|
|
118
|
-
//
|
|
172
|
+
|
|
173
|
+
// --- COMMON FINAL STEPS ---
|
|
174
|
+
|
|
119
175
|
if (raw_value < uniforms.dataRange.x) {
|
|
120
176
|
discard_fragment();
|
|
121
177
|
}
|
|
122
|
-
|
|
123
|
-
// Normalize the value to a 0-1 coordinate for colormap lookup.
|
|
178
|
+
|
|
124
179
|
float colormap_coord = (raw_value - uniforms.dataRange.x) / (uniforms.dataRange.y - uniforms.dataRange.x);
|
|
125
180
|
colormap_coord = clamp(colormap_coord, 0.0, 1.0);
|
|
126
181
|
|
|
127
|
-
// Sample the colormap and apply final opacity.
|
|
128
182
|
float4 color = colormapTexture.sample(colormapSampler, float2(colormap_coord, 0.5));
|
|
129
183
|
|
|
130
|
-
|
|
184
|
+
// Discard if the colormap specifies transparency
|
|
185
|
+
if (color.a < 0.1) {
|
|
186
|
+
discard_fragment();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
float final_alpha = color.a * uniforms.opacity * alpha_multiplier;
|
|
190
|
+
return float4(color.rgb * final_alpha, final_alpha);
|
|
131
191
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -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": {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
execSync
|
|
6
|
+
} = require('child_process');
|
|
7
|
+
const os = require('os');
|
|
8
|
+
|
|
9
|
+
// Check if we're on macOS
|
|
10
|
+
if (os.platform() !== 'darwin') {
|
|
11
|
+
console.log('⏭️ Skipping shader compilation (macOS only)');
|
|
12
|
+
process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Check if xcrun is available
|
|
16
|
+
try {
|
|
17
|
+
execSync('which xcrun', {
|
|
18
|
+
stdio: 'ignore'
|
|
19
|
+
});
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.log('⚠️ xcrun not found. Skipping shader compilation.');
|
|
22
|
+
process.exit(0);
|
|
23
|
+
}
|
|
24
|
+
console.log('🔨 Compiling Metal shaders for all platforms...');
|
|
25
|
+
const SHADER_DIR = 'ios';
|
|
26
|
+
const OUTPUT_DIR = 'ios/compiled-shaders';
|
|
27
|
+
try {
|
|
28
|
+
// Create output directory
|
|
29
|
+
execSync(`mkdir -p "${OUTPUT_DIR}"`, {
|
|
30
|
+
stdio: 'inherit'
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Compile for iOS Device (arm64)
|
|
34
|
+
console.log(' 📱 Compiling for iOS device...');
|
|
35
|
+
execSync(`xcrun -sdk iphoneos metal -c "${SHADER_DIR}/Shaders.metal" -o "${OUTPUT_DIR}/Shaders-device.air"`, {
|
|
36
|
+
stdio: 'inherit'
|
|
37
|
+
});
|
|
38
|
+
execSync(`xcrun -sdk iphoneos metallib "${OUTPUT_DIR}/Shaders-device.air" -o "${OUTPUT_DIR}/Shaders-device.metallib"`, {
|
|
39
|
+
stdio: 'inherit'
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Compile for iOS Simulator (x86_64 + arm64)
|
|
43
|
+
console.log(' 💻 Compiling for iOS simulator...');
|
|
44
|
+
execSync(`xcrun -sdk iphonesimulator metal -c "${SHADER_DIR}/Shaders.metal" -o "${OUTPUT_DIR}/Shaders-simulator.air"`, {
|
|
45
|
+
stdio: 'inherit'
|
|
46
|
+
});
|
|
47
|
+
execSync(`xcrun -sdk iphonesimulator metallib "${OUTPUT_DIR}/Shaders-simulator.air" -o "${OUTPUT_DIR}/Shaders-simulator.metallib"`, {
|
|
48
|
+
stdio: 'inherit'
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Clean up intermediate files
|
|
52
|
+
execSync(`rm "${OUTPUT_DIR}"/*.air`, {
|
|
53
|
+
stdio: 'inherit'
|
|
54
|
+
});
|
|
55
|
+
console.log('✅ Metal shaders compiled:');
|
|
56
|
+
console.log(` - Device: ${OUTPUT_DIR}/Shaders-device.metallib`);
|
|
57
|
+
console.log(` - Simulator: ${OUTPUT_DIR}/Shaders-simulator.metallib`);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error('❌ Shader compilation failed:', error.message);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=compile-shaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["execSync","require","os","platform","console","log","process","exit","stdio","error","SHADER_DIR","OUTPUT_DIR","message"],"sourceRoot":"../../..","sources":["scripts/compile-shaders.js"],"mappings":"AAAA;AAAmB;;AAEnB,MAAM;EAAEA;AAAS,CAAC,GAAGC,OAAO,CAAC,eAAe,CAAC;AAC7C,MAAMC,EAAE,GAAGD,OAAO,CAAC,IAAI,CAAC;;AAExB;AACA,IAAIC,EAAE,CAACC,QAAQ,CAAC,CAAC,KAAK,QAAQ,EAAE;EAC5BC,OAAO,CAACC,GAAG,CAAC,8CAA8C,CAAC;EAC3DC,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;AACnB;;AAEA;AACA,IAAI;EACAP,QAAQ,CAAC,aAAa,EAAE;IAAEQ,KAAK,EAAE;EAAS,CAAC,CAAC;AAChD,CAAC,CAAC,OAAOC,KAAK,EAAE;EACZL,OAAO,CAACC,GAAG,CAAC,mDAAmD,CAAC;EAChEC,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;AACnB;AAEAH,OAAO,CAACC,GAAG,CAAC,iDAAiD,CAAC;AAE9D,MAAMK,UAAU,GAAG,KAAK;AACxB,MAAMC,UAAU,GAAG,sBAAsB;AAEzC,IAAI;EACA;EACAX,QAAQ,CAAC,aAAaW,UAAU,GAAG,EAAE;IAAEH,KAAK,EAAE;EAAU,CAAC,CAAC;;EAE1D;EACAJ,OAAO,CAACC,GAAG,CAAC,kCAAkC,CAAC;EAC/CL,QAAQ,CAAC,iCAAiCU,UAAU,uBAAuBC,UAAU,sBAAsB,EAAE;IAAEH,KAAK,EAAE;EAAU,CAAC,CAAC;EAClIR,QAAQ,CAAC,iCAAiCW,UAAU,4BAA4BA,UAAU,2BAA2B,EAAE;IAAEH,KAAK,EAAE;EAAU,CAAC,CAAC;;EAE5I;EACAJ,OAAO,CAACC,GAAG,CAAC,qCAAqC,CAAC;EAClDL,QAAQ,CAAC,wCAAwCU,UAAU,uBAAuBC,UAAU,yBAAyB,EAAE;IAAEH,KAAK,EAAE;EAAU,CAAC,CAAC;EAC5IR,QAAQ,CAAC,wCAAwCW,UAAU,+BAA+BA,UAAU,8BAA8B,EAAE;IAAEH,KAAK,EAAE;EAAU,CAAC,CAAC;;EAEzJ;EACAR,QAAQ,CAAC,OAAOW,UAAU,SAAS,EAAE;IAAEH,KAAK,EAAE;EAAU,CAAC,CAAC;EAE1DJ,OAAO,CAACC,GAAG,CAAC,2BAA2B,CAAC;EACxCD,OAAO,CAACC,GAAG,CAAC,gBAAgBM,UAAU,0BAA0B,CAAC;EACjEP,OAAO,CAACC,GAAG,CAAC,mBAAmBM,UAAU,6BAA6B,CAAC;AAC3E,CAAC,CAAC,OAAOF,KAAK,EAAE;EACZL,OAAO,CAACK,KAAK,CAAC,8BAA8B,EAAEA,KAAK,CAACG,OAAO,CAAC;EAC5DN,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;AACnB","ignoreList":[]}
|
|
@@ -180,6 +180,14 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
180
180
|
forecastHour,
|
|
181
181
|
mrmsTimestamp
|
|
182
182
|
} = state;
|
|
183
|
+
|
|
184
|
+
// NEW: Fix the current forecast hour if it's invalid for this variable/model combo
|
|
185
|
+
let effectiveForecastHour = forecastHour;
|
|
186
|
+
if (!isMRMS && variable === 'ptypeRefl' && model === 'hrrr' && forecastHour === 0) {
|
|
187
|
+
const validHours = availableHours.filter(hour => hour !== 0);
|
|
188
|
+
effectiveForecastHour = validHours.length > 0 ? validHours[0] : 0;
|
|
189
|
+
console.log(`⚠️ [Preload] Correcting invalid hour 0 to ${effectiveForecastHour} for HRRR ptypeRefl`);
|
|
190
|
+
}
|
|
183
191
|
if (!cachedGeometry.current || !cachedColormap.current) {
|
|
184
192
|
const gridModel = isMRMS ? 'mrms' : model;
|
|
185
193
|
const {
|
|
@@ -197,7 +205,18 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
197
205
|
} = core._getColormapForVariable(variable);
|
|
198
206
|
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
199
207
|
const finalColormap = core._convertColormapUnits(colormap, baseUnit, toUnit);
|
|
200
|
-
|
|
208
|
+
let dataRange;
|
|
209
|
+
if (variable === 'ptypeRefl' || variable === 'ptypeRate') {
|
|
210
|
+
if (isMRMS) {
|
|
211
|
+
console.log('🔧 Using MRMS ptype data range: 5-380');
|
|
212
|
+
dataRange = [5, 380];
|
|
213
|
+
} else {
|
|
214
|
+
console.log('🔧 Using Model ptype data range: 5-380');
|
|
215
|
+
dataRange = [5, 380];
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
dataRange = [finalColormap[0], finalColormap[finalColormap.length - 2]];
|
|
219
|
+
}
|
|
201
220
|
const colormapBytes = _generateColormapBytes(finalColormap);
|
|
202
221
|
const colormapAsBase64 = (0, _base64Js.fromByteArray)(colormapBytes);
|
|
203
222
|
gridLayerRef.current.updateColormapTexture(colormapAsBase64);
|
|
@@ -211,12 +230,18 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
211
230
|
});
|
|
212
231
|
hasInitialLoad.current = true;
|
|
213
232
|
}
|
|
214
|
-
|
|
233
|
+
|
|
234
|
+
// Apply the same filtering logic as in AguaceroCore._emitStateChange
|
|
235
|
+
let filteredHours = availableHours;
|
|
236
|
+
if (!isMRMS && variable === 'ptypeRefl' && model === 'hrrr' && availableHours && availableHours.length > 0) {
|
|
237
|
+
filteredHours = availableHours.filter(hour => hour !== 0);
|
|
238
|
+
}
|
|
239
|
+
const allFrames = isMRMS ? availableTimestamps : filteredHours;
|
|
215
240
|
if (!allFrames || allFrames.length === 0) {
|
|
216
241
|
console.warn('🟡 [preloadAllFramesToDisk] No frames available to download.');
|
|
217
242
|
return;
|
|
218
243
|
}
|
|
219
|
-
const currentFrame = isMRMS ? mrmsTimestamp :
|
|
244
|
+
const currentFrame = isMRMS ? mrmsTimestamp : effectiveForecastHour;
|
|
220
245
|
const prioritizedFrames = [currentFrame, ...allFrames.filter(frame => frame !== currentFrame)];
|
|
221
246
|
console.log(`[Preload] Prioritizing frame: ${currentFrame}. Total frames: ${prioritizedFrames.length}`);
|
|
222
247
|
const {
|
|
@@ -230,7 +255,7 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
230
255
|
prioritizedFrames.forEach((frame, index) => {
|
|
231
256
|
const cacheKey = isMRMS ? `mrms-${frame}-${variable}` : `${model}-${date}-${run}-${frame}-${variable}`;
|
|
232
257
|
if (preloadedDataCache.current.has(cacheKey)) {
|
|
233
|
-
return;
|
|
258
|
+
return;
|
|
234
259
|
}
|
|
235
260
|
let resourcePath;
|
|
236
261
|
if (isMRMS) {
|
|
@@ -259,8 +284,6 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
259
284
|
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
260
285
|
let dataScale = result.scale;
|
|
261
286
|
let dataOffset = result.offset;
|
|
262
|
-
|
|
263
|
-
// Calculate converted values for immediate use
|
|
264
287
|
let convertedScale = dataScale;
|
|
265
288
|
let convertedOffset = dataOffset;
|
|
266
289
|
if (baseUnit !== toUnit) {
|
|
@@ -281,22 +304,18 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
281
304
|
}
|
|
282
305
|
}
|
|
283
306
|
}
|
|
284
|
-
|
|
285
|
-
// Store with ORIGINAL values for unit conversion later
|
|
286
307
|
const frameData = {
|
|
287
308
|
filePath: result.filePath,
|
|
288
309
|
nx,
|
|
289
310
|
ny,
|
|
290
311
|
scale: convertedScale,
|
|
291
|
-
// Current converted values
|
|
292
312
|
offset: convertedOffset,
|
|
293
313
|
missing: result.missing,
|
|
294
314
|
corners,
|
|
295
315
|
gridDef,
|
|
296
316
|
scaleType: result.scaleType,
|
|
297
317
|
originalScale: result.scale,
|
|
298
|
-
|
|
299
|
-
originalOffset: result.offset // CRITICAL: Always original
|
|
318
|
+
originalOffset: result.offset
|
|
300
319
|
};
|
|
301
320
|
preloadedDataCache.current.set(cacheKey, frameData);
|
|
302
321
|
const isCurrentFrame = index === 0;
|
|
@@ -321,14 +340,11 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
321
340
|
nx: frameData.nx,
|
|
322
341
|
ny: frameData.ny,
|
|
323
342
|
scale: frameData.scale,
|
|
324
|
-
// Current converted scale
|
|
325
343
|
offset: frameData.offset,
|
|
326
|
-
// Current converted offset
|
|
327
344
|
missing: frameData.missing,
|
|
328
345
|
scaleType: frameData.scaleType || 'linear',
|
|
329
346
|
originalScale: frameData.originalScale,
|
|
330
|
-
|
|
331
|
-
originalOffset: frameData.originalOffset // ADD THIS
|
|
347
|
+
originalOffset: frameData.originalOffset
|
|
332
348
|
}
|
|
333
349
|
};
|
|
334
350
|
gridLayerRef.current.primeGpuCache(frameInfoForGpu);
|
|
@@ -402,7 +418,16 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
402
418
|
} = core._getColormapForVariable(variable);
|
|
403
419
|
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
404
420
|
const finalColormap = core._convertColormapUnits(colormap, baseUnit, toUnit);
|
|
405
|
-
|
|
421
|
+
let dataRange;
|
|
422
|
+
if (variable === 'ptypeRefl' || variable === 'ptypeRate') {
|
|
423
|
+
if (isMRMS) {
|
|
424
|
+
dataRange = [5, 380];
|
|
425
|
+
} else {
|
|
426
|
+
dataRange = [5, 380];
|
|
427
|
+
}
|
|
428
|
+
} else {
|
|
429
|
+
dataRange = [finalColormap[0], finalColormap[finalColormap.length - 2]];
|
|
430
|
+
}
|
|
406
431
|
const colormapBytes = _generateColormapBytes(finalColormap);
|
|
407
432
|
const colormapAsBase64 = (0, _base64Js.fromByteArray)(colormapBytes);
|
|
408
433
|
gridLayerRef.current.updateColormapTexture(colormapAsBase64);
|
|
@@ -617,7 +642,16 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
617
642
|
colormap
|
|
618
643
|
} = core._getColormapForVariable(variable);
|
|
619
644
|
const finalColormap = core._convertColormapUnits(colormap, baseUnit, toUnit);
|
|
620
|
-
|
|
645
|
+
let dataRange;
|
|
646
|
+
if (variable === 'ptypeRefl' || variable === 'ptypeRate') {
|
|
647
|
+
if (isMRMS) {
|
|
648
|
+
dataRange = [5, 380];
|
|
649
|
+
} else {
|
|
650
|
+
dataRange = [5, 380];
|
|
651
|
+
}
|
|
652
|
+
} else {
|
|
653
|
+
dataRange = [finalColormap[0], finalColormap[finalColormap.length - 2]];
|
|
654
|
+
}
|
|
621
655
|
const colormapBytes = _generateColormapBytes(finalColormap);
|
|
622
656
|
const colormapAsBase64 = (0, _base64Js.fromByteArray)(colormapBytes);
|
|
623
657
|
gridLayerRef.current.updateColormapTexture(colormapAsBase64);
|