@aguacerowx/javascript-sdk 0.0.6 → 0.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aguacerowx/javascript-sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -160,7 +160,6 @@ export class AguaceroCore extends EventEmitter {
160
160
 
161
161
  play() {
162
162
  if (this.isPlaying) return;
163
- console.log('▶️ [Core] Play called');
164
163
  this.isPlaying = true;
165
164
  clearInterval(this.playIntervalId);
166
165
  this.playIntervalId = setInterval(() => { this.step(1); }, this.playbackSpeed);
@@ -170,7 +169,6 @@ export class AguaceroCore extends EventEmitter {
170
169
 
171
170
  pause() {
172
171
  if (!this.isPlaying) return;
173
- console.log('⏸️ [Core] Pause called');
174
172
  this.isPlaying = false;
175
173
  clearInterval(this.playIntervalId);
176
174
  this.playIntervalId = null;
@@ -179,13 +177,10 @@ export class AguaceroCore extends EventEmitter {
179
177
  }
180
178
 
181
179
  togglePlay() {
182
- console.log('⏯️ [Core] Toggle Play called');
183
180
  this.isPlaying ? this.pause() : this.play();
184
181
  }
185
182
 
186
183
  step(direction = 1) {
187
- console.log(`[Core.step] Stepping... Direction: ${direction}, Mode: ${this.state.isMRMS ? 'MRMS' : 'Model'}`);
188
-
189
184
  // --- THIS IS THE CORRECTED MRMS LOGIC ---
190
185
  if (this.state.isMRMS) {
191
186
  const { variable, mrmsTimestamp } = this.state;
@@ -200,7 +195,6 @@ export class AguaceroCore extends EventEmitter {
200
195
  if (availableTimestamps.length === 0) return;
201
196
 
202
197
  const currentIndex = availableTimestamps.indexOf(mrmsTimestamp);
203
- console.log(`[Core.step] MRMS Current Timestamp: ${mrmsTimestamp}, Index: ${currentIndex}`);
204
198
 
205
199
  if (currentIndex === -1) {
206
200
  // If not found, reset to the first (newest) frame
@@ -216,7 +210,6 @@ export class AguaceroCore extends EventEmitter {
216
210
  if (nextIndex < 0) nextIndex = maxIndex;
217
211
 
218
212
  const newTimestamp = availableTimestamps[nextIndex];
219
- console.log(`[Core.step] MRMS New Index: ${nextIndex}, New Timestamp: ${newTimestamp}`);
220
213
  this.setState({ mrmsTimestamp: newTimestamp });
221
214
 
222
215
  } else {
@@ -225,7 +218,6 @@ export class AguaceroCore extends EventEmitter {
225
218
  if (!forecastHours || forecastHours.length === 0) return;
226
219
 
227
220
  const currentIndex = forecastHours.indexOf(forecastHour);
228
- console.log(`[Core.step] Model Current Hour: ${forecastHour}, Index: ${currentIndex}`);
229
221
  if (currentIndex === -1) return;
230
222
 
231
223
  const maxIndex = forecastHours.length - 1;
@@ -234,7 +226,6 @@ export class AguaceroCore extends EventEmitter {
234
226
  if (nextIndex < 0) nextIndex = maxIndex;
235
227
 
236
228
  const newHour = forecastHours[nextIndex];
237
- console.log(`[Core.step] Model New Index: ${nextIndex}, New Hour: ${newHour}`);
238
229
  this.setState({ forecastHour: newHour });
239
230
  }
240
231
  }
@@ -561,26 +552,29 @@ export class AguaceroCore extends EventEmitter {
561
552
 
562
553
  _getColormapForVariable(variable) {
563
554
  if (!variable) return { colormap: [], baseUnit: '' };
555
+
564
556
  if (this.customColormaps[variable] && this.customColormaps[variable].colormap) {
565
557
  return {
566
558
  colormap: this.customColormaps[variable].colormap,
567
- baseUnit: this.customColormaps[variable].baseUnit || ''
559
+ baseUnit: this.customColormaps[variable].defaultUnit || ''
568
560
  };
569
561
  }
562
+
570
563
  const colormapKey = DICTIONARIES.variable_cmap[variable] || variable;
571
564
  const customColormap = this.customColormaps[colormapKey];
572
565
  if (customColormap && customColormap.colormap) {
573
- return { colormap: customColormap.colormap, baseUnit: customColormap.baseUnit || '' };
566
+ return { colormap: customColormap.colormap, baseUnit: customColormap.defaultUnit || '' };
574
567
  }
568
+
575
569
  const defaultColormapData = DEFAULT_COLORMAPS[colormapKey];
576
570
  if (defaultColormapData && defaultColormapData.units) {
577
- const availableUnits = Object.keys(defaultColormapData.units);
578
- if (availableUnits.length > 0) {
579
- const baseUnit = availableUnits[0];
580
- const unitData = defaultColormapData.units[baseUnit];
581
- if (unitData && unitData.colormap) {
582
- return { colormap: unitData.colormap, baseUnit: baseUnit };
583
- }
571
+ // Get defaultUnit from the field dictionary
572
+ const fieldInfo = DICTIONARIES.fld[variable] || {};
573
+ const baseUnit = fieldInfo.defaultUnit || Object.keys(defaultColormapData.units)[0];
574
+
575
+ const unitData = defaultColormapData.units[baseUnit];
576
+ if (unitData && unitData.colormap) {
577
+ return { colormap: unitData.colormap, baseUnit: baseUnit };
584
578
  }
585
579
  }
586
580
  return { colormap: [], baseUnit: '' };
@@ -2114,7 +2114,7 @@ export const DEFAULT_COLORMAPS = {
2114
2114
  0.01,0.1,0.25,0.5,0.75,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,7,8,9,10
2115
2115
  ]
2116
2116
  },
2117
- "cm": {
2117
+ "cm [QPF]": {
2118
2118
  "colormap": [
2119
2119
  0.03, "#eeccff",
2120
2120
  .25, "#ff9999",
@@ -2129,7 +2129,7 @@ export const DEFAULT_COLORMAPS = {
2129
2129
  3.75,4,4.5,5,5.5,6,7,8,9,10,12,14,16,18,20,22,24,26
2130
2130
  ]
2131
2131
  },
2132
- "mm": {
2132
+ "mm [QPF]": {
2133
2133
  "colormap": [
2134
2134
  0.3, "#eeccff",
2135
2135
  2.5, "#ff9999",
@@ -2166,7 +2166,7 @@ export const DEFAULT_COLORMAPS = {
2166
2166
  0.01,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.25,1.5,1.75,2,2.5,3
2167
2167
  ]
2168
2168
  },
2169
- "cm": {
2169
+ "cm [QPF]": {
2170
2170
  "colormap": [
2171
2171
  0.03, "#eeccff",
2172
2172
  .25, "#ff9999",
@@ -2181,7 +2181,7 @@ export const DEFAULT_COLORMAPS = {
2181
2181
  5.5,6,7,8,9,10,12,14,16
2182
2182
  ]
2183
2183
  },
2184
- "mm": {
2184
+ "mm [QPF]": {
2185
2185
  "colormap": [
2186
2186
  0.3, "#eeccff",
2187
2187
  2.5, "#ff9999",
@@ -278,7 +278,7 @@ export const MODEL_CONFIGS = {
278
278
  },
279
279
  'gfs': {
280
280
  max_zoom: 3,
281
- vars: ['tp_0_total', '2r_2', '2t_2', 'refd_1000', 'vis_0', 'gust_runmax', "gh_tendency_500", 'bulk_shear_speedmb_500', 'bulk_shear_speedmb_700', 'bulk_shear_speedmb_850', 'bulk_shear_speedmb_925','2t_2iso0', 'crain_total', 'crain_3', 'crain_6', 'crain_12', 'crain_24', 'crain_48', 'cicep_total', 'cicep_3', 'cicep_6', 'cicep_12', 'cicep_24', 'cicep_48', 'cfrzr_total', 'cfrzr_3', 'cfrzr_6', 'cfrzr_12', 'cfrzr_24', 'cfrzr_48', 'csnow_total', 'csnow_3', 'csnow_6', 'csnow_12', 'csnow_24', 'csnow_48', 'tp_3', 'tp_6', 'tp_12', 'tp_24', 'tp_48', 'cin_0', 'wind_speed_700', 'wind_speed_200', 'divergence_200', 'd_925', 'tadv_300', 'w_850', 'rainRefl', 'icepRefl', 'snowRefl', 'frzrRefl', 'lftx_0', 'refc_0', 'fgen_850', 'hcc_0', 'r_700', 't_850', 't_850iso0', 'r_850', 'tcc_0', 'hlcy_3000', 'thickness', 'vo_850', 'wind_direction_2000', 'r_500', 'gh_500', 'wind_speed_500', '2d_2', 'cape_25500', 'mcc_0', 'w_500', 'pwat_0', 'divergence_850', 't_500', 'wind_speed_850', 'lcl', 'cape_0', 'tadv_850', 'tadv_700', 'theta2PVU', 'wind_speed_2000', 'lapse_rates_500700', 'vo_500', 'irsat', 't_700', 't_700iso0', 'cin_25500', 'ehi_3000', 'lcc_0', 'gh_850', 'wind_speed_925', 'gh_200', 'wind_speed_300', 'fgen_700', 'vo_700', 'd_850', 'thetaE', 'pres2PVU', 'd_700', 'crain', 'csnow', 'cicep', 'cfrzr', 'w_700', 'gust_0', 'ivt', 'atemp', 'cape_9000', 'r_925', 'mslma_0', 'w_925', 'cin_9000', 'mean700300mbRH', 'wind_speed_10', 't_925', 't_925iso0', 'gh_925', 'gh_700', 'gh_300'],
281
+ vars: ['cfrzr_total', 'tp_0_total', '2r_2', '2t_2', 'refd_1000', 'vis_0', 'gust_runmax', "gh_tendency_500", 'bulk_shear_speedmb_500', 'bulk_shear_speedmb_700', 'bulk_shear_speedmb_850', 'bulk_shear_speedmb_925','2t_2iso0', 'crain_total', 'crain_3', 'crain_6', 'crain_12', 'crain_24', 'crain_48', 'cicep_total', 'cicep_3', 'cicep_6', 'cicep_12', 'cicep_24', 'cicep_48', 'cfrzr_total', 'cfrzr_3', 'cfrzr_6', 'cfrzr_12', 'cfrzr_24', 'cfrzr_48', 'csnow_total', 'csnow_3', 'csnow_6', 'csnow_12', 'csnow_24', 'csnow_48', 'tp_3', 'tp_6', 'tp_12', 'tp_24', 'tp_48', 'cin_0', 'wind_speed_700', 'wind_speed_200', 'divergence_200', 'd_925', 'tadv_300', 'w_850', 'rainRefl', 'icepRefl', 'snowRefl', 'frzrRefl', 'lftx_0', 'refc_0', 'fgen_850', 'hcc_0', 'r_700', 't_850', 't_850iso0', 'r_850', 'tcc_0', 'hlcy_3000', 'thickness', 'vo_850', 'wind_direction_2000', 'r_500', 'gh_500', 'wind_speed_500', '2d_2', 'cape_25500', 'mcc_0', 'w_500', 'pwat_0', 'divergence_850', 't_500', 'wind_speed_850', 'lcl', 'cape_0', 'tadv_850', 'tadv_700', 'theta2PVU', 'wind_speed_2000', 'lapse_rates_500700', 'vo_500', 'irsat', 't_700', 't_700iso0', 'cin_25500', 'ehi_3000', 'lcc_0', 'gh_850', 'wind_speed_925', 'gh_200', 'wind_speed_300', 'fgen_700', 'vo_700', 'd_850', 'thetaE', 'pres2PVU', 'd_700', 'crain', 'csnow', 'cicep', 'cfrzr', 'w_700', 'gust_0', 'ivt', 'atemp', 'cape_9000', 'r_925', 'mslma_0', 'w_925', 'cin_9000', 'mean700300mbRH', 'wind_speed_10', 't_925', 't_925iso0', 'gh_925', 'gh_700', 'gh_300'],
282
282
  category: 'Global',
283
283
  name: 'GFS',
284
284
  bounds: [-180, -90, 180, 90],