This is a version for the npm package for the API that is held for the GEOGloWS project, which uses the ERA-5 dataset from ECMWF. The application retrieves different plots using Plotly.js. This plots belong to a particular reach_id from a river, so plots are linked to a reach_id. The provided plots are:
- Forecast Records
- 52 Forecast Ensembles(Ensemble 52 is in high resolution)
- Forecast Statistics with return periods
- Historical Records with return periods
- Seasonal Flow
A demo application was prepared to show that the forecast, historical and seasonal data plots can be retrieved for any reach_id. The following codePen shows an application that contains all the streams for the country of Peru. The plots are retrieved when one clicks on an stream. Hydroviewer Peru
The GEOGloWS object contains the functions that retrieve plots for the forecast, historical, seasonal average of a reach_id of a given stream. Therefore, it contains three Properties: Forecast, Historical, and Seasonal. In order to invoke the GEOGloWS object, you can do it in two ways: using the CDN in the HTML or installing it via NPM.
The CDN for the use of the package is:
https://unpkg.com/[email protected]/dist/geoglows.min.js
If the CDN link is going to be used it is necesarry to use the following structure: GEOGloWS.forecast, GEOGloWS.historical, GEOGloWS.seasonal. After, the methods for each one of the different objects can be used. For example, GEOGloWS.forecast.graph_fr() will call the function graph_fr that will retrieve the forecast records.
The NPM command to install the package is
npm i geoglows
If the NPM isntallation is going to be use then a simple require will work.
var foo = require("geoglows"); foo.GEOGLOWS.forecast.graph_fr();
The FORECAST object contains the functions that are realted to the forcast of a reach_id of a given stream.
Type: Object
graph_fr
Function Gives a Plot of the forecast Records for a given reach_id of an streamgraph_emsembles
Function Gives a Plot of the forecast ensembles for a given reach_id of an stream. It gives 52 ensembles.graph_stats
Function Gives a Plot of the forecsast statistics and the last week of the forecast records.
Retrieves a plot of the forecast Records for a given reach_id of an stream. It gives 2 weeks of the forecst records. In addition, the function lets customize the width, heigh, and title of the graph if needed. The retrieved plots are plotted using Plotly, so a button to download data has been added to the plots
reachid
number reach_id of an specific streamhtmlElement
string It is the id of the HTML element.title
string it is the title of the grah (optional).rp
boolean -Tells the function to add the return periods to the plot of the Forecast Records.(optional).width
string Especifies the width of the plot.(optional).height
string Especifies the height of the plot.(optional).
Retrieves a plot of the forecast ensembles for a given reach_id of an stream. It gives 52 ensembles. The ensemble 52 is the only one that comes in high resolution. In addition, You can especify which ensembles do you want. For exmaple, the array [2,4,6,7] will give you the ensembles 2,4,6, and 7. The default is to give all all the ensembles. The function also lets customize the width, heigh, and title of the graph if needed. The retrieved plots are plotted using Plotly, so a button to download data has been added to the plots
reachid
number reach_id of an specific streamhtmlElement
string It is the id of the HTML element.arrayEnsemble
array It is the array that contains the number of ensembles that will be given (optional).title
string it is the title of the grah (optional).width
string Especifies the width of the plot.(optional).height
string Especifies the height of the plot.(optional).
Retrieves a plot of the forecast statisitics of the given reach_id. These statistcis are Maximun, Minimun, 25% percentile, 75% percentile, and Mean. The function also lets customize the width, heigh, and title of the graph if needed. The retrieved plots are plotted using Plotly, so a button to download data has been added to the plots
reachid
number reach_id of an specific streamhtmlElement
string It is the id of the HTML element.title
string it is the title of the grah (optional).rp
boolean -Tells the function to add the return periods to the plot of the Forecast Records.(optional).width
string Especifies the width of the plot.(optional).height
string Especifies the height of the plot.(optional).
The HISTORICAL object contains the functions that are related to the Historical data of a reach_id of a given stream.
Type: Object
graph
Function Retrieves a plot of the historical data of the given reach_id.
Retrieves the plot related to the Historical Records for a given reach_id of an stream. In addition, the function lets customize the width, heigh, and title of the graph if needed. The retrieved plots are plotted using Plotly, so a button to download data has been added to the plots
reachid
number reach_id of an specific streamhtmlElement
string It is the id of the HTML element.title
string it is the title of the grah (optional).rp
boolean -Tells the function to add the return periods to the plot of the Forecast Records.(optional).width
string Especifies the width of the plot.(optional).height
string Especifies the height of the plot.(optional).
The SEASONAL object contains the functions that are related to the plots of the Seasonal average data of a reach_id of a given stream.
Type: Object
graph
Function Retrieves a plot of the historical data of the given reach_id.
Retrieves the plot related to the Seasonal Average Data for a given reach_id of an stream. In addition, the function lets customize the width, heigh, and title of the graph if needed. The retrieved plots are plotted using Plotly, so a button to download data has been added to the plots