Compare commits

..
2 Commits
Author SHA1 Message Date
Matt Walsh 847d4cbecc 2.5.0 2022-06-21 11:13:18 -05:00
Matt Walsh 7731d64af6 fix interpertation of 300km flag 2022-06-21 11:13:11 -05:00
4 changed files with 14 additions and 9 deletions

No files matched your search

+3
View File
@@ -114,6 +114,9 @@ data|{canvas[palette]}|Typically the output of [plot()](#plotfile-options).\<pro
# Notable and breaking changes
## v2.5.0 Notable, 300km range now interperted correctly
Prior to this version, if the data had the ```super_res_control.300km``` flag set the resulting image would effectively be "zoomed in by 2x". Upon examing the results of this flag on the plot, reference plots and the ```gate_count``` values it was determined no scaling needed to be performed if this flag was present. Instead, the ```gate_count``` already reflects the additional data the flag indicates. This mainly affects VEL plots and some REF plots at higher elevations, depending on the VCP the radar is using.
## v2.0.0 Breaking, returns an array of objects
Previously, a single elevation would be plotted by the routine. The elevation was selected by ```options.elevation```. ```options.elevation``` has been renamed to ```options.elevations``` and will still take a single integer as an input, but in this configuration an array is still returned. The simplest way to return to the functionality of v1.1.0 is ```plot(data,products,{elevation: <integer>})[0]``` which will return only the first object in the array.
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "nexrad-level-2-plot",
"version": "2.4.0",
"version": "2.5.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "nexrad-level-2-plot",
"version": "2.4.0",
"version": "2.5.0",
"license": "MIT",
"dependencies": {
"canvas": "^2.9.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "nexrad-level-2-plot",
"version": "2.4.0",
"version": "2.5.0",
"description": "Plotting library for nexrad-level-2-data",
"main": "src/index.js",
"scripts": {
+8 -6
View File
@@ -79,10 +79,12 @@ const draw = (data, _options) => {
const realGateSize = rawGateSize !== 0.3 ? rawGateSize : rawGateSize / 2;
const gateSizeScaling = 0.25 / realGateSize;
const longRange = data?.vcp?.record?.elevations?.[options.elevation]?.super_res_control?.super_res?.['300km'];
const rangeDivider = longRange ? 2 : 1;
// calculate crop, adjust if necessary
console.log('');
console.log(`ELEVATION: ${options.product} ${options.elevation}`);
console.log(`Gate size: ${data?.data?.[options.elevation]?.[0]?.record?.reflect?.gate_size}`);
console.log('Super Res:', data?.vcp?.record?.elevations?.[options.elevation]?.super_res_control?.super_res);
console.log(`Gate count: ${data?.data?.[options.elevation]?.[0]?.record?.reflect.gate_count}`);
const cropTo = Math.min(options.size, options.cropTo);
if (options.cropTo < 1) throw new Error('Provide options.cropTo > 0');
@@ -96,7 +98,7 @@ const draw = (data, _options) => {
// canvas settings
ctx.imageSmoothingEnabled = true;
ctx.lineWidth = options.lineWidth * rangeDivider / gateSizeScaling;
ctx.lineWidth = options.lineWidth / gateSizeScaling;
ctx.translate(cropTo / 2, cropTo / 2);
ctx.rotate(-Math.PI / 2);
@@ -150,11 +152,11 @@ const draw = (data, _options) => {
if (bin.count) {
// rrle encoded
ctx.strokeStyle = palette.lookupRgba[bin.value];
ctx.arc(0, 0, (idx + deadZone) * rangeDivider / gateSizeScaling, startAngle, endAngle + resolution * (bin.count - 1));
ctx.arc(0, 0, (idx + deadZone) * gateSizeScaling, startAngle, endAngle + resolution * (bin.count - 1));
} else {
// plain data
ctx.strokeStyle = palette.lookupRgba[bin];
ctx.arc(0, 0, (idx + deadZone) * rangeDivider / gateSizeScaling, startAngle, endAngle);
ctx.arc(0, 0, (idx + deadZone) * gateSizeScaling, startAngle, endAngle);
}
ctx.stroke();
}