app.main package

Module contents

Main public interface to the website.

app.main.views module

The main public routes to view the site

app.main.views.aboutpage()[source]

/about/

About this site.

app.main.views.gagepage(gid=None, slug=None)[source]

/gage/<slug>/

Individual gage page

app.main.views.gagespage()[source]

/gages/

List of gages currently not grouped by regions, or anything else for that matter.

app.main.views.indexpage()[source]

/

Index page

app.main.views.regionpage(rid=None, slug=None)[source]

/region/<slug>/

Individual region page

app.main.views.regionspage()[source]

/regions/

List all regions

app.main.views.riverpage(rid=None, slug=None)[source]

/river/<slug>/

Individual river page

app.main.views.riverspage()[source]

/rivers/

List all rivers

app.main.views.sectionpage(sid=None, slug=None)[source]

/section/<slug>/

Individual section page

app.main.views.sectionspage()[source]

/sections/

List all sections

app.main.plot module

Ways that a plot of a selected sensor can be displayed

class app.main.plot.SensorPlot(gid, stype)[source]

Bases: object

Base plot object for Sensors

Parameters:
  • gid (int) – Gage.id
  • stype (string) – sensor type for gage

Currently supports matplotlib, but designed to be adaptable to support bokeh or others

If ?start=YYYYMMDD(&end=YYYYMMDD) argument, then the plot will use those dates instead of the default 7 days.

data()[source]

Returns sensor data

Defaults to data within last seven days

jpg()[source]

Returns a StringIO JPG plot for the sensor

matplot()[source]

Returns a matplotlib figure for building into a plot

png()[source]

Returns a StringIO PNG plot for the sensor

app.main.plot.gagesensorplot(gid, stype)[source]

/gage/<id>/<sensor type>.png

Draw a PNG plot for the requested gage’s sensor

app.main.plot.gagesensorplotjpg(gid, stype)[source]

/gage/<id>/<sensor type>.jpg /gage/<id>/<sensor type>.jpeg

Draw a JPEG plot for the requested gage’s sensor

app.main.errors module

When things go wrong sitewide they are handled by the app_errorhandlers

app.main.errors.forbidden(e)[source]

Handle 403 Forbidden errors in html and json

app.main.errors.internal_server_error(e)[source]

Handle 500 Internal Server errors in html and json

app.main.errors.page_not_found(e)[source]

Handle 404 Page Not Found errors in html and json