Compare commits

..
4 Commits
Author SHA1 Message Date
Matt Walsh 8cea4fb15d 1.1.2 2022-01-30 16:55:57 -06:00
Matt Walsh 9b4295e872 correct nexrad-level-2-data dependency 2022-01-30 16:55:48 -06:00
Matt Walsh 483f73547b 1.1.1 2022-01-26 16:23:47 -06:00
Matt Walsh 68ab79161b remove internal console.log 2022-01-26 16:23:39 -06:00
3 changed files with 411 additions and 978 deletions

No files matched your search

+406 -971
View File
File diff suppressed because it is too large. Load diff
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "nexrad-level-2-plot",
"version": "1.1.0",
"version": "1.1.2",
"description": "Plotting library for nexrad-level-2-data",
"main": "src/index.js",
"scripts": {
@@ -25,11 +25,11 @@
"homepage": "https://github.com/netbymatt/nexrad-level-2-plot#readme",
"dependencies": {
"canvas": "^2.8.0",
"nexrad-level-2-data": "file:../nexrad-level-2-data"
"nexrad-level-2-data": "^2.1.0"
},
"devDependencies": {
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint": "^8.0.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.23.4",
"glob": "^7.1.7"
},
+1 -3
View File
@@ -6,7 +6,6 @@ const palettizeImage = (sourceCtx, palette) => {
x: sourceCtx.canvas.width,
y: sourceCtx.canvas.height,
};
console.time('Palettize image');
// transform into indexed palette by finding the closest indexed color for each pixel
// create a destination image that is transparent and indexed
@@ -19,11 +18,10 @@ const palettizeImage = (sourceCtx, palette) => {
const indexedImageData = indexedCtx.getImageData(0, 0, dim.x, dim.y);
// loop through each pixel
console.log(`Palettized cache size: ${Object.keys(palette.closest).length}`);
indexedImageData.data.forEach((val, idx) => {
indexedImageData.data[idx] = palette.closestIndex(sourceImageData.data.slice(idx * 4, idx * 4 + 3));
});
console.timeEnd('Palettize image');
// write the new image data
indexedCtx.putImageData(indexedImageData, 0, 0);