Source code for noboplot_1raw
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Created on Mon May 25 21:11:26 2015
"""Program that plots a complete single raw nobo file with a simple
GUI interface. Please observe console output."""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import sys
import os.path as op
import Tkinter as tk
import tkFileDialog as tkfd
import tkMessageBox as tkmb
try:
import nobotouls.noboinout as inout
except:
import noboinout as inout
PROGN = op.basename(sys.argv[0])
DESCRIBEPROG = """Select a single raw NOBO-File and plot all its
content to a png-file in a selected directory"""
OUTPUTMESSAGE = "Plott for \n{}\nsaved to\n{}"
[docs]def main():
"""Main"""
root = tk.Tk()
root.withdraw()
if tkmb.askokcancel(title=PROGN, message=DESCRIBEPROG):
inputcsv = tkfd.askopenfilename(title="Input raw nobo file")
outputdir = tkfd.askdirectory(title="Directory for output")
try:
station, headers, data = inout.read_nobo_file(inputcsv)
picfile = inout.plot_raw_nobo(
station, data,
min(data['dattim']), max(data['dattim']),
outfiledir=outputdir,
tl_lim=(-15, +40),
ff_lim=(0, 50),
ps_lim=(900, 960),
rh_lim=(0, 100),
dd_lim=(0, 360)
)
tkmb.showinfo(title=PROGN,
message=OUTPUTMESSAGE.format(inputcsv, picfile))
except Exception as e:
tkmb.showerror(title=PROGN,
message='Some silly error!\n' +
'Maybe wrong files?\n' + str(e))
if __name__ == '__main__':
inout.version()
sys.exit(main())