# further licensing information.
# #


'''
    A Python Wrapper of RiverForecastGroup.java. This allows focal points the ability
    to see the available methods on the Java object. Note that only getter methods 
    have been implemented at this time, since this is strictly used for accessing
    data.
'''


import JUtil
from RiverForecastPointHandler import pyRiverForecastPointToJavaRiverForecastPoint, javaRiverForecastPointToPyRiverForecastPoint
JUtil.registerPythonToJava(pyRiverForecastPointToJavaRiverForecastPoint)
JUtil.registerJavaToPython(javaRiverForecastPointToPyRiverForecastPoint)

class RiverForecastGroup(JUtil.JavaWrapperClass):

    def __init__(self, wrappedObject):
        self.jobj = wrappedObject

    def __eq__(self, other):
        return self.jobj.equals(other.jobj)

    def __ne__(self, other):
        return not self.__eq__(other)

    def __str__(self):
        string = 'RiverForecastGroup: ' + self.jobj.toString()
        return string
Beispiel #2
0
from com.raytheon.uf.common.serialization.comm import RequestRouter
from com.raytheon.uf.common.hazards.productgen.request import SpatialQueryRequest
from GeometryHandler import jtsToShapely, shapelyToJTS
import JUtil
from Bridge import Bridge
JUtil.registerJavaToPython(jtsToShapely)
JUtil.registerPythonToJava(shapelyToJTS)
from com.vividsolutions.jts.io import WKBReader
'''
    Description: Utility class to retrieve points from the map database.
    
    SOFTWARE HISTORY
    Date         Ticket#    Engineer    Description
    ------------ ---------- ----------- --------------------------
    Oct 22, 2014    3572    jsanchez    Initial creation
    Apr 07, 2015    6690    Robert.Blum Fixed bug and added parameter to allow 
                                        the query to be more flexible.
    Jun 17, 2015    7636    Robert.Blum Added maxResults.
    Aug 03, 2015    9920    Robert.Blum Fixed duplicate alias sql error.
    Mar 02, 2016    14032 Ben.Phillippe Reworked class to use a request object to allow more complex
                                        PostGIS geometric functions to be utilized
    Aug 08, 2016    21056   Robert.Blum Added retrievePathcastLocations.
    Oct 17, 2016    21699   Robert.Blum Updates for incremental overrides.
    @version 1.0
'''


def executeConfiguredQuery(geometryCollection, siteID, queryName):
    bridge = Bridge()
    spatialQueries = bridge.getSpatialQueries()
    query = spatialQueries[queryName]
Beispiel #3
0
'''
    A Python Wrapper of RiverForecastPoint.java. This allows focal points the ability
    to see the available methods on the Java object. Note that only getter methods 
    have been implemented at this time, since this is strictly used for accessing
    data.
'''

import JUtil
from com.raytheon.uf.common.hazards.hydro import RiverHydroConstants

HydroGraphTrend = RiverHydroConstants.HydroGraphTrend

from HydrographHandler import pyHydrographToJavaHydrograph, javaHydrographToPyHydrograph

JUtil.registerPythonToJava(pyHydrographToJavaHydrograph)
JUtil.registerJavaToPython(javaHydrographToPyHydrograph)


class RiverForecastPoint(JUtil.JavaWrapperClass):
    def __init__(self, wrappedObject):
        self.jobj = wrappedObject

    def __eq__(self, other):
        return self.jobj.equals(other.jobj)

    def __ne__(self, other):
        return not self.__eq__(other)

    def __str__(self):
        string = 'RiverForecastPoint: ' + self.jobj.toString()
        return string
#
# A readable hazard event, based on Event, which allows the querying of various
# properties of a hazard event. Subclasses may provide the ability to change
# said properties.
#

import JUtil, datetime

from Event import Event

import AdvancedGeometry
import TimeUtils

from AdvancedGeometryHandler import pyAdvancedGeometryToJavaAdvancedGeometry, javaAdvancedGeometryToPyAdvancedGeometry
JUtil.registerPythonToJava(pyAdvancedGeometryToJavaAdvancedGeometry)
JUtil.registerJavaToPython(javaAdvancedGeometryToPyAdvancedGeometry)

from VisualFeatures import VisualFeatures
from VisualFeaturesHandler import pyVisualFeaturesToJavaVisualFeatures, javaVisualFeaturesToPyVisualFeatures

# This is a kludge. It turns out that (at least with the Java-object-to-Python-value
# conversions) the Java objects of type VisualFeaturesList are converted as standard
# lists, which means that their elements (VisualFeature instances) are not converted
# at all. The reason is that the Java-to-Python conversion handlers are called in the
# order they are registered, and thus the handler provided here for VisualFeaturesList
# objects is never used. For now, since JUtil cannot be changed as it's part of the
# AWIPS2 baseline, the (ugly) solution is to directly access its lists of handlers and
# prepend the visual feature conversion handlers to them.
#
# TODO: Come up with something better! Perhaps get rid of the VisualFeaturesList and
# just use a standard list, and then register handlers to convert to and from Java
Beispiel #5
0
# An EventSet, based on a Java EventSet
#

import JUtil
import datetime

from HazardEvent import HazardEvent

from java.util import Date

from com.raytheon.uf.common.dataplugin.events import EventSet as JavaEventSet

from GenericSessionObjectManagerHandler import pyGenericSessionObjectManagerToJavaGenericSessionObjectManager, javaGenericSessionObjectManagerToPyGenericSessionObjectManager
JUtil.registerPythonToJava(
    pyGenericSessionObjectManagerToJavaGenericSessionObjectManager)
JUtil.registerJavaToPython(
    javaGenericSessionObjectManagerToPyGenericSessionObjectManager)


class EventSet(JUtil.JavaWrapperClass):
    def __init__(self, wrappedObject):
        self.jobj = wrappedObject
        if wrappedObject is not None:
            self.events = self._convertEvents(wrappedObject)
            self.attributes = JUtil.javaObjToPyVal(
                wrappedObject.getAttributes())
        else:
            self.jobj = JavaEventSet()
            self.attributes = {}
            self.events = set()

    def _convertEvents(self, eventSet):
"""
    Description: Interface for retrieving class-based meta data
        
"""
import json
from HazardConstants import *
import HazardMetaDataAccessor
import JUtil
from HazardEventHandler import javaHazardEventToPyHazardEvent
JUtil.registerJavaToPython(javaHazardEventToPyHazardEvent)

from GeometryHandler import shapelyToJTS, jtsToShapely
JUtil.registerPythonToJava(shapelyToJTS)
JUtil.registerJavaToPython(jtsToShapely)

from com.raytheon.uf.viz.hazards.sessionmanager.config.impl import MetaDataAndHazardEvent


def getMetaData(javaHazardEvent, javaMetaDict):
    """
    @param javaHazardEvent: Hazard event from Java.  
    @param javaMetaDict: Dictionary holding environmental parameters, if any.
    @return: JSON-encoded dictionary holding nothing if there is no metadata, or else a
             list of megawidget specifier dictionaries under the key METADATA_KEY, and
             the relative path to the localized file in which any scripts are to be found
             under the key METADATA_FILE_PATH_KEY.
             
    """
    hazardEvent = JUtil.javaObjToPyVal(javaHazardEvent)
    metaDict = JUtil.javaObjToPyVal(javaMetaDict)
    site = metaDict.get("site", None)
Beispiel #7
0
#                         402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
# #
'''
    A Python Wrapper of Hydrograph.java. This allows focal points the ability
    to see the available methods on the Java object. Note that only getter methods 
    have been implemented at this time, since this is strictly used for accessing
    data.
'''

import JUtil
from SHEFHandler import pySHEFToJavaSHEF, javaSHEFToPySHEF
JUtil.registerPythonToJava(pySHEFToJavaSHEF)
JUtil.registerJavaToPython(javaSHEFToPySHEF)


class Hydrograph(JUtil.JavaWrapperClass):
    def __init__(self, wrappedObject):
        self.jobj = wrappedObject

    def __eq__(self, other):
        return self.jobj.equals(other.jobj)

    def __ne__(self, other):
        return not self.__eq__(other)

    def __str__(self):
        string = 'Hydrograph: ' + self.jobj.toString()
        return string
Beispiel #8
0
# 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.
# #

import HazardServicesPythonOverriderInterface
import HazardServicesPythonOverrider
import JUtil, importlib

from GeometryHandler import shapelyToJTS, jtsToShapely
JUtil.registerPythonToJava(shapelyToJTS)
JUtil.registerJavaToPython(jtsToShapely)
from HazardEventHandler import pyHazardEventToJavaHazardEvent, javaHazardEventToPyHazardEvent
JUtil.registerPythonToJava(pyHazardEventToJavaHazardEvent)
JUtil.registerJavaToPython(javaHazardEventToPyHazardEvent)
from KeyInfoHandler import pyKeyInfoToJavaKeyInfo, javaKeyInfoToPyKeyInfo
JUtil.registerPythonToJava(pyKeyInfoToJavaKeyInfo)
JUtil.registerJavaToPython(javaKeyInfoToPyKeyInfo)
from ProductPartHandler import pyProductPartToJavaProductPart, javaProductPartToPyProductPart
JUtil.registerPythonToJava(pyProductPartToJavaProductPart)
JUtil.registerJavaToPython(javaProductPartToPyProductPart)

from collections import OrderedDict
from java.util import ArrayList
from com.raytheon.uf.common.hazards.productgen import GeneratedProduct, GeneratedProductList
import traceback, sys, os, string
import logging, UFStatusHandler
# 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.
# #


import JUtil

from RiverForecastPointHandler import pyRiverForecastPointToJavaRiverForecastPoint, javaRiverForecastPointToPyRiverForecastPoint
JUtil.registerPythonToJava(pyRiverForecastPointToJavaRiverForecastPoint)
JUtil.registerJavaToPython(javaRiverForecastPointToPyRiverForecastPoint)

from RiverForecastGroupHandler import pyRiverForecastGroupToJavaRiverForecastGroup, javaRiverForecastGroupToPyRiverForecastGroup
JUtil.registerPythonToJava(pyRiverForecastGroupToJavaRiverForecastGroup)
JUtil.registerJavaToPython(javaRiverForecastGroupToPyRiverForecastGroup)

from HydrographHandler import pyHydrographToJavaHydrograph, javaHydrographToPyHydrograph
JUtil.registerPythonToJava(pyHydrographToJavaHydrograph)
JUtil.registerJavaToPython(javaHydrographToPyHydrograph)

from com.raytheon.uf.common.time import SimulatedTime
from com.raytheon.uf.common.hazards.hydro import RiverHydroConstants
from com.raytheon.uf.common.hazards.hydro import RiverForecastManager

from sets import Set