diff --git a/src/index.js b/src/index.js index 9c2b2e5..8b7863a 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,12 @@ const { draw, canvas } = require('./draw'); const { writePngToFile } = require('./utils/file'); - +/** + * Plot level 2 data + * @param {Level2Data} data output from the nexrad-level-2-data library + * @param {String[]} _products Options are REF, VEL, SW , ZDR, PHI and RHO + * @param {object} options Plotting options + * @returns Canvas + */ const plot = (data, _products, options) => { // store result const result = {}; diff --git a/src/utils/file.js b/src/utils/file.js index ed5b3ec..b9472ac 100644 --- a/src/utils/file.js +++ b/src/utils/file.js @@ -1,5 +1,11 @@ const fs = require('fs'); // write a canvas to a Png file +/** + * Write a Canvas to the specified file + * @param {string} fileName Path to write output to, passed to fs.createWriteStream + * @param {Canvas} data Canvas provided by the plot() function + * @returns Promise + */ const writePngToFile = (fileName, data) => new Promise((resolve, reject) => { // the draw function will return false if no data was found, short circuit the output here if (!data.canvas) {