poets.web package

Submodules

poets.web.app module

class poets.web.app.ReverseProxied(app)[source]

Bases: object

Wrap the application in this middleware and configure the front-end server to add these headers, to let you quietly bind this to a URL other than / and to an HTTP scheme that is different than what is used locally.

In nginx: location /myprefix {

proxy_pass http://192.168.0.1:5001; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; proxy_set_header X-Script-Name /myprefix; }
Parameters:app – the WSGI application
poets.web.app.about()[source]

Creates the about page.

poets.web.app.curpath()[source]

Gets the current path of the module.

pth : str
Path of the module.
poets.web.app.download_ts(**kwargs)[source]

Initiates download time series (anomaly) in comma separated values format.

jsonified str
Time series (anomaly) in Dygraphs compatible json format.
poets.web.app.get_ts(**kwargs)[source]

Gets time series for selected location, gets anomaly of time series if anom parameter is passed.

jsonified str
Time series (anomaly) in Dygraphs compatible json format.
poets.web.app.index(**kwargs)[source]

Renders main page of the web application. Generates image arguments needed for OpenLayers overlay if parameters reg and var are set, renders entry page if not set.

poets.web.app.request_image(**kwargs)[source]

Creates image for OpenLayers overlay.

StringIO
Image in StringIO.
poets.web.app.request_legend(**kwargs)[source]

Creates Legend for OpenLayers overlay.

StringIO
Legend in StringIO.
poets.web.app.request_variables(**kwargs)[source]
poets.web.app.start(poet, host='127.0.0.1', port=None, r_host=None, r_port=None, url=None, debug=False)[source]

Starts application and sets global variables.

poet : Poet()
Instance of Poet class.
host : str, optional
Host that is used by the app, defaults to 127.0.0.1.
port : int, optional
Port where app runs on, defaults to 50000.
r_host : str, optional
IP of router that is between host and internet.
r_port : int, optional
Port of router that is between host and internet.
debug : bool, optional
Starts app in debug mode if set True, defaults to False.
poets.web.app.to_dygraph_format(self)[source]

Transforms pandas DataFrame to Dygraphs compatible format.

labels : list of str
Labels of the Dygraphs array.
values : list
Values of the Dygraphs array.

poets.web.overlays module

This modules provides functions used while creating image overlays.

poets.web.overlays.bounds(country, shapefile=None)[source]

Returns the bounding box, center coordinates and zoom level of a shape for web overlay purposes.

country : str
FIPS country code (https://en.wikipedia.org/wiki/FIPS_country_code)
shapefile : str, optional
Paht to a custom shapefile.
lon_min : int
Minimum longitude.
lon_max : int
Maximum longitude.
lat_min : int
Minimum latitude.
lat_max : int
Maximum latitude.
c_lat : int
Center latidute of image.
c_lon : int
Center longitude of image.
zoom : int
Zoom level for openlayers.
poets.web.overlays.image_bounds(country, sp_res, shapefile=None)[source]

Calculates bounding box, center coordinates and zoom level of an image for web overlay purposes.

country : str
FIPS country code (https://en.wikipedia.org/wiki/FIPS_country_code)
sp_res : numeric
Spatial resolution of the image
shapefile : str, optional
Paht to a custom shapefile.
lon_min : int
Minimum longitude.
lon_max : int
Maximum longitude.
lat_min : int
Minimum latitude.
lat_max : int
Maximum latitude.
c_lat : int
Center latidute of image.
c_lon : int
Center longitude of image.
zoom : int
Zoom level for openlayers.

Module contents