awips2/cave/com.raytheon.viz.avnconfig/localization/aviation/python/TafPlot.py
Max Schenkelberg 6f60751ec6 Issue #2033 moved avnfps and text workstation files into respective plugins.
Change-Id: If95cb839ad81ca2a842ff7f6926847ac3928d8f2

Former-commit-id: 77e1a4d8f5237e5fae930c1e00589c752f8b3738
2013-08-15 12:21:43 -05:00

81 lines
2.6 KiB
Python

##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
#
# Name:
# TafPlot.py
# GFS1-NHD:A8540.0000-SCRIPT;4
#
# Status:
# DELIVERED
#
# History:
# Revision 4 (DELIVERED)
# Created: 18-AUG-2005 15:11:46 TROJAN
# spr 6996
#
# Revision 3 (DELIVERED)
# Created: 06-JUL-2005 18:16:42 TROJAN
# spr 6548
#
# Revision 2 (DELIVERED)
# Created: 07-MAY-2005 11:38:55 OBERFIEL
# Added Item Header Block
#
# Revision 1 (DELIVERED)
# Created: 02-APR-2005 17:10:47 TROJAN
# spr 6763
#
# Change Document History:
# 1:
# Change Document: GFS1-NHD_SPR_6996
# Action Date: 02-SEP-2005 12:22:11
# Relationship Type: In Response to
# Status: CLOSED
# Title: AvnFPS: WxPlot generates errors with NIL TAF
#
#
# TafPlot.py
# George Trojan, SAIC/MDL, March 2005
# last update: 08/18/05
import Avn, AvnLib, Globals, TafPlotP
class Plot:
def __init__(self, **args):
self.color = args.get('color', 'black')
self.data = None
def plot(self, ident, sites, tref, tticks, vticks, cticks, header):
graphics = {'cig': [], 'vsby': [], 'wind': []}
try:
taf = [x for x in Globals.DRC.getTafs(ident, True, tref-86400.0) \
if x.header.split('\n')[0] == header][0]
except IndexError:
raise Avn.AvnError('Cannot access TAF for %s' % ident)
if 'fatal' in taf.dcd:
raise Avn.AvnError('Cannot decode TAF for %s' % ident)
elif not taf.dcd['group']:
raise Avn.AvnError('NIL TAF for %s' % ident)
self.ident = ident
self.data = AvnLib.TafData(taf.dcd['group'])
return TafPlotP.plot(self.data, tticks, vticks, cticks, self.color)
def replot(tticks, vticks, cticks):
return TafPlot.plot(self.data, tticks, vticks, cticks)