mirror of
https://github.com/netbymatt/nexrad-level-3-data.git
synced 2026-11-28 18:58:04 -08:00
79 lines
2.9 KiB
JavaScript
79 lines
2.9 KiB
JavaScript
/* eslint-disable no-console */
|
|
/* eslint-disable no-unused-vars */
|
|
|
|
import fs from 'node:fs/promises';
|
|
import util from 'node:util';
|
|
import nexradLevel3Data from './src/index.mjs';
|
|
|
|
// read file
|
|
|
|
// 56 N0S Storm relative velocity
|
|
// const file = await fs.readFile('./data/LOT_N0S_2021_01_31_11_06_30');
|
|
|
|
// 58 NTP Storm Tracking Information
|
|
// const file = await fs.readFile('./data/JAX_NST_2021_04_11_19_37_00');
|
|
// const file = await fs.readFile('./data/TBW_NST_2021_04_19_19_02');
|
|
// const file = await fs.readFile('./data/KDGX_NST_2022_01_16_09_31'); // error packet id 0x0019
|
|
|
|
// 59 NHI Hail Index
|
|
// const file = await fs.readFile('./data/DTW_NHI_2021_04_08_19_47');
|
|
// const file = await fs.readFile('./data/TBW_NHI_2021_04_19_19_02');
|
|
|
|
// 61 NTV
|
|
// const file = await fs.readFile('./data/sn.0011');
|
|
// const file = await fs.readFile('./data/sn.0012');
|
|
|
|
// 62 NSS
|
|
const file = await fs.readFile('./data/TBW_NSS_2021_04_19_19_02');
|
|
// const file = await fs.readFile('./data/KBYX_NSS_2022_01_16_09_31'); // error with block id 4
|
|
// const file = await fs.readFile('./data/KCAE_NSS_2022_01_16_09_31'); // error with block id 5
|
|
// const file = await fs.readFile('./data/KFFC_NSS_2022_01_16_09_31'); // error with block id 7
|
|
// const file = await fs.readFile('./data-error/KLOT_NSS_2022_01_16_09_31'); // error with block id 3
|
|
// const file = await fs.readFile('./data-error/KLTX_NSS_2022_02_15_06_44'); // error with block id 3
|
|
|
|
// 78 One-hour precipitation
|
|
// const file = await fs.readFile('./data/LOT_N1P_2021_01_31_11_06_30');
|
|
|
|
// 80 NTP Storm total accumulation
|
|
// const file = await fs.readFile('./data/LOT_NTP_2021_01_31_11_06_30');
|
|
|
|
// 94 NXQ Digital Base Reflectivy
|
|
// const file = await fs.readFile('./data/SDUS53 KLOT 150709');
|
|
|
|
// 141 NMD Mesocyclone
|
|
// const file = await fs.readFile('./data/LOT_NMD_2021_06_21_04_22_17');
|
|
|
|
// 165 N0H Hydrometeor classification
|
|
// const file = await fs.readFile('./data/LOT_N0H_2021_01_31_11_06_30');
|
|
|
|
// 172 DTA Storm Total Precipitation
|
|
// const file = await fs.readFile('./data/LOT_DTA_2021_02_28_15_05_33');
|
|
// const file = await fs.readFile('./data/LOT_DTA_2021_05_08_03_47_25'); // has error
|
|
// const file = await fs.readFile('./data/LOT_DAA_2021_05_08_03_40_29'); // different radial packet from standard = 1, no radial data
|
|
|
|
// 177 HHC Hybrid Hydrometeor classification
|
|
// const file = await fs.readFile('./data/LOT_HHC_2021_01_31_11_06_30');
|
|
|
|
// custom logger for testing
|
|
const customLogger = {
|
|
log: (message) => {
|
|
console.log('CUSTOM LOG MESSAGE');
|
|
console.log(message);
|
|
},
|
|
error: (message) => {
|
|
console.log('CUSTOM ERROR MESSAGE');
|
|
console.error(message);
|
|
},
|
|
};
|
|
|
|
// pass to parser as a string or buffer
|
|
const level3Data = nexradLevel3Data(file);
|
|
|
|
// try different loggers
|
|
// const level3Data = parser(file, { logger: false });
|
|
// const level3Data = parser(file, { logger: customLogger });
|
|
|
|
// console.log(util.inspect(level3Data, true, 10));
|
|
console.log(level3Data);
|
|
console.log();
|