@aguacerowx/react-native 0.0.4 → 0.0.6

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 (383) hide show
  1. package/README.md +51 -6
  2. package/android/build/.transforms/78b892a9dae44f36e51ff0649e9c6e36/transformed/classes/classes_dex/classes.dex +0 -0
  3. package/android/build/.transforms/f4de14556a82e99f0d27ddcab762b219/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.dex +0 -0
  4. package/android/build/.transforms/f4de14556a82e99f0d27ddcab762b219/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayer.dex +0 -0
  5. package/android/build/.transforms/f4de14556a82e99f0d27ddcab762b219/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayerView.dex +0 -0
  6. package/android/build/.transforms/f4de14556a82e99f0d27ddcab762b219/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderManager.dex +0 -0
  7. package/android/build/.transforms/f4de14556a82e99f0d27ddcab762b219/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/WeatherFrameProcessorModule.dex +0 -0
  8. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  9. package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
  10. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
  11. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  12. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  13. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  14. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
  15. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  16. package/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +16 -2
  17. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  18. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  19. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  20. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
  21. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  22. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  23. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0 +0 -0
  24. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1 +0 -0
  25. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
  26. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  27. package/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +9 -51
  28. package/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +8 -2
  29. package/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java +15 -14
  30. package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +15 -0
  31. package/android/src/main/res/raw/fragment_shader.glsl +13 -2
  32. package/ios/GridRenderLayer.swift +62 -0
  33. package/ios/GridRenderLayerManager.mm +140 -0
  34. package/ios/aguacerowx-react-native.podspec +29 -0
  35. package/lib/commonjs/README.md +61 -0
  36. package/lib/commonjs/android/build/generated/source/buildConfig/debug/com/aguacerowx/reactnative/BuildConfig.java +10 -0
  37. package/lib/commonjs/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +8 -0
  38. package/lib/commonjs/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  39. package/lib/commonjs/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
  40. package/lib/commonjs/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  41. package/lib/commonjs/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  42. package/lib/commonjs/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  43. package/lib/commonjs/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +4 -0
  44. package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_fragment_shader.glsl.flat +0 -0
  45. package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_vertex_shader.glsl.flat +0 -0
  46. package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
  47. package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_vertex_shader.glsl.flat +0 -0
  48. package/lib/commonjs/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +5 -0
  49. package/lib/commonjs/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  50. package/lib/commonjs/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
  51. package/lib/commonjs/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  52. package/lib/commonjs/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  53. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
  54. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/BuildConfig.class +0 -0
  55. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  56. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  57. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  58. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
  59. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  60. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
  61. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  62. package/lib/commonjs/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +6 -0
  63. package/lib/commonjs/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +8 -0
  64. package/lib/commonjs/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +8 -0
  65. package/lib/commonjs/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
  66. package/lib/commonjs/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  67. package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_fragment_shader.glsl +13 -0
  68. package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_vertex_shader.glsl +13 -0
  69. package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +101 -0
  70. package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/vertex_shader.glsl +20 -0
  71. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
  72. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/BuildConfig.class +0 -0
  73. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  74. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  75. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  76. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
  77. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  78. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
  79. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  80. package/lib/commonjs/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  81. package/lib/commonjs/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +5 -0
  82. package/lib/commonjs/android/build/outputs/logs/manifest-merger-debug-report.txt +17 -0
  83. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0 +0 -0
  84. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1 +0 -0
  85. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
  86. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  87. package/lib/commonjs/android/build.gradle +85 -0
  88. package/lib/commonjs/android/src/main/AndroidManifest.xml +7 -0
  89. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/AguaceroPackage.java +34 -0
  90. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +597 -0
  91. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +293 -0
  92. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java +112 -0
  93. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/InspectorModule.java +64 -0
  94. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/ShaderUtils.java +107 -0
  95. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +166 -0
  96. package/lib/commonjs/android/src/main/res/raw/debug_fragment_shader.glsl +13 -0
  97. package/lib/commonjs/android/src/main/res/raw/debug_vertex_shader.glsl +13 -0
  98. package/lib/commonjs/android/src/main/res/raw/fragment_shader.glsl +98 -0
  99. package/lib/commonjs/android/src/main/res/raw/vertex_shader.glsl +20 -0
  100. package/lib/commonjs/babel.config.js +7 -0
  101. package/lib/commonjs/babel.config.js.map +1 -0
  102. package/lib/commonjs/index.js +20 -0
  103. package/lib/commonjs/index.js.map +1 -0
  104. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +1003 -0
  105. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +1 -0
  106. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +381 -0
  107. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +1 -0
  108. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +1229 -0
  109. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +1 -0
  110. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +4023 -0
  111. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +1 -0
  112. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js +38 -0
  113. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +1 -0
  114. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +30 -0
  115. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +1 -0
  116. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +27 -0
  117. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +1 -0
  118. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js +47 -0
  119. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +1 -0
  120. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +301 -0
  121. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +1 -0
  122. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +126 -0
  123. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +1 -0
  124. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/package.json +48 -0
  125. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +972 -0
  126. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +1 -0
  127. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +381 -0
  128. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +1 -0
  129. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +1229 -0
  130. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +1 -0
  131. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +4023 -0
  132. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +1 -0
  133. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js +38 -0
  134. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +1 -0
  135. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +30 -0
  136. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +1 -0
  137. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +27 -0
  138. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +1 -0
  139. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js +41 -0
  140. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +1 -0
  141. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +301 -0
  142. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +1 -0
  143. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +126 -0
  144. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +1 -0
  145. package/lib/commonjs/package.json +73 -0
  146. package/lib/commonjs/react-native-builder-bob.config.js +13 -0
  147. package/lib/commonjs/react-native-builder-bob.config.js.map +1 -0
  148. package/lib/commonjs/src/AguaceroContext.js +11 -0
  149. package/lib/commonjs/src/AguaceroContext.js.map +1 -0
  150. package/lib/commonjs/src/GridRenderLayer.js +159 -0
  151. package/lib/commonjs/src/GridRenderLayer.js.map +1 -0
  152. package/lib/commonjs/src/GridRenderLayerNativeComponent.js +11 -0
  153. package/lib/commonjs/src/GridRenderLayerNativeComponent.js.map +1 -0
  154. package/lib/commonjs/src/MapManager.js +164 -0
  155. package/lib/commonjs/src/MapManager.js.map +1 -0
  156. package/lib/commonjs/src/MapRegistry.js +36 -0
  157. package/lib/commonjs/src/MapRegistry.js.map +1 -0
  158. package/lib/commonjs/src/StyleApplicator.js +262 -0
  159. package/lib/commonjs/src/StyleApplicator.js.map +1 -0
  160. package/lib/commonjs/src/WeatherLayerManager.js +731 -0
  161. package/lib/commonjs/src/WeatherLayerManager.js.map +1 -0
  162. package/lib/commonjs/tsconfig.json +24 -0
  163. package/lib/module/README.md +61 -0
  164. package/lib/module/android/build/generated/source/buildConfig/debug/com/aguacerowx/reactnative/BuildConfig.java +10 -0
  165. package/lib/module/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +8 -0
  166. package/lib/module/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  167. package/lib/module/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
  168. package/lib/module/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  169. package/lib/module/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  170. package/lib/module/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  171. package/lib/module/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +4 -0
  172. package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_fragment_shader.glsl.flat +0 -0
  173. package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_vertex_shader.glsl.flat +0 -0
  174. package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
  175. package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_vertex_shader.glsl.flat +0 -0
  176. package/lib/module/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +5 -0
  177. package/lib/module/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  178. package/lib/module/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
  179. package/lib/module/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  180. package/lib/module/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  181. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
  182. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/BuildConfig.class +0 -0
  183. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  184. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  185. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  186. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
  187. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  188. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
  189. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  190. package/lib/module/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +6 -0
  191. package/lib/module/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +8 -0
  192. package/lib/module/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +8 -0
  193. package/lib/module/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
  194. package/lib/module/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  195. package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_fragment_shader.glsl +13 -0
  196. package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_vertex_shader.glsl +13 -0
  197. package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +101 -0
  198. package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/vertex_shader.glsl +20 -0
  199. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
  200. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/BuildConfig.class +0 -0
  201. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  202. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  203. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  204. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
  205. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  206. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
  207. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  208. package/lib/module/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  209. package/lib/module/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +5 -0
  210. package/lib/module/android/build/outputs/logs/manifest-merger-debug-report.txt +17 -0
  211. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0 +0 -0
  212. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1 +0 -0
  213. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
  214. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  215. package/lib/module/android/build.gradle +85 -0
  216. package/lib/module/android/src/main/AndroidManifest.xml +7 -0
  217. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/AguaceroPackage.java +34 -0
  218. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +597 -0
  219. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +293 -0
  220. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java +112 -0
  221. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/InspectorModule.java +64 -0
  222. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/ShaderUtils.java +107 -0
  223. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +166 -0
  224. package/lib/module/android/src/main/res/raw/debug_fragment_shader.glsl +13 -0
  225. package/lib/module/android/src/main/res/raw/debug_vertex_shader.glsl +13 -0
  226. package/lib/module/android/src/main/res/raw/fragment_shader.glsl +98 -0
  227. package/lib/module/android/src/main/res/raw/vertex_shader.glsl +20 -0
  228. package/lib/module/babel.config.js +5 -0
  229. package/lib/module/babel.config.js.map +1 -0
  230. package/lib/module/index.js +3 -0
  231. package/lib/module/index.js.map +1 -0
  232. package/lib/module/lib/commonjs/README.md +61 -0
  233. package/lib/module/lib/commonjs/android/build.gradle +85 -0
  234. package/lib/module/lib/commonjs/android/src/main/AndroidManifest.xml +7 -0
  235. package/lib/module/lib/commonjs/babel.config.js +7 -0
  236. package/lib/module/lib/commonjs/babel.config.js.map +1 -0
  237. package/lib/module/lib/commonjs/index.js +20 -0
  238. package/lib/module/lib/commonjs/index.js.map +1 -0
  239. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +1003 -0
  240. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +1 -0
  241. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +381 -0
  242. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +1 -0
  243. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +1229 -0
  244. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +1 -0
  245. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +4023 -0
  246. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +1 -0
  247. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js +38 -0
  248. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +1 -0
  249. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +30 -0
  250. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +1 -0
  251. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +27 -0
  252. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +1 -0
  253. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js +47 -0
  254. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +1 -0
  255. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +301 -0
  256. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +1 -0
  257. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +126 -0
  258. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +1 -0
  259. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/package.json +48 -0
  260. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +976 -0
  261. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +1 -0
  262. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +381 -0
  263. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +1 -0
  264. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +1229 -0
  265. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +1 -0
  266. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +4023 -0
  267. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +1 -0
  268. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js +38 -0
  269. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +1 -0
  270. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +30 -0
  271. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +1 -0
  272. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +27 -0
  273. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +1 -0
  274. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js +41 -0
  275. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +1 -0
  276. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +301 -0
  277. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +1 -0
  278. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +126 -0
  279. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +1 -0
  280. package/lib/module/lib/commonjs/package.json +73 -0
  281. package/lib/module/lib/commonjs/react-native-builder-bob.config.js +13 -0
  282. package/lib/module/lib/commonjs/react-native-builder-bob.config.js.map +1 -0
  283. package/lib/module/lib/commonjs/src/AguaceroContext.js +15 -0
  284. package/lib/module/lib/commonjs/src/AguaceroContext.js.map +1 -0
  285. package/lib/module/lib/commonjs/src/GridRenderLayer.js +182 -0
  286. package/lib/module/lib/commonjs/src/GridRenderLayer.js.map +1 -0
  287. package/lib/module/lib/commonjs/src/GridRenderLayerNativeComponent.js +15 -0
  288. package/lib/module/lib/commonjs/src/GridRenderLayerNativeComponent.js.map +1 -0
  289. package/lib/module/lib/commonjs/src/MapManager.js +187 -0
  290. package/lib/module/lib/commonjs/src/MapManager.js.map +1 -0
  291. package/lib/module/lib/commonjs/src/MapRegistry.js +36 -0
  292. package/lib/module/lib/commonjs/src/MapRegistry.js.map +1 -0
  293. package/lib/module/lib/commonjs/src/StyleApplicator.js +286 -0
  294. package/lib/module/lib/commonjs/src/StyleApplicator.js.map +1 -0
  295. package/lib/module/lib/commonjs/src/WeatherLayerManager.js +750 -0
  296. package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -0
  297. package/lib/module/lib/commonjs/tsconfig.json +24 -0
  298. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +1003 -0
  299. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +1 -0
  300. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +381 -0
  301. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +1 -0
  302. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +1229 -0
  303. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +1 -0
  304. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +4023 -0
  305. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +1 -0
  306. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/events.js +38 -0
  307. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +1 -0
  308. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +30 -0
  309. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +1 -0
  310. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +27 -0
  311. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +1 -0
  312. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/index.js +47 -0
  313. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +1 -0
  314. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +301 -0
  315. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +1 -0
  316. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +126 -0
  317. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +1 -0
  318. package/lib/module/node_modules/@aguacerowx/javascript-sdk/package.json +48 -0
  319. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +964 -0
  320. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +1 -0
  321. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +375 -0
  322. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +1 -0
  323. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +1223 -0
  324. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +1 -0
  325. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +4017 -0
  326. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +1 -0
  327. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/events.js +31 -0
  328. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +1 -0
  329. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +29 -0
  330. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +1 -0
  331. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +21 -0
  332. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +1 -0
  333. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/index.js +12 -0
  334. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +1 -0
  335. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +295 -0
  336. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +1 -0
  337. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +119 -0
  338. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +1 -0
  339. package/lib/module/package.json +73 -0
  340. package/lib/module/react-native-builder-bob.config.js +11 -0
  341. package/lib/module/react-native-builder-bob.config.js.map +1 -0
  342. package/lib/module/src/AguaceroContext.js +5 -0
  343. package/lib/module/src/AguaceroContext.js.map +1 -0
  344. package/lib/module/src/GridRenderLayer.js +152 -0
  345. package/lib/module/src/GridRenderLayer.js.map +1 -0
  346. package/lib/module/src/GridRenderLayerNativeComponent.js +5 -0
  347. package/lib/module/src/GridRenderLayerNativeComponent.js.map +1 -0
  348. package/lib/module/src/MapManager.js +155 -0
  349. package/lib/module/src/MapManager.js.map +1 -0
  350. package/lib/module/src/MapRegistry.js +30 -0
  351. package/lib/module/src/MapRegistry.js.map +1 -0
  352. package/lib/module/src/StyleApplicator.js +255 -0
  353. package/lib/module/src/StyleApplicator.js.map +1 -0
  354. package/lib/module/src/WeatherLayerManager.js +724 -0
  355. package/lib/module/src/WeatherLayerManager.js.map +1 -0
  356. package/lib/module/tsconfig.json +24 -0
  357. package/lib/typescript/babel.config.d.ts +3 -0
  358. package/lib/typescript/babel.config.d.ts.map +1 -0
  359. package/lib/typescript/index.d.ts +3 -0
  360. package/lib/typescript/index.d.ts.map +1 -0
  361. package/lib/typescript/react-native-builder-bob.config.d.ts +6 -0
  362. package/lib/typescript/react-native-builder-bob.config.d.ts.map +1 -0
  363. package/lib/typescript/src/AguaceroContext.d.ts +2 -0
  364. package/lib/typescript/src/AguaceroContext.d.ts.map +1 -0
  365. package/lib/typescript/src/GridRenderLayer.d.ts +2 -0
  366. package/lib/typescript/src/GridRenderLayer.d.ts.map +1 -0
  367. package/lib/typescript/src/GridRenderLayerNativeComponent.d.ts +12 -0
  368. package/lib/typescript/src/GridRenderLayerNativeComponent.d.ts.map +1 -0
  369. package/lib/typescript/src/MapManager.d.ts +8 -0
  370. package/lib/typescript/src/MapManager.d.ts.map +1 -0
  371. package/lib/typescript/src/MapRegistry.d.ts +12 -0
  372. package/lib/typescript/src/MapRegistry.d.ts.map +1 -0
  373. package/lib/typescript/src/StyleApplicator.d.ts +4 -0
  374. package/lib/typescript/src/StyleApplicator.d.ts.map +1 -0
  375. package/lib/typescript/src/WeatherLayerManager.d.ts +2 -0
  376. package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -0
  377. package/package.json +53 -15
  378. package/src/AguaceroContext.js +0 -4
  379. package/src/GridRenderLayer.js +0 -121
  380. package/src/MapManager.js +0 -158
  381. package/src/MapRegistry.js +0 -35
  382. package/src/StyleApplicator.js +0 -241
  383. package/src/WeatherLayerManager.js +0 -754
@@ -0,0 +1,964 @@
1
+ // AguaceroCore.js - The Headless "Engine"
2
+
3
+ // --- Non-UI Imports ---
4
+ import { EventEmitter } from './events.js';
5
+ import { COORDINATE_CONFIGS } from './coordinate_configs.js';
6
+ import { getUnitConversionFunction } from './unitConversions.js';
7
+ import { DICTIONARIES, MODEL_CONFIGS } from './dictionaries.js';
8
+ import { DEFAULT_COLORMAPS } from './default-colormaps.js';
9
+ import proj4 from 'proj4';
10
+ import { decompress } from 'fzstd';
11
+ import { getBundleId } from './getBundleId';
12
+
13
+ // --- Non-UI Helper Functions ---
14
+ function hrdpsObliqueTransform(rotated_lon, rotated_lat) {
15
+ const o_lat_p = 53.91148;
16
+ const o_lon_p = 245.305142;
17
+ const DEG_TO_RAD = Math.PI / 180.0;
18
+ const RAD_TO_DEG = 180.0 / Math.PI;
19
+ const o_lat_p_rad = o_lat_p * DEG_TO_RAD;
20
+ const rot_lon_rad = rotated_lon * DEG_TO_RAD;
21
+ const rot_lat_rad = rotated_lat * DEG_TO_RAD;
22
+ const sin_rot_lat = Math.sin(rot_lat_rad);
23
+ const cos_rot_lat = Math.cos(rot_lat_rad);
24
+ const sin_rot_lon = Math.sin(rot_lon_rad);
25
+ const cos_rot_lon = Math.cos(rot_lon_rad);
26
+ const sin_o_lat_p = Math.sin(o_lat_p_rad);
27
+ const cos_o_lat_p = Math.cos(o_lat_p_rad);
28
+ const sin_lat = cos_o_lat_p * sin_rot_lat + sin_o_lat_p * cos_rot_lat * cos_rot_lon;
29
+ let lat = Math.asin(sin_lat) * RAD_TO_DEG;
30
+ const sin_lon_num = cos_rot_lat * sin_rot_lon;
31
+ const sin_lon_den = -sin_o_lat_p * sin_rot_lat + cos_o_lat_p * cos_rot_lat * cos_rot_lon;
32
+ let lon = Math.atan2(sin_lon_num, sin_lon_den) * RAD_TO_DEG + o_lon_p;
33
+ if (lon > 180) lon -= 360;else if (lon < -180) lon += 360;
34
+ return [lon, lat];
35
+ }
36
+ function findLatestModelRun(modelsData, modelName) {
37
+ const model = modelsData?.[modelName];
38
+ if (!model) return null;
39
+ const availableDates = Object.keys(model).sort((a, b) => b.localeCompare(a));
40
+ for (const date of availableDates) {
41
+ const runs = model[date];
42
+ if (!runs) continue;
43
+ const availableRuns = Object.keys(runs).sort((a, b) => b.localeCompare(a));
44
+ if (availableRuns.length > 0) return {
45
+ date: date,
46
+ run: availableRuns[0]
47
+ };
48
+ }
49
+ return null;
50
+ }
51
+ export class AguaceroCore extends EventEmitter {
52
+ constructor(options = {}) {
53
+ super();
54
+ this.isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
55
+ this.apiKey = options.apiKey;
56
+ this.bundleId = getBundleId();
57
+ this.baseGridUrl = 'https://d3dc62msmxkrd7.cloudfront.net';
58
+ if (!this.isReactNative) {
59
+ this.worker = this.createWorker();
60
+ this.workerRequestId = 0;
61
+ this.workerResolvers = new Map();
62
+ this.worker.addEventListener('message', this._handleWorkerMessage.bind(this));
63
+ this.resultQueue = [];
64
+ this.isProcessingQueue = false;
65
+ } else {
66
+ this.worker = null;
67
+ }
68
+ this.statusUrl = 'https://d3dc62msmxkrd7.cloudfront.net/model-status';
69
+ this.modelStatus = null;
70
+ this.mrmsStatus = null;
71
+ this.dataCache = new Map();
72
+ this.abortControllers = new Map();
73
+ this.isPlaying = false;
74
+ this.playIntervalId = null;
75
+ this.playbackSpeed = options.playbackSpeed || 500;
76
+ this.customColormaps = options.customColormaps || {};
77
+ const userLayerOptions = options.layerOptions || {};
78
+ const initialVariable = userLayerOptions.variable || null;
79
+ this.state = {
80
+ model: userLayerOptions.model || 'gfs',
81
+ isMRMS: false,
82
+ mrmsTimestamp: null,
83
+ variable: initialVariable,
84
+ date: null,
85
+ run: null,
86
+ forecastHour: 0,
87
+ visible: true,
88
+ opacity: userLayerOptions.opacity ?? 1,
89
+ units: options.initialUnit || 'imperial',
90
+ shaderSmoothingEnabled: options.shaderSmoothingEnabled ?? true
91
+ };
92
+ this.autoRefreshEnabled = options.autoRefresh ?? false;
93
+ this.autoRefreshIntervalSeconds = options.autoRefreshInterval ?? 60;
94
+ this.autoRefreshIntervalId = null;
95
+ }
96
+ async setState(newState) {
97
+ Object.assign(this.state, newState);
98
+ this._emitStateChange();
99
+ }
100
+ _emitStateChange() {
101
+ const {
102
+ colormap,
103
+ baseUnit
104
+ } = this._getColormapForVariable(this.state.variable);
105
+ const toUnit = this._getTargetUnit(baseUnit, this.state.units);
106
+ const displayColormap = this._convertColormapUnits(colormap, baseUnit, toUnit);
107
+ let availableTimestamps = [];
108
+ if (this.state.isMRMS && this.state.variable && this.mrmsStatus) {
109
+ const timestamps = this.mrmsStatus[this.state.variable] || [];
110
+ availableTimestamps = [...timestamps].reverse();
111
+ }
112
+ const eventPayload = {
113
+ ...this.state,
114
+ availableModels: this.modelStatus ? Object.keys(this.modelStatus).sort() : [],
115
+ availableRuns: this.modelStatus?.[this.state.model] || {},
116
+ availableHours: this.state.isMRMS ? [] : this.modelStatus?.[this.state.model]?.[this.state.date]?.[this.state.run] || [],
117
+ availableVariables: this.getAvailableVariables(this.state.isMRMS ? 'mrms' : this.state.model),
118
+ // We need to confirm this line is working as expected.
119
+ availableMRMSVariables: this.getAvailableVariables('mrms'),
120
+ availableTimestamps: availableTimestamps,
121
+ isPlaying: this.isPlaying,
122
+ colormap: displayColormap,
123
+ colormapBaseUnit: toUnit
124
+ };
125
+ this.emit('state:change', eventPayload);
126
+ }
127
+ async initialize(options = {}) {
128
+ await this.fetchModelStatus(true);
129
+ await this.fetchMRMSStatus(true);
130
+ const latestRun = findLatestModelRun(this.modelStatus, this.state.model);
131
+ let initialState = this.state;
132
+ if (latestRun && !this.state.isMRMS) {
133
+ initialState = {
134
+ ...this.state,
135
+ ...latestRun,
136
+ forecastHour: 0
137
+ };
138
+ const availableVariables = this.getAvailableVariables(initialState.model);
139
+ if (availableVariables && availableVariables.length > 0) {
140
+ initialState.variable = availableVariables[0];
141
+ }
142
+ }
143
+ await this.setState(initialState);
144
+ if (options.autoRefresh ?? this.autoRefreshEnabled) {
145
+ this.startAutoRefresh(options.refreshInterval ?? this.autoRefreshIntervalSeconds);
146
+ }
147
+ }
148
+ destroy() {
149
+ this.pause();
150
+ this.stopAutoRefresh();
151
+ this.dataCache.clear();
152
+ if (this.worker) {
153
+ this.worker.terminate();
154
+ }
155
+ this.callbacks = {};
156
+ console.log(`AguaceroCore has been destroyed.`);
157
+ }
158
+
159
+ // --- Public API Methods ---
160
+
161
+ play() {
162
+ if (this.isPlaying) return;
163
+ this.isPlaying = true;
164
+ clearInterval(this.playIntervalId);
165
+ this.playIntervalId = setInterval(() => {
166
+ this.step(1);
167
+ }, this.playbackSpeed);
168
+ this.emit('playback:start', {
169
+ speed: this.playbackSpeed
170
+ });
171
+ this._emitStateChange(); // Notify UI that isPlaying is now true
172
+ }
173
+ pause() {
174
+ if (!this.isPlaying) return;
175
+ this.isPlaying = false;
176
+ clearInterval(this.playIntervalId);
177
+ this.playIntervalId = null;
178
+ this.emit('playback:stop');
179
+ this._emitStateChange(); // Notify UI that isPlaying is now false
180
+ }
181
+ togglePlay() {
182
+ this.isPlaying ? this.pause() : this.play();
183
+ }
184
+ step(direction = 1) {
185
+ const {
186
+ model,
187
+ date,
188
+ run,
189
+ forecastHour
190
+ } = this.state;
191
+ const forecastHours = this.modelStatus?.[model]?.[date]?.[run];
192
+ if (!forecastHours || forecastHours.length === 0) return;
193
+ const currentIndex = forecastHours.indexOf(forecastHour);
194
+ if (currentIndex === -1) return;
195
+ const maxIndex = forecastHours.length - 1;
196
+ let nextIndex = currentIndex + direction;
197
+ if (nextIndex > maxIndex) nextIndex = 0;
198
+ if (nextIndex < 0) nextIndex = maxIndex;
199
+ this.setState({
200
+ forecastHour: forecastHours[nextIndex]
201
+ });
202
+ }
203
+ setPlaybackSpeed(speed) {
204
+ if (speed > 0) {
205
+ this.playbackSpeed = speed;
206
+ if (this.isPlaying) this.play();
207
+ }
208
+ }
209
+ async setShaderSmoothing(enabled) {
210
+ if (typeof enabled !== 'boolean' || enabled === this.state.shaderSmoothingEnabled) return;
211
+ await this.setState({
212
+ shaderSmoothingEnabled: enabled
213
+ });
214
+ }
215
+ async setOpacity(newOpacity) {
216
+ const clampedOpacity = Math.max(0, Math.min(1, newOpacity));
217
+ if (clampedOpacity === this.state.opacity) return;
218
+ await this.setState({
219
+ opacity: clampedOpacity
220
+ });
221
+ }
222
+ async setVariable(variable) {
223
+ await this.setState({
224
+ variable
225
+ });
226
+ }
227
+ async setModel(modelName) {
228
+ if (modelName === this.state.model || !this.modelStatus?.[modelName]) return;
229
+ const latestRun = findLatestModelRun(this.modelStatus, modelName);
230
+ if (latestRun) {
231
+ await this.setState({
232
+ model: modelName,
233
+ date: latestRun.date,
234
+ run: latestRun.run,
235
+ forecastHour: 0
236
+ });
237
+ }
238
+ }
239
+ async setRun(runString) {
240
+ const [date, run] = runString.split(':');
241
+ if (date !== this.state.date || run !== this.state.run) {
242
+ await this.setState({
243
+ date,
244
+ run,
245
+ forecastHour: 0
246
+ });
247
+ }
248
+ }
249
+ async setUnits(newUnits) {
250
+ if (newUnits === this.state.units || !['metric', 'imperial'].includes(newUnits)) return;
251
+ await this.setState({
252
+ units: newUnits
253
+ });
254
+ }
255
+ async setMRMSVariable(variable) {
256
+ const sortedTimestamps = [...(this.mrmsStatus[variable] || [])].sort((a, b) => b - a);
257
+ const initialTimestamp = sortedTimestamps.length > 0 ? sortedTimestamps[0] : null;
258
+ await this.setState({
259
+ variable,
260
+ isMRMS: true,
261
+ mrmsTimestamp: initialTimestamp
262
+ });
263
+ }
264
+ async setMRMSTimestamp(timestamp) {
265
+ if (!this.state.isMRMS) return;
266
+ await this.setState({
267
+ mrmsTimestamp: timestamp
268
+ });
269
+ }
270
+ async switchMode(options) {
271
+ const {
272
+ mode,
273
+ variable,
274
+ model,
275
+ forecastHour,
276
+ mrmsTimestamp
277
+ } = options;
278
+ if (!mode || !variable) {
279
+ console.error("switchMode requires 'mode' ('mrms' | 'model') and 'variable' properties.");
280
+ return;
281
+ }
282
+ if (mode === 'model' && !model) {
283
+ console.error("switchMode with mode 'model' requires a 'model' property.");
284
+ return;
285
+ }
286
+ let targetState = {};
287
+ if (mode === 'mrms') {
288
+ let finalTimestamp = mrmsTimestamp;
289
+ if (finalTimestamp === undefined) {
290
+ const sortedTimestamps = [...(this.mrmsStatus[variable] || [])].sort((a, b) => b - a);
291
+ finalTimestamp = sortedTimestamps.length > 0 ? sortedTimestamps[0] : null;
292
+ }
293
+ targetState = {
294
+ isMRMS: true,
295
+ variable: variable,
296
+ mrmsTimestamp: finalTimestamp,
297
+ model: this.state.model,
298
+ date: null,
299
+ run: null,
300
+ forecastHour: 0
301
+ };
302
+ } else if (mode === 'model') {
303
+ const latestRun = findLatestModelRun(this.modelStatus, model);
304
+ if (!latestRun) {
305
+ console.error(`Could not find a valid run for model: ${model}`);
306
+ return;
307
+ }
308
+ targetState = {
309
+ isMRMS: false,
310
+ model: model,
311
+ variable: variable,
312
+ date: latestRun.date,
313
+ run: latestRun.run,
314
+ forecastHour: forecastHour !== undefined ? forecastHour : 0,
315
+ mrmsTimestamp: null
316
+ };
317
+ } else {
318
+ console.error(`Invalid mode specified in switchMode: '${mode}'`);
319
+ return;
320
+ }
321
+ await this.setState(targetState);
322
+ }
323
+
324
+ // --- Data and Calculation Methods ---
325
+
326
+ _reconstructData(decompressedDeltas, encoding) {
327
+ const expectedLength = encoding.length;
328
+ const reconstructedData = new Int8Array(expectedLength);
329
+ if (decompressedDeltas.length > 0 && expectedLength > 0) {
330
+ // First value is absolute
331
+ reconstructedData[0] = decompressedDeltas[0] > 127 ? decompressedDeltas[0] - 256 : decompressedDeltas[0];
332
+
333
+ // Subsequent values are deltas from the previous one
334
+ for (let i = 1; i < expectedLength; i++) {
335
+ const delta = decompressedDeltas[i] > 127 ? decompressedDeltas[i] - 256 : decompressedDeltas[i];
336
+ reconstructedData[i] = reconstructedData[i - 1] + delta;
337
+ }
338
+ }
339
+ // Return as a Uint8Array, which is what the rest of the code expects
340
+ return new Uint8Array(reconstructedData.buffer);
341
+ }
342
+ async _loadGridData(state) {
343
+ if (this.isReactNative) {
344
+ console.warn(`[AguaceroCore] _loadGridData was called in React Native. This is a bypass. Data loading is handled natively.`);
345
+ return null;
346
+ }
347
+ const {
348
+ model,
349
+ date,
350
+ run,
351
+ forecastHour,
352
+ variable,
353
+ isMRMS,
354
+ mrmsTimestamp
355
+ } = state;
356
+ let effectiveSmoothing = 0;
357
+ const customVariableSettings = this.customColormaps[variable];
358
+ if (customVariableSettings && typeof customVariableSettings.smoothing === 'number') {
359
+ effectiveSmoothing = customVariableSettings.smoothing;
360
+ }
361
+ let resourcePath;
362
+ let dataUrlIdentifier;
363
+ if (isMRMS) {
364
+ if (!mrmsTimestamp) return null;
365
+ const mrmsDate = new Date(mrmsTimestamp * 1000);
366
+ const y = mrmsDate.getUTCFullYear(),
367
+ m = (mrmsDate.getUTCMonth() + 1).toString().padStart(2, '0'),
368
+ d = mrmsDate.getUTCDate().toString().padStart(2, '0');
369
+ dataUrlIdentifier = `mrms-${mrmsTimestamp}-${variable}-${effectiveSmoothing}`;
370
+ resourcePath = `/grids/mrms/${y}${m}${d}/${mrmsTimestamp}/0/${variable}/${effectiveSmoothing}`;
371
+ } else {
372
+ dataUrlIdentifier = `${model}-${date}-${run}-${forecastHour}-${variable}-${effectiveSmoothing}`;
373
+ resourcePath = `/grids/${model}/${date}/${run}/${forecastHour}/${variable}/${effectiveSmoothing}`;
374
+ }
375
+ if (this.dataCache.has(dataUrlIdentifier)) {
376
+ return this.dataCache.get(dataUrlIdentifier);
377
+ }
378
+
379
+ // --- EDITED ---
380
+ // If we are in React Native, this function should NOT do any work.
381
+ // The native WeatherFrameProcessorModule is now responsible for all data loading.
382
+ // This function might still be called by a "cache miss" fallback, but it
383
+ // should not fetch data from JS anymore. We return null so the fallback knows
384
+ // that the native module is the only source of truth for new data.
385
+ if (this.isReactNative) {
386
+ console.warn(`_loadGridData was called in React Native for ${dataUrlIdentifier}. This should be handled by the native module. Returning null.`);
387
+ return null;
388
+ }
389
+ const abortController = new AbortController();
390
+ this.abortControllers.set(dataUrlIdentifier, abortController);
391
+ const loadPromise = (async () => {
392
+ if (!this.apiKey) {
393
+ throw new Error('API key is not configured.');
394
+ }
395
+ try {
396
+ const baseUrl = `${this.baseGridUrl}${resourcePath}`;
397
+ const urlWithApiKeyParam = `${baseUrl}?apiKey=${this.apiKey}`;
398
+ const headers = {
399
+ 'x-api-key': this.apiKey
400
+ };
401
+ if (this.bundleId) {
402
+ headers['x-app-identifier'] = this.bundleId;
403
+ }
404
+ const response = await fetch(urlWithApiKeyParam, {
405
+ headers: headers,
406
+ signal: abortController.signal
407
+ });
408
+ if (!response.ok) {
409
+ throw new Error(`Failed to fetch grid data: ${response.status} ${response.statusText}`);
410
+ }
411
+ const {
412
+ data: b64Data,
413
+ encoding
414
+ } = await response.json();
415
+ const compressedData = Uint8Array.from(atob(b64Data), c => c.charCodeAt(0));
416
+
417
+ // This path is now ONLY for the web worker
418
+ const requestId = this.workerRequestId++;
419
+ const workerPromise = new Promise((resolve, reject) => {
420
+ this.workerResolvers.set(requestId, {
421
+ resolve,
422
+ reject
423
+ });
424
+ });
425
+ this.worker.postMessage({
426
+ requestId,
427
+ compressedData,
428
+ encoding
429
+ }, [compressedData.buffer]);
430
+ const result = await workerPromise;
431
+ const finalData = result.data;
432
+ const transformedData = new Uint8Array(finalData.length);
433
+ for (let i = 0; i < finalData.length; i++) {
434
+ const signedValue = finalData[i] > 127 ? finalData[i] - 256 : finalData[i];
435
+ transformedData[i] = signedValue + 128;
436
+ }
437
+ this.abortControllers.delete(dataUrlIdentifier);
438
+ return {
439
+ data: transformedData,
440
+ encoding
441
+ };
442
+ } catch (error) {
443
+ if (error.name === 'AbortError') {
444
+ console.log(`Request cancelled for ${resourcePath}`);
445
+ } else {
446
+ console.error(`Failed to load data for path ${resourcePath}:`, error);
447
+ }
448
+ this.dataCache.delete(dataUrlIdentifier);
449
+ this.abortControllers.delete(dataUrlIdentifier);
450
+ return null;
451
+ }
452
+ })();
453
+ this.dataCache.set(dataUrlIdentifier, loadPromise);
454
+ return loadPromise;
455
+ }
456
+ cancelAllRequests() {
457
+ // Abort all in-flight requests
458
+ this.abortControllers.forEach((controller, key) => {
459
+ controller.abort();
460
+ });
461
+
462
+ // Clear both maps
463
+ this.abortControllers.clear();
464
+ this.dataCache.clear();
465
+ console.log('All pending requests cancelled');
466
+ }
467
+ async getValueAtLngLat(lng, lat) {
468
+ const {
469
+ variable,
470
+ isMRMS,
471
+ mrmsTimestamp,
472
+ model,
473
+ date,
474
+ run,
475
+ forecastHour,
476
+ units
477
+ } = this.state;
478
+ if (!variable) return null;
479
+ const gridIndices = this._getGridIndexFromLngLat(lng, lat);
480
+ if (!gridIndices) return null;
481
+ const {
482
+ i,
483
+ j
484
+ } = gridIndices;
485
+ const gridModel = isMRMS ? 'mrms' : model;
486
+ const normalizedGridModel = this._normalizeModelName(gridModel);
487
+ const {
488
+ nx
489
+ } = COORDINATE_CONFIGS[normalizedGridModel].grid_params;
490
+ const customSettings = this.customColormaps[variable];
491
+ const effectiveSmoothing = customSettings && typeof customSettings.smoothing === 'number' ? customSettings.smoothing : 0;
492
+ const dataUrlIdentifier = isMRMS ? `mrms-${mrmsTimestamp}-${variable}-${effectiveSmoothing}` : `${model}-${date}-${run}-${forecastHour}-${variable}-${effectiveSmoothing}`;
493
+ const gridDataPromise = this.dataCache.get(dataUrlIdentifier);
494
+ if (!gridDataPromise) return null;
495
+ try {
496
+ const gridData = await gridDataPromise;
497
+ if (!gridData || !gridData.data) return null;
498
+ const index1D = j * nx + i;
499
+ const byteValue = gridData.data[index1D];
500
+ const signedQuantizedValue = byteValue - 128;
501
+ const {
502
+ scale,
503
+ offset,
504
+ missing_quantized
505
+ } = gridData.encoding;
506
+ if (signedQuantizedValue === missing_quantized) return null;
507
+ const nativeValue = signedQuantizedValue * scale + offset;
508
+ const {
509
+ baseUnit
510
+ } = this._getColormapForVariable(variable);
511
+ let dataNativeUnit = baseUnit || (DICTIONARIES.fld[variable] || {}).defaultUnit || 'none';
512
+ const displayUnit = this._getTargetUnit(dataNativeUnit, units);
513
+ const conversionFunc = getUnitConversionFunction(dataNativeUnit, displayUnit);
514
+ const displayValue = conversionFunc ? conversionFunc(nativeValue) : nativeValue;
515
+ return {
516
+ lngLat: {
517
+ lng,
518
+ lat
519
+ },
520
+ variable: {
521
+ code: variable,
522
+ name: this.getVariableDisplayName(variable)
523
+ },
524
+ value: displayValue,
525
+ unit: displayUnit
526
+ };
527
+ } catch (error) {
528
+ return null;
529
+ }
530
+ }
531
+ getAvailableVariables(modelName = null) {
532
+ const model = modelName || this.state.model;
533
+ return MODEL_CONFIGS[model]?.vars || [];
534
+ }
535
+ getVariableDisplayName(variableCode) {
536
+ const varInfo = DICTIONARIES.fld[variableCode];
537
+ return varInfo?.displayName || varInfo?.name || variableCode;
538
+ }
539
+ _getColormapForVariable(variable) {
540
+ if (!variable) return {
541
+ colormap: [],
542
+ baseUnit: ''
543
+ };
544
+ if (this.customColormaps[variable] && this.customColormaps[variable].colormap) {
545
+ return {
546
+ colormap: this.customColormaps[variable].colormap,
547
+ baseUnit: this.customColormaps[variable].baseUnit || ''
548
+ };
549
+ }
550
+ const colormapKey = DICTIONARIES.variable_cmap[variable] || variable;
551
+ const customColormap = this.customColormaps[colormapKey];
552
+ if (customColormap && customColormap.colormap) {
553
+ return {
554
+ colormap: customColormap.colormap,
555
+ baseUnit: customColormap.baseUnit || ''
556
+ };
557
+ }
558
+ const defaultColormapData = DEFAULT_COLORMAPS[colormapKey];
559
+ if (defaultColormapData && defaultColormapData.units) {
560
+ const availableUnits = Object.keys(defaultColormapData.units);
561
+ if (availableUnits.length > 0) {
562
+ const baseUnit = availableUnits[0];
563
+ const unitData = defaultColormapData.units[baseUnit];
564
+ if (unitData && unitData.colormap) {
565
+ return {
566
+ colormap: unitData.colormap,
567
+ baseUnit: baseUnit
568
+ };
569
+ }
570
+ }
571
+ }
572
+ return {
573
+ colormap: [],
574
+ baseUnit: ''
575
+ };
576
+ }
577
+ _convertColormapUnits(colormap, fromUnits, toUnits) {
578
+ if (fromUnits === toUnits) return colormap;
579
+ const conversionFunc = getUnitConversionFunction(fromUnits, toUnits);
580
+ if (!conversionFunc) return colormap;
581
+ const newColormap = [];
582
+ for (let i = 0; i < colormap.length; i += 2) {
583
+ newColormap.push(conversionFunc(colormap[i]), colormap[i + 1]);
584
+ }
585
+ return newColormap;
586
+ }
587
+ _normalizeModelName(modelName) {
588
+ const mapping = {
589
+ 'hrrr': ['mpashn', 'mpasrt', 'mpasht', 'hrrrsub', 'rrfs', 'namnest', 'mpasrn', 'mpasrn3', 'mpasht2'],
590
+ 'arw': ['arw2', 'fv3', 'href'],
591
+ 'rtma': ['nbm'],
592
+ 'ecmwf': ['ecmwfaifs'],
593
+ 'gfs': ['arpege', 'graphcastgfs']
594
+ };
595
+ for (const [normalized, aliases] of Object.entries(mapping)) {
596
+ if (aliases.includes(modelName)) return normalized;
597
+ }
598
+ return modelName;
599
+ }
600
+ _getGridCornersAndDef(model) {
601
+ const normalizedModel = this._normalizeModelName(model);
602
+ const gridDef = {
603
+ ...COORDINATE_CONFIGS[normalizedModel],
604
+ modelName: model
605
+ };
606
+ if (!gridDef) return null;
607
+ const {
608
+ nx,
609
+ ny
610
+ } = gridDef.grid_params;
611
+ const gridType = gridDef.type;
612
+ let corners;
613
+ if (gridType === 'latlon') {
614
+ let {
615
+ lon_first,
616
+ lat_first,
617
+ lat_last,
618
+ lon_last,
619
+ dx_degrees,
620
+ dy_degrees
621
+ } = gridDef.grid_params;
622
+ corners = {
623
+ lon_tl: lon_first,
624
+ lat_tl: lat_first,
625
+ lon_tr: lon_last !== undefined ? lon_last : lon_first + (nx - 1) * dx_degrees,
626
+ lat_tr: lat_first,
627
+ lon_bl: lon_first,
628
+ lat_bl: lat_last !== undefined ? lat_last : lat_first + (ny - 1) * dy_degrees,
629
+ lon_br: lon_last !== undefined ? lon_last : lon_first + (nx - 1) * dx_degrees,
630
+ lat_br: lat_last !== undefined ? lat_last : lat_first + (ny - 1) * dy_degrees
631
+ };
632
+ } else if (gridType === 'rotated_latlon') {
633
+ const [lon_tl, lat_tl] = hrdpsObliqueTransform(gridDef.grid_params.lon_first, gridDef.grid_params.lat_first);
634
+ const [lon_tr, lat_tr] = hrdpsObliqueTransform(gridDef.grid_params.lon_first + (nx - 1) * gridDef.grid_params.dx_degrees, gridDef.grid_params.lat_first);
635
+ const [lon_bl, lat_bl] = hrdpsObliqueTransform(gridDef.grid_params.lon_first, gridDef.grid_params.lat_first + (ny - 1) * gridDef.grid_params.dy_degrees);
636
+ const [lon_br, lat_br] = hrdpsObliqueTransform(gridDef.grid_params.lon_first + (nx - 1) * gridDef.grid_params.dx_degrees, gridDef.grid_params.lat_first + (ny - 1) * gridDef.grid_params.dy_degrees);
637
+ corners = {
638
+ lon_tl,
639
+ lat_tl,
640
+ lon_tr,
641
+ lat_tr,
642
+ lon_bl,
643
+ lat_bl,
644
+ lon_br,
645
+ lat_br
646
+ };
647
+ } else if (gridType === 'lambert_conformal_conic' || gridType === 'polar_ stereographic') {
648
+ let projString = Object.entries(gridDef.proj_params).map(([k, v]) => `+${k}=${v}`).join(' ');
649
+ if (gridType === 'polar_stereographic') projString += ' +lat_0=90';
650
+ const {
651
+ x_origin,
652
+ y_origin,
653
+ dx,
654
+ dy
655
+ } = gridDef.grid_params;
656
+ const [lon_tl, lat_tl] = proj4(projString, 'EPSG:4326', [x_origin, y_origin]);
657
+ const [lon_tr, lat_tr] = proj4(projString, 'EPSG:4326', [x_origin + (nx - 1) * dx, y_origin]);
658
+ const [lon_bl, lat_bl] = proj4(projString, 'EPSG:4326', [x_origin, y_origin + (ny - 1) * dy]);
659
+ const [lon_br, lat_br] = proj4(projString, 'EPSG:4326', [x_origin + (nx - 1) * dx, y_origin + (ny - 1) * dy]);
660
+ corners = {
661
+ lon_tl,
662
+ lat_tl,
663
+ lon_tr,
664
+ lat_tr,
665
+ lon_bl,
666
+ lat_bl,
667
+ lon_br,
668
+ lat_br
669
+ };
670
+ } else {
671
+ return null;
672
+ }
673
+ return {
674
+ corners,
675
+ gridDef
676
+ };
677
+ }
678
+ _getTargetUnit(defaultUnit, system) {
679
+ if (system === 'metric') {
680
+ if (['°F', '°C', 'fahrenheit', 'celsius'].includes(defaultUnit)) return '°C';
681
+ if (['kts', 'mph', 'm/s'].includes(defaultUnit)) return 'km/h';
682
+ if (['in', 'mm', 'cm'].includes(defaultUnit)) return 'mm';
683
+ }
684
+ if (system === 'imperial') {
685
+ if (['°F', '°C', 'fahrenheit', 'celsius'].includes(defaultUnit)) return '°F';
686
+ if (['kts', 'mph', 'm/s'].includes(defaultUnit)) return 'mph';
687
+ if (['in', 'mm', 'cm'].includes(defaultUnit)) return 'in';
688
+ }
689
+ return defaultUnit;
690
+ }
691
+ _getGridIndexFromLngLat(lng, lat) {
692
+ const gridModel = this.state.isMRMS ? 'mrms' : this.state.model;
693
+ const normalizedGridModel = this._normalizeModelName(gridModel);
694
+ const gridDef = COORDINATE_CONFIGS[normalizedGridModel];
695
+ if (!gridDef) return null;
696
+ const {
697
+ nx,
698
+ ny
699
+ } = gridDef.grid_params;
700
+ const pixelCoords = this.latLonToGridPixel(lat, lng, gridDef, gridModel);
701
+ if (!pixelCoords || !isFinite(pixelCoords.x) || !isFinite(pixelCoords.y) || pixelCoords.x < 0 || pixelCoords.y < 0) return null;
702
+ const i = Math.round(pixelCoords.x);
703
+ const j = Math.round(pixelCoords.y);
704
+ if (i >= 0 && i < nx && j >= 0 && j < ny) return {
705
+ i,
706
+ j
707
+ };
708
+ return null;
709
+ }
710
+ latLonToProjected(lat, lon, gridDef) {
711
+ if (!isFinite(lat) || !isFinite(lon)) throw new Error(`Invalid coordinates: lat=${lat}, lon=${lon}`);
712
+ const gridType = gridDef.type;
713
+ if (gridType === 'latlon') return {
714
+ x: lon,
715
+ y: lat
716
+ };
717
+ let projString = Object.entries(gridDef.proj_params).map(([k, v]) => `+${k}=${v}`).join(' ');
718
+ if (gridType === 'polar_stereographic') projString += ' +lat_0=90';
719
+ const projected = proj4('EPSG:4326', projString, [lon, lat]);
720
+ return {
721
+ x: projected[0],
722
+ y: projected[1]
723
+ };
724
+ }
725
+ latLonToGridPixel(lat, lon, gridDef, modelName) {
726
+ if (!gridDef) return null;
727
+ if (modelName === 'rgem' && gridDef.type === 'polar_stereographic') return this.latLonToGridPixelPolarStereographic(lat, lon, gridDef);
728
+ const projected = this.latLonToProjected(lat, lon, gridDef);
729
+ let x, y;
730
+ const gridOrigin = {
731
+ x: gridDef.grid_params.lon_first,
732
+ y: gridDef.grid_params.lat_first
733
+ };
734
+ const gridPixelSize = {
735
+ x: gridDef.grid_params.dx_degrees,
736
+ y: gridDef.grid_params.dy_degrees
737
+ };
738
+ if (gridDef.type === 'latlon' || gridDef.type === 'rotated_latlon') {
739
+ let adjustedLon = projected.x;
740
+ if (modelName === 'mrms') {
741
+ if (adjustedLon < 0) adjustedLon += 360;
742
+ x = (adjustedLon - gridOrigin.x) / gridPixelSize.x;
743
+ y = (gridOrigin.y - projected.y) / gridPixelSize.y;
744
+ } else {
745
+ const isGFSType = gridDef.grid_params && gridDef.grid_params.lon_first === 0.0 && Math.abs(gridDef.grid_params.lat_first) === 90.0;
746
+ const isECMWFType = gridDef.grid_params && gridDef.grid_params.lon_first === 180.0 && gridDef.grid_params.lat_first === 90.0;
747
+ const isGEMType = modelName === 'gem' || gridDef.grid_params.lon_first === 180.0 && gridDef.grid_params.lat_first === -90.0 && gridDef.grid_params.lon_last === 179.85;
748
+ if (isGEMType) {
749
+ while (adjustedLon < gridOrigin.x) adjustedLon += 360;
750
+ x = (adjustedLon - gridOrigin.x) / gridPixelSize.x;
751
+ y = (projected.y - gridOrigin.y) / gridPixelSize.y;
752
+ return {
753
+ x,
754
+ y
755
+ };
756
+ }
757
+ let isFlippedGrid = isECMWFType ? true : gridDef.grid_params.lat_first < (gridDef.grid_params.lat_last || (gridDef.grid_params.ny - 1) * gridDef.grid_params.dy_degrees);
758
+ if (isGFSType) adjustedLon = projected.x + 180;else if (isECMWFType) {
759
+ if (adjustedLon < gridOrigin.x) adjustedLon += 360;
760
+ } else if (['arome1', 'arome25', 'arpegeeu', 'iconeu', 'icond2'].includes(modelName)) {
761
+ while (adjustedLon < 0) adjustedLon += 360;
762
+ while (adjustedLon >= 360) adjustedLon -= 360;
763
+ x = adjustedLon >= gridOrigin.x ? (adjustedLon - gridOrigin.x) / gridPixelSize.x : (adjustedLon + 360 - gridOrigin.x) / gridPixelSize.x;
764
+ if (['arome1', 'arome25', 'arpegeeu'].includes(modelName)) y = (gridOrigin.y - projected.y) / Math.abs(gridPixelSize.y);else if (['iconeu', 'icond2'].includes(modelName)) y = (projected.y - gridOrigin.y) / gridPixelSize.y;
765
+ return {
766
+ x,
767
+ y
768
+ };
769
+ } else {
770
+ const lonFirst = gridOrigin.x;
771
+ if (lonFirst > 180 && adjustedLon < 0) adjustedLon += 360;else if (lonFirst < 0 && adjustedLon > 180) adjustedLon -= 360;
772
+ }
773
+ x = (adjustedLon - gridOrigin.x) / gridPixelSize.x;
774
+ if (isFlippedGrid) {
775
+ if (isECMWFType) y = (gridOrigin.y - projected.y) / Math.abs(gridPixelSize.y);else {
776
+ const maxLat = gridDef.grid_params.lat_last || (gridDef.grid_params.ny - 1) * gridDef.grid_params.dy_degrees;
777
+ y = (maxLat - projected.y) / Math.abs(gridPixelSize.y);
778
+ }
779
+ } else y = (projected.y - gridOrigin.y) / gridPixelSize.y;
780
+ }
781
+ } else {
782
+ const projOrigin = {
783
+ x: gridDef.grid_params.x_origin,
784
+ y: gridDef.grid_params.y_origin
785
+ };
786
+ const projPixelSize = {
787
+ x: gridDef.grid_params.dx,
788
+ y: gridDef.grid_params.dy
789
+ };
790
+ x = (projected.x - projOrigin.x) / projPixelSize.x;
791
+ y = (projOrigin.y - projected.y) / Math.abs(projPixelSize.y);
792
+ }
793
+ return {
794
+ x,
795
+ y
796
+ };
797
+ }
798
+ latLonToGridPixelPolarStereographic(lat, lon, gridDef) {
799
+ try {
800
+ const projParams = gridDef.proj_params;
801
+ let projectionString = `+proj=${projParams.proj}`;
802
+ Object.keys(projParams).forEach(key => {
803
+ if (key !== 'proj') projectionString += ` +${key}=${projParams[key]}`;
804
+ });
805
+ projectionString += ' +lat_0=90 +no_defs';
806
+ const {
807
+ nx,
808
+ ny,
809
+ dx,
810
+ dy,
811
+ x_origin,
812
+ y_origin
813
+ } = gridDef.grid_params;
814
+ const x_min = x_origin;
815
+ const x_max = x_origin + (nx - 1) * dx;
816
+ const y_max = y_origin;
817
+ const y_min = y_origin + (ny - 1) * dy;
818
+ const [proj_x, proj_y] = proj4('EPSG:4326', projectionString, [lon, lat]);
819
+ if (!isFinite(proj_x) || !isFinite(proj_y)) return {
820
+ x: -1,
821
+ y: -1
822
+ };
823
+ const t_x = (proj_x - x_min) / (x_max - x_min);
824
+ const t_y = (proj_y - y_max) / (y_min - y_max);
825
+ const x = t_x * (nx - 1);
826
+ const y = t_y * (ny - 1);
827
+ return {
828
+ x,
829
+ y
830
+ };
831
+ } catch (error) {
832
+ console.warn(`[GridAccessor] RGEM polar stereographic conversion failed for ${lat}, ${lon}:`, error);
833
+ return {
834
+ x: -1,
835
+ y: -1
836
+ };
837
+ }
838
+ }
839
+
840
+ // --- Worker and Status Methods ---
841
+
842
+ createWorker() {
843
+ if (this.isReactNative) return null;
844
+ const workerCode = `
845
+ import { decompress } from 'https://cdn.skypack.dev/fzstd@0.1.1';
846
+
847
+ function _reconstructData(decompressedDeltas, encoding) {
848
+ const expectedLength = encoding.length;
849
+ const reconstructedData = new Int8Array(expectedLength);
850
+ if (decompressedDeltas.length > 0 && expectedLength > 0) {
851
+ reconstructedData[0] = decompressedDeltas[0] > 127 ? decompressedDeltas[0] - 256 : decompressedDeltas[0];
852
+ for (let i = 1; i < expectedLength; i++) {
853
+ const delta = decompressedDeltas[i] > 127 ? decompressedDeltas[i] - 256 : decompressedDeltas[i];
854
+ reconstructedData[i] = reconstructedData[i - 1] + delta;
855
+ }
856
+ }
857
+ return new Uint8Array(reconstructedData.buffer);
858
+ }
859
+
860
+ self.onmessage = async (e) => {
861
+ const { requestId, compressedData, encoding } = e.data;
862
+ try {
863
+ const decompressedDeltas = await decompress(compressedData);
864
+ const finalData = _reconstructData(decompressedDeltas, encoding);
865
+ self.postMessage({ success: true, requestId: requestId, decompressedData: finalData, encoding: encoding }, [finalData.buffer]);
866
+ } catch (error) {
867
+ self.postMessage({ success: false, requestId: requestId, error: error.message });
868
+ }
869
+ };
870
+ `;
871
+ const blob = new Blob([workerCode], {
872
+ type: 'application/javascript'
873
+ });
874
+ return new Worker(URL.createObjectURL(blob), {
875
+ type: 'module'
876
+ });
877
+ }
878
+ _processResultQueue() {
879
+ while (this.resultQueue.length > 0) {
880
+ const {
881
+ success,
882
+ requestId,
883
+ decompressedData,
884
+ encoding,
885
+ error
886
+ } = this.resultQueue.shift();
887
+ if (this.workerResolvers.has(requestId)) {
888
+ const {
889
+ resolve,
890
+ reject
891
+ } = this.workerResolvers.get(requestId);
892
+ if (success) {
893
+ resolve({
894
+ data: decompressedData
895
+ }); // Return as { data: ... }
896
+ } else {
897
+ reject(new Error(error));
898
+ }
899
+ this.workerResolvers.delete(requestId);
900
+ }
901
+ }
902
+ this.isProcessingQueue = false;
903
+ }
904
+ _handleWorkerMessage(e) {
905
+ if (this.isReactNative) return;
906
+ const {
907
+ success,
908
+ requestId,
909
+ decompressedData,
910
+ encoding,
911
+ error
912
+ } = e.data;
913
+ this.resultQueue.push({
914
+ success,
915
+ requestId,
916
+ decompressedData,
917
+ encoding,
918
+ error
919
+ });
920
+ if (!this.isProcessingQueue) {
921
+ this.isProcessingQueue = true;
922
+ requestAnimationFrame(() => this._processResultQueue());
923
+ }
924
+ }
925
+ async fetchModelStatus(force = false) {
926
+ if (!this.modelStatus || force) {
927
+ try {
928
+ const response = await fetch(this.statusUrl);
929
+ if (!response.ok) throw new Error(`HTTP error! Status: ${response.status}`);
930
+ this.modelStatus = (await response.json()).models;
931
+ } catch (error) {
932
+ this.modelStatus = null;
933
+ }
934
+ }
935
+ return this.modelStatus;
936
+ }
937
+ async fetchMRMSStatus(force = false) {
938
+ const mrmsStatusUrl = 'https://h3dfvh5pq6euq36ymlpz4zqiha0obqju.lambda-url.us-east-2.on.aws';
939
+ if (!this.mrmsStatus || force) {
940
+ try {
941
+ const response = await fetch(mrmsStatusUrl);
942
+ if (!response.ok) throw new Error(`HTTP error! Status: ${response.status}`);
943
+ this.mrmsStatus = await response.json();
944
+ } catch (error) {
945
+ this.mrmsStatus = null;
946
+ }
947
+ }
948
+ return this.mrmsStatus;
949
+ }
950
+ startAutoRefresh(intervalSeconds) {
951
+ this.stopAutoRefresh();
952
+ this.autoRefreshIntervalId = setInterval(async () => {
953
+ await this.fetchModelStatus(true);
954
+ this._emitStateChange();
955
+ }, (intervalSeconds || 60) * 1000);
956
+ }
957
+ stopAutoRefresh() {
958
+ if (this.autoRefreshIntervalId) {
959
+ clearInterval(this.autoRefreshIntervalId);
960
+ this.autoRefreshIntervalId = null;
961
+ }
962
+ }
963
+ }
964
+ //# sourceMappingURL=AguaceroCore.js.map