add test-all

This commit is contained in:
Matt Walsh committed 2021-04-27 16:25:38 -05:00
1 parent 2cdb439130
commit cbca39ffe3
3 files changed
+51 -5

No files matched your search

+21 -4
View File
@@ -1,11 +1,28 @@
# nexrad-level-3-plot
### v0.1.0
A javascript implementation for plotting Nexrad Level III data parsed via [nexrad-level-3-data](https://github.com/netbymatt/nexrad-level-3-data/).
> A javascript implementation for plotting Nexrad Level III data parsed via [nexrad-level-3-data](https://github.com/netbymatt/nexrad-level-3-data/).
## Acknowledgements
# Work in Progress
This package is currently incomplete. It will plot raster data created by the package mentioned above but there are several limitations that will be addressed in future releases.
- Color scales do not dynamically change when needed such as with total precipitation products.
- The size of the output image is hard coded to 1800x1800
- Background color/transparency is hard coded
- Only some products are [supported](#supported-products)
## Supported Products
|ID|Code|Description|
|---|---|---|
78|N1P|One-hour precipitation
80|NTP|Storm total precipitation
170|DAA|Digital One Hour Accumulation
172|DTA|Digital Total Accumulation
# Demos
Test code and data is provided in the `./demo` folder. `test.js` can be used to test any one of the products by commenting/uncommenting the appropriate line in the file. All images will be output as PNG to `./output`. A `test-all.js` is also provided to plot all of the products provided in the `./data/` folder.
# Acknowledgements
The code for this project is based upon:
- [nexrad-level-3-data](https://github.com/netbymatt/nexrad-level-3-data/)
- [Unidata](https://github.com/Unidata/thredds/blob/master/cdm/src/main/java/ucar/nc2/iosp/nexrad2/)
- [nexrad-radar-data](https://github.com/bartholomew91/nexrad-radar-data)
- And my own fork of the above [netbymatt/nexrad-radar-data](https://github.com/netbymatt/nexrad-radar-data)
- And my own fork of the above [netbymatt/nexrad-level-2-data](https://github.com/netbymatt/nexrad-level-2-data)
+22
View File
@@ -0,0 +1,22 @@
const fs = require('fs');
const { plot } = require('../src');
const { writePngToFile } = require('../src/utils/file');
// get a list of all data files
const files = fs.readdirSync('./data/');
// plot each file
(async () => {
await Promise.allSettled(files.map(async (file) => {
console.log(file);
try {
const rawFile = fs.readFileSync(`./data/${file}`);
const level3Plot = plot(rawFile);
console.log(level3Plot);
// write to disk
await writePngToFile(`./output/${file}.png`, level3Plot);
} catch (e) {
console.error(e.message);
}
}));
})();
+8 -1
View File
@@ -3,5 +3,12 @@
{
"path": "."
}
]
],
"settings": {
"files.exclude": {
"**/node_modules/": true,
"demos/output/**/*": true,
"demos/output/**/.gitignore": false
}
}
}