Skip to content

This is a version for the npm package for the API that is held for the GEOGLOWS project

Notifications You must be signed in to change notification settings

romer8/GEOGloWS-JavaScript-Package

Repository files navigation

GEOGloWS-JavaScript-Package

| NPM npm npm GitHub forks Coveralls github

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:

  1. Forecast Records
  2. 52 Forecast Ensembles(Ensemble 52 is in high resolution)
  3. Forecast Statistics with return periods
  4. Historical Records with return periods
  5. 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

Documentation-use

GEOGloWS

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();

Forecast

The FORECAST object contains the functions that are realted to the forcast of a reach_id of a given stream.

Type: Object

Properties

  • graph_fr Function Gives a Plot of the forecast Records for a given reach_id of an stream
  • graph_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.

graph_fr

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

Parameters

  • reachid number reach_id of an specific stream
  • htmlElement 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).

graph_emsembles

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

Parameters

  • reachid number reach_id of an specific stream
  • htmlElement 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).

graph_stats

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

Parameters

  • reachid number reach_id of an specific stream
  • htmlElement 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).

Historical

The HISTORICAL object contains the functions that are related to the Historical data of a reach_id of a given stream.

Type: Object

Properties

  • graph Function Retrieves a plot of the historical data of the given reach_id.

graph

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

Parameters

  • reachid number reach_id of an specific stream
  • htmlElement 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).

Seasonal

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

Properties

  • graph Function Retrieves a plot of the historical data of the given reach_id.

graph

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

Parameters

  • reachid number reach_id of an specific stream
  • htmlElement string It is the id of the HTML element.
  • 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).

About

This is a version for the npm package for the API that is held for the GEOGLOWS project

Resources

Stars

Watchers

Forks

Packages

No packages published