1.1 --- a/eskp.py Sun Feb 01 19:24:47 2015 +0100
1.2 +++ b/eskp.py Mon Feb 02 15:04:17 2015 +0100
1.3 @@ -52,8 +52,8 @@
1.4
1.5 def get_topmenue():
1.6 menue = [
1.7 - ('/ozoneloss', _(u'Ozoneloss'),(
1.8 - ('/ozoneloss', _(u'overview')),
1.9 + ('/ozoneloss', _(u'Ozoneloss'),
1.10 + (('/ozoneloss', _(u'overview')),
1.11 ('/ozoneloss/clams/2015', _(u'calculations')),
1.12 ('/ozoneloss/vpsc/2015', _(u'estimations')),
1.13 ('/ozoneloss/uvi', _(u'uv increase')))),
1.14 @@ -67,22 +67,22 @@
1.15
1.16 def get_o3lossclams_dates():
1.17 menue = [
1.18 - ('/ozoneloss/clams/2015', _(u'2015')),
1.19 - ('/ozoneloss/clams/2012', _(u'2012')),
1.20 - ('/ozoneloss/clams/2011', _(u'2011')),
1.21 - ('/ozoneloss/clams/2010', _(u'2010')),
1.22 - ]
1.23 + ('/ozoneloss/clams/2015', _(u'2015')),
1.24 + ('/ozoneloss/clams/2012', _(u'2012')),
1.25 + ('/ozoneloss/clams/2011', _(u'2011')),
1.26 + ('/ozoneloss/clams/2010', _(u'2010')),
1.27 + ]
1.28 return menue
1.29
1.30 def get_vpsc_dates():
1.31 menue = [
1.32 - ('/ozoneloss/vpsc/2015', _(u'2015')),
1.33 - ('/ozoneloss/vpsc/2014', _(u'2014')),
1.34 - ('/ozoneloss/vpsc/2013', _(u'2013')),
1.35 - ('/ozoneloss/vpsc/2012', _(u'2012')),
1.36 - ('/ozoneloss/vpsc/2011', _(u'2011')),
1.37 - ('/ozoneloss/vpsc/2010', _(u'2010')),
1.38 - ]
1.39 + ('/ozoneloss/vpsc/2015', _(u'2015')),
1.40 + ('/ozoneloss/vpsc/2014', _(u'2014')),
1.41 + ('/ozoneloss/vpsc/2013', _(u'2013')),
1.42 + ('/ozoneloss/vpsc/2012', _(u'2012')),
1.43 + ('/ozoneloss/vpsc/2011', _(u'2011')),
1.44 + ('/ozoneloss/vpsc/2010', _(u'2010')),
1.45 + ]
1.46 return menue
1.47
1.48 app.jinja_env.globals.update(get_o3lossclams_dates=get_o3lossclams_dates)
1.49 @@ -202,12 +202,48 @@
1.50 content = get_content(filename)
1.51 return render_template("/ozoneloss_vpsc.html", act="ozoneloss/vpsc", content=content)
1.52
1.53 -@app.route("/ozoneloss/uvi")
1.54 +
1.55 +@app.route("/ozoneloss/uvi", methods=['GET'])
1.56 def ozoneloss_uvi():
1.57 + # XXX check 'POST' does not work
1.58 filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_uvi.rst")
1.59 content = get_content(filename)
1.60 - return render_template("/ozoneloss_uvi.html", act="ozoneloss/uvi", content=content,
1.61 - alt=_(u"UV increase at 52 degrees N for 50 DU ozone depletion"))
1.62 +
1.63 + lat = 50.
1.64 + o3offset = 50.
1.65 + figname = "uvincr_lat%0.3i_do3%0.3i.svg" % (lat, o3offset)
1.66 +
1.67 +
1.68 + return render_template('ozoneloss_uvi.html', act="ozoneloss/uvi", content=content, figname=figname,
1.69 + alt=_(u"UV increase at {{lat}} degrees N for {{o3offset}} DU ozone depletion"))
1.70 +
1.71 +@app.route("/ozoneloss/uvi_graph", methods=['POST'])
1.72 +def ozoneloss_uvi_graph():
1.73 + filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_uvi.rst")
1.74 + content = get_content(filename)
1.75 +
1.76 + latstr = request.form['Gradzahl']
1.77 + o3offsetstr = request.form['Dobson-Unit']
1.78 +
1.79 + latstr2 = latstr.replace(u'\xb0', '')
1.80 +
1.81 + if latstr2.endswith(u'N'):
1.82 + latstr2 = latstr2.replace(u'N', '')
1.83 + lat = float(latstr2)
1.84 + if latstr2.endswith(u'S'):
1.85 + latstr2 = latstr2.replace(u'S', '')
1.86 + lat = -float(latstr2)
1.87 +
1.88 +
1.89 + figname = "uvincr_lat%0.3i_do3%0.3i.svg" % (lat, float(o3offsetstr))
1.90 +
1.91 + return render_template('graph.html', act="ozoneloss_uvi_graph", content=content, figname=figname,
1.92 + o3offsetstr=o3offsetstr, latstr=latstr)
1.93 +
1.94 +
1.95 +
1.96 +
1.97 +
1.98
1.99 @app.route("/iek-7")
1.100 def institute():
1.101 @@ -225,7 +261,7 @@
1.102 card=card, image=qr_image, contact=_(u"Contact"), exit=_(u"Close"))
1.103
1.104 return render_template("/iek-7.html", act="iek-7", content=content,
1.105 - author=author, card=card, contact = u"IEK-7")
1.106 + author=author, card=card, contact=u"IEK-7")
1.107
1.108
1.109 @app.route("/imprint")
1.110 @@ -245,4 +281,4 @@
1.111 return render_template("404.html", msg=msg, info=info)
1.112
1.113 if __name__ == "__main__":
1.114 - app.run(host='localhost', port=5014, debug=True)
1.115 + app.run(host='localhost', port=5014)