Compare commits

..
2 Commits
Author SHA1 Message Date
Matt Walsh 73a545c271 rho/cc work in progress 2026-08-20 23:33:28 -05:00
Matt Walsh 61550bf47c brighter ref palette 2026-08-20 22:53:01 -05:00
6 changed files with 113 additions and 59 deletions

No files matched your search

Binary file not shown.
+5 -4
View File
@@ -11,11 +11,11 @@ import { plot, writePngToFile } from '../src/index.mjs';
// const files = glob.sync('./data/KLOT/34/*');
// const files = glob.sync('./data/KLOT/381/*');
// const files = glob.sync('./data/KLOT/548/*');
const files = await glob.sync('./data/KLOT/940/*');
// const files = await glob.sync('./data/KLOT/940/*');
// const files = glob.sync('./data/KSRX/804/*');
// const files = glob.sync('./data/TORD/168/*');
// const files = glob.sync('./data/KLOT/KLOT20210812_171451_V*'); // ref palette tuning
// const files = glob.sync('./data/KLOT/KLOT20210621_041151_V06'); // vel palette tuning
const files = glob.sync('./data/KLOT/KLOT20210621_041151_V06'); // vel palette tuning
// const store each file's data
const chunks = [];
@@ -33,7 +33,7 @@ const radarData = Level2Radar.combineData(chunks);
// default to all plots unless single is specificed
const single = process.argv.includes('single');
let sizes = [1800];
let sizes = [3200];
let elevations = radarData.listElevations();
if (single) {
sizes = sizes.slice(0, 1);
@@ -46,7 +46,7 @@ if (single) {
// plot for each elevation and size
console.time('processing');
await Promise.allSettled(sizes.map(async (size) => {
const plots = plot(radarData, ['REF', 'VEL'], {
const plots = plot(radarData, ['REF', 'VEL', 'RHO'], {
elevations,
size,
palettize: true,
@@ -61,6 +61,7 @@ await Promise.allSettled(sizes.map(async (size) => {
const { elevation } = p;
writePromises.push(writePngToFile(`./output/REF-${elevation}-${size}.png`, p.REF));
writePromises.push(writePngToFile(`./output/VEL-${elevation}-${size}.png`, p.VEL));
writePromises.push(writePngToFile(`./output/RHO-${elevation}-${size}.png`, p.RHO));
});
await Promise.allSettled(writePromises);
}));
+21 -29
View File
@@ -10,7 +10,7 @@
"license": "MIT",
"dependencies": {
"canvas": "^3.0.0",
"nexrad-level-2-data": "^3.0.0"
"nexrad-level-2-data": "^3.0.2"
},
"devDependencies": {
"@eslint/compat": "^2.1.0",
@@ -23,29 +23,6 @@
"node": ">=24.0.0"
}
},
"../nexrad-level-2-data": {
"version": "3.0.0",
"license": "MIT",
"dependencies": {
"@foxglove/wasm-bz2": "^0.3.0"
},
"devDependencies": {
"@eslint/compat": "^2.1.0",
"@eslint/js": "^9.39.5",
"del": "^8.0.0",
"eslint": "^9.39.5",
"eslint-config-airbnb-extended": "^3.1.1",
"eslint-plugin-jsdoc": "^63.3.1",
"glob": "^13.0.6",
"gulp": "^5.0.0",
"gulp-jsdoc3": "^3.0.0",
"jsdoc": "^4.0.3",
"jsdoc-to-markdown": "^9.1.1"
},
"engines": {
"node": ">=24.0.0"
}
},
"node_modules/@babel/code-frame": {
"version": "7.29.7",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",
@@ -511,6 +488,15 @@
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@foxglove/wasm-bz2": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@foxglove/wasm-bz2/-/wasm-bz2-0.3.0.tgz",
"integrity": "sha512-MP18X3TbeoGT3Kfke7KrYin+5zESfcPnsdD2gaVviN1xzteoDDfVTZbVmbdfGrIV/qAAhBhBVbRcrN25rWSNOQ==",
"license": "MIT",
"dependencies": {
"tslib": "^2"
}
},
"node_modules/@humanfs/core": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",
@@ -4511,8 +4497,16 @@
"license": "MIT"
},
"node_modules/nexrad-level-2-data": {
"resolved": "../nexrad-level-2-data",
"link": true
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/nexrad-level-2-data/-/nexrad-level-2-data-3.0.2.tgz",
"integrity": "sha512-VEfPl0NsOEFZAb+X6/yojdfq0g+QGNQQrzXBuP9HZIKwUhFY7Ro/POTFqZ/vRVfb7B1Bce/lzQqORbGim+MHMw==",
"license": "MIT",
"dependencies": {
"@foxglove/wasm-bz2": "^0.3.0"
},
"engines": {
"node": ">=24.0.0"
}
},
"node_modules/node-abi": {
"version": "3.94.0",
@@ -5718,9 +5712,7 @@
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"dev": true,
"license": "0BSD",
"optional": true
"license": "0BSD"
},
"node_modules/tunnel-agent": {
"version": "0.6.0",
+4 -1
View File
@@ -12,6 +12,7 @@ import rrle from './preprocess/rrle.mjs';
import * as ref from './palettes/ref.mjs';
import * as vel from './palettes/vel.mjs';
import * as rho from './palettes/rho.mjs';
const { createCanvas } = canvasObj;
@@ -22,13 +23,14 @@ const dataNames = {
'SW ': 'spectrum', // intentional space to fill 3-character requirement
ZDR: 'zdr',
PHI: 'phi',
RHO: 'rho',
RHO: 'rho', // correlation coefficient
};
// names of data retrieval routines keyed to product name
const dataFunctions = {
REF: 'getHighresReflectivity',
VEL: 'getHighresVelocity',
RHO: 'getHighresCorrelation',
};
// generate all palettes
@@ -36,6 +38,7 @@ const dataFunctions = {
const palettes = {
REF: new Palette(ref),
VEL: new Palette(vel),
RHO: new Palette(rho),
};
const preferredWaveformUsage = {
+57
View File
@@ -0,0 +1,57 @@
const palette = [
255, 255, 255, 0, // transparent
0, 0, 0, 255,
22, 22, 23, 255,
45, 45, 47, 255,
68, 67, 71, 255,
91, 90, 95, 255,
111, 111, 117, 255,
134, 133, 140, 255,
140, 139, 154, 255,
117, 115, 152, 255,
93, 92, 149, 255,
68, 66, 145, 255,
45, 43, 142, 255,
22, 20, 140, 255,
17, 13, 168, 255,
12, 6, 196, 255,
34, 28, 216, 255,
128, 126, 214, 255,
107, 215, 130, 255,
110, 235, 54, 255,
146, 206, 1, 255,
231, 198, 0, 255,
236, 14, 0, 255,
186, 64, 129, 255,
255, 255, 255, 255,
];
const maxDbzIndex = 24; // index of maximum dbz
const limits = [
0.2000, 0.2370, 0.2739, 0.3109, 0.3478, 0.3848, 0.4217, 0.4587,
0.4957, 0.5326, 0.5696, 0.6065, 0.6435, 0.6804, 0.7174, 0.7543,
0.7913, 0.8283, 0.8652, 0.9022, 0.9391, 0.9761, 1.0130, 1.0500,
];
const transparentIndex = 0;
// min is the most interesting when looking at rho/cc
const downSample = (cur, prev) => {
// no value provided, use previous
if (cur === null) return prev;
// previous value is null (first run), return current value
// this is how the typical "find the highest" gets reversed
if (prev === null) return cur;
// return the min if we have to real values
return Math.min(cur, prev);
};
export {
palette,
maxDbzIndex,
limits,
transparentIndex,
downSample,
};
+26 -25
View File
@@ -1,33 +1,34 @@
const palette = [
// 0: green/outbound
0, 255, 0, 255,
0, 240, 0, 255,
0, 223, 0, 255,
0, 206, 0, 255,
0, 189, 0, 255,
0, 172, 0, 255,
0, 155, 0, 255,
0, 138, 0, 255,
16, 121, 16, 255,
32, 113, 32, 255,
48, 104, 48, 255,
215, 255, 225, 255,
179, 243, 188, 255,
143, 230, 150, 255,
108, 218, 113, 255,
72, 205, 75, 255,
36, 193, 38, 255,
0, 180, 0, 255,
10, 168, 10, 255,
20, 157, 20, 255,
30, 145, 30, 255,
40, 133, 40, 255,
// 11: nearly zero
64, 95, 64, 255,
95, 64, 64, 255,
50, 122, 50, 255,
128, 50, 50, 255,
// 13: red/inbound
104, 32, 32, 255,
113, 16, 16, 255,
121, 0, 0, 255,
138, 0, 0, 255,
155, 0, 0, 255,
172, 0, 0, 255,
189, 0, 0, 255,
206, 0, 0, 255,
223, 0, 0, 255,
240, 0, 0, 255,
255, 0, 0, 255,
147, 40, 40, 255,
165, 30, 30, 255,
183, 20, 20, 255,
202, 10, 10, 255,
220, 0, 0, 255,
226, 36, 38, 255,
232, 72, 75, 255,
238, 108, 113, 255,
243, 143, 150, 255,
249, 179, 188, 255,
255, 215, 225, 255,
// 24: transparent
255, 255, 255, 0,
@@ -42,7 +43,7 @@ const downSample = (cur, prev) => {
};
const limits = [-99, -90, -80, -70, -60, -50, -40, -30, -20, -15, -10, -5, 0, 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 99,
];
].map((limit) => limit * (50 / 99));
const downSampleReset = null;