diff --git a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/DistFilter.java b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/DistFilter.java index fc5faf86f7..6a2c53bee9 100644 --- a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/DistFilter.java +++ b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/DistFilter.java @@ -23,7 +23,7 @@ import java.util.Arrays; import jep.INumpyable; -import com.raytheon.uf.viz.derivparam.python.PythonNumpyFloatArray; +import com.raytheon.uf.common.python.PythonNumpyFloatArray; /** * TODO Add Description diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JData.py b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JData.py new file mode 100644 index 0000000000..0748c83f31 --- /dev/null +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JData.py @@ -0,0 +1,55 @@ +## +# 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. +## + + +# +# Implements IData and wraps around a Java IData +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 12/10/12 njensen Initial Creation. +# +# +# + +from ufpy.dataaccess import IData +import JUtil, DataTime + +class JData(IData, JUtil.JavaWrapperClass): + + def __init__(self, wrappedObject): + self.jobj = wrappedObject + + def getAttribute(self, key): + return self.jobj.getAttribute(key) + + def getDataTime(self): + return DataTime.DataTime(self.jobj.getDataTime()) + + def getLevel(self): + return str(self.jobj.getLevel()) + + def toJavaObj(self): + return self.jobj + + diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JDataRequest.py b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JDataRequest.py new file mode 100644 index 0000000000..fe35fcd5a2 --- /dev/null +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JDataRequest.py @@ -0,0 +1,89 @@ +## +# 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. +## + + +# +# Implements IDataRequest and wraps around a Java IDataRequest +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 12/17/12 njensen Initial Creation. +# +# +# + +from ufpy.dataaccess import IDataRequest +from com.raytheon.uf.common.dataplugin.level import Level +import JUtil +import jep + +class JDataRequest(IDataRequest, JUtil.JavaWrapperClass): + + def __init__(self, wrappedObject): + self.jobj = wrappedObject + + def setDatatype(self, datatype): + self.jobj.setDatatype(datatype) + + def addIdentifier(self, key, value): + self.jobj.addIdentifier(key, JUtil.pyValToJavaObj(value)) + + def setParameters(self, *args): + from java.lang import String as JavaString + params = jep.jarray(len(args), JavaString) + for i in xrange(len(args)): + params[i] = JavaString(str(args[i])) + self.jobj.setParameters(params) + + def setLevels(self, *args): + levels = jep.jarray(len(args), Level) + for i in xrange(len(args)): + levels[i] = Level(str(args[i])) + self.jobj.setLevels(levels) + + def getDatatype(self): + return self.jobj.getDatatype() + + def getIdentifiers(self): + ids = {} + jmap = self.jobj.getIdentifiers() + itr = jmap.keySet().iterator() + while itr.hasNext(): + key = itr.next() + value = JUtil.javaObjToPyVal(jmap.get(key)) + ids[key] = value + return ids + + def getParameters(self): + return self.jobj.getParameters() + + def getLevels(self): + levels = [] + jlevels = self.jobj.getLevels() + for lev in jlevels: + levels.append(str(lev)) + return levels + + def toJavaObj(self): + return self.jobj + diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGeometryData.py b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGeometryData.py new file mode 100644 index 0000000000..77e41b88e4 --- /dev/null +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGeometryData.py @@ -0,0 +1,98 @@ +## +# 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. +## + + +# +# Implements IGeometryData and wraps around a Java IGeometryData. +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 12/10/12 njensen Initial Creation. +# +# +# + +from ufpy.dataaccess import IGeometryData +import JData +import shapely.wkt + +class JGeometryData(IGeometryData, JData.JData): + + def __init__(self, wrappedObject): + JData.JData.__init__(self, wrappedObject) + + def __getitem__(self, key): + if key == 'geometry': + return self.getGeometry() + elif key == 'parameters': + return self.getParameters() + elif key == 'unit': + return self.getUnit() + elif key =='locationName': + return self.getLocationName() + elif key == 'time': + return self.getDataTime() + elif key == 'level': + return self.getLevel() + else: + t = str(self.getType(key)) + if t == 'STRING': + return self.getString(key) + else: + return self.getNumber(key) + + def getGeometry(self): + return shapely.wkt.loads(self.jobj.getGeometry().toText()) + + def getParameters(self): + params = [] + jparams = self.jobj.getParameters() + itr = jparams.iterator() + while itr.hasNext(): + params.append(itr.next()) + + def getString(self, param): + return str(self.jobj.getString(param)) + + def getNumber(self, param): + jval = self.jobj.getNumber(param) + t = self.getType(param) + if t == 'INT': + return jval.intValue() + elif t == 'LONG': + return jval.longValue() + elif t == 'FLOAT': + return jval.floatValue() + elif t == 'DOUBLE': + return jval.doubleValue() + else: + return jval + + def getUnit(self, param): + return str(self.jobj.getUnit(param)) + + def getType(self, param): + return str(self.jobj.getType(param)) + + def getLocationName(self): + return self.jobj.getLocationName() diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGeometryRequest.py b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGeometryRequest.py new file mode 100644 index 0000000000..3ab5f8e177 --- /dev/null +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGeometryRequest.py @@ -0,0 +1,68 @@ +## +# 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. +## + + +# +# Implements IGeometryRequest and wraps around a Java IGeometryRequest. +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 12/18/12 njensen Initial Creation. +# +# +# + +from ufpy.dataaccess import IGeometryRequest +import JUtil, JDataRequest +import jep +import shapely.wkt + +class JGeometryRequest(IGeometryRequest, JDataRequest.JDataRequest): + + def __init__(self, wrappedObject): + JDataRequest.JDataRequest.__init__(self, wrappedObject) + + def getEnvelope(self): + env = None + jenv = self.jobj.getEnvelope() + if jenv: + from com.vividsolutions.jts.geom import GeometryFactory + env = shapely.wkt.loads(GeometryFactory().toGeometry(jenv).toText()) + return env + + def setEnvelope(self, env): + from com.vividsolutions.jts.geom import Envelope + bounds = env.bounds + jenv = Envelope(bounds[0], bounds[2], bounds[1], bounds[3]) + self.jobj.setEnvelope(bounds) + + def getLocationNames(self): + return self.jobj.getLocationNames() + + def setLocationNames(self, *args): + from java.lang import String as JavaString + locs = jep.jarray(len(args), JavaString) + for i in xrange(len(args)): + locs[i] = str(args[i]) + self.jobj.setLocationNames(locs) + diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGridData.py b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGridData.py new file mode 100644 index 0000000000..21286cbb7a --- /dev/null +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGridData.py @@ -0,0 +1,78 @@ +## +# 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. +## + + +# +# Implements IGridData and wraps around a Java IGridData. +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 12/10/12 njensen Initial Creation. +# +# +# + +from ufpy.dataaccess import IGridData +import JData + +from com.raytheon.uf.common.geospatial.interpolation.data import FloatArrayWrapper, UnitConvertingDataDestination +from com.raytheon.uf.common.python import PythonNumpyFloatArray +from javax.measure.unit import UnitFormat + +class JGridData(IGridData, JData.JData): + + def __init__(self, wrappedObject): + JData.JData.__init__(self, wrappedObject) + + def __getitem__(self, key): + if key == 'parameter': + return self.getParameter() + elif key == 'unit': + return self.getUnit() + elif key == 'rawData': + return self.getRawData() + elif key == 'time': + return self.getDataTime() + elif key == 'level': + return self.getLevel() + + def getParameter(self): + return self.jobj.getParameter() + + def getUnit(self): + return str(self.jobj.getUnit()) + + def getRawData(self, unit=None): + dest = FloatArrayWrapper(self.jobj.getGridGeometry()) + pnfa = None + if unit: + unitObj = UnitFormat.getUCUMInstance().parseObject(unit) + converter = self.jobj.getUnit().getConverterTo(unitObj) + unitDest = UnitConvertingDataDestination(converter, dest) + filledDest = self.jobj.populateDataDestination(unitDest) + pnfa = PythonNumpyFloatArray(filledDest.getWrappedDestination().getFloatArray()) + else: + filledDest = self.jobj.populateDataDestination(dest) + pnfa = PythonNumpyFloatArray(dest.getFloatArray()) + return pnfa.__numpy__[0] + diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGridRequest.py b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGridRequest.py new file mode 100644 index 0000000000..44f04ae5d4 --- /dev/null +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGridRequest.py @@ -0,0 +1,46 @@ +## +# 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. +## + + +# +# Implements IGridRequest and wraps around a Java IGridRequest. +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 12/18/12 njensen Initial Creation. +# +# +# + +from ufpy.dataaccess import IGridRequest +import JUtil, JDataRequest +import jep + +class JGridRequest(IGridRequest, JDataRequest.JDataRequest): + + def __init__(self, wrappedObject): + JDataRequest.JDataRequest.__init__(self, wrappedObject) + + + + diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JepRouter.py b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JepRouter.py new file mode 100644 index 0000000000..2ea5111641 --- /dev/null +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JepRouter.py @@ -0,0 +1,94 @@ +## +# 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. +## + + +# +# Routes requests to the Data Access Framework through JEP to the Java classes. +# Returns Python objects that wrap Java objects. +# +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 12/10/12 njensen Initial Creation. +# +# +# + +from ufpy.dataaccess import IGeometryRequest, IGridRequest + +from com.raytheon.uf.common.dataaccess import DataAccessLayer as JavaDataAccessLayer +from com.raytheon.uf.common.dataaccess.impl import DefaultGridRequest, DefaultGeometryRequest +from com.raytheon.uf.common.time import DataTime as JavaDataTime + +import jep +import DataTime +import JGeometryData, JGridData, JGridRequest, JGeometryRequest + + +def getAvailableTimes(request): + javaTimes = JavaDataAccessLayer.getAvailableTimes(request.toJavaObj()) + times = [] + for jt in javaTimes: + times.append(DataTime.DataTime(jt)) + return times + + +def getData(request, times): + if type(times) is list: + # presuming list of DataTimes + jtimes = jep.jarray(len(times), JavaDataTime) + for i in xrange(len(times)): + jtimes[i] = times[i].toJavaObj() + javaData = JavaDataAccessLayer.getData(request.toJavaObj(), jtimes) + else: + # presuming TimeRange + javaData = JavaDataAccessLayer.getData(request.toJavaObj(), times.toJavaObj()) + wrapper = None + if isinstance(request, IGeometryRequest): + wrapper = JGeometryData.JGeometryData + elif isinstance(request, IGridRequest): + wrapper = JGridData.JGridData + data = [] + for jd in javaData: + data.append(wrapper(jd)) + return data + +def getLatCoords(gridRequest): + # TODO need to request the GridGeometry, then translate it into lat/lons + # Ben has ideas about how to do this fast + pass + +def getLonCoords(gridRequest): + # TODO need to request the GridGeometry, then translate it into lat/lons + # Ben has ideas about how to do this fast + pass + +def getAvailableLocationNames(geometryRequest): + return JavaDataAccessLayer.getAvailableLocationNames(geometryRequest.toJavaObj()) + +def newGeometryRequest(): + return JGeometryRequest.JGeometryRequest(DefaultGeometryRequest()) + +def newGridRequest(): + return JGridRequest.JGridRequest(DefaultGridRequest()) + diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/__init__.py b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/__init__.py new file mode 100644 index 0000000000..2953071052 --- /dev/null +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/__init__.py @@ -0,0 +1,37 @@ +## +# 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. +## + + +# +# __init__.py for dataaccess python that is used within a JVM. +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 12/10/12 njensen Initial Creation. +# +# +# + + +__all__ = [ + ] diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/time/DataTime.py b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/time/DataTime.py new file mode 100644 index 0000000000..0bedba6203 --- /dev/null +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/time/DataTime.py @@ -0,0 +1,98 @@ +## +# 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. +## + + +# +# Python wrapper class that wraps a Java DataTime behind familiar python objects. +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 12/12/12 njensen Initial Creation. +# +# +# + +import datetime, time, exceptions +import AbsTime, JUtil, TimeRange +from com.raytheon.uf.common.time import DataTime as JavaDataTime + +class DataTime(JUtil.JavaWrapperClass): + + def __init__(self, dtime, fcstTime=0): + if isinstance(dtime, AbsTime.AbsTime): + self.__dt = JavaDataTime(dtime.toJavaObj()) + elif isinstance(dtime, str): + self.__dt = JavaDataTime(dtime) + else: + # assuming Java object + self.__dt = dtime + # TODO add support for other possible types of dtime? + + self.__dt.setFcstTime(fcstTime) + + def __eq__(self, other): + return self.__dt.equals(other.toJavaObj()) + + def __ne__(self, other): + return not self == other + + def __lt__(self, other): + return self.__dt.compareTo(other.toJavaObj()) < 0 + + def __le__(self, other): + return self.__dt.compareTo(other.toJavaObj()) <= 0 + + def __gt__(self, other): + return self.__dt.compareTo(other.toJavaObj()) > 0 + + def __ge__(self, other): + return self.__dt.compareTo(other.toJavaObj()) >= 0 + + def __str__(self): + return str(self.__dt.toString()) + + def __repr__(self): + return str(self.__dt.toString()) + + def setFcstTime(self, fcstTime): + self.__dt.setFcstTime(fcstTime) + + def getFcstTime(self): + return self.__dt.getFcstTime() + + def getValidPeriod(self): + return TimeRange.TimeRange(self.__dt.getValidPeriod()) + + def setValidPeriod(self, tr): + self.__dt.setValidPeriod(tr.toJavaObj()) + + def getRefTime(self): + return AbsTime.AbsTime(self.__dt.getRefTime()) + + def setRefTime(self, refTime): + self.__dt.setRefTime(refTime.toJavaObj()) + + def toJavaObj(self): + return self.__dt + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/Level.java b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/Level.java index db553ce4bd..c8b31f425a 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/Level.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/Level.java @@ -20,6 +20,8 @@ package com.raytheon.uf.common.dataplugin.level; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.persistence.Column; import javax.persistence.Entity; @@ -57,6 +59,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Sep 03, 2009 rjpeter Initial creation. + * Dec 20, 2012 njensen Added Level(String) * * * @author rjpeter @@ -80,6 +83,9 @@ public class Level extends PersistableDataObject implements ISerializableObject private static final long serialVersionUID = 1L; + private static final Pattern PATTERN = Pattern + .compile("([0-9]*)((_([0-9]*))??([a-zA-Z]+))"); + @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "LEVEL_GENERATOR") @XmlAttribute @@ -111,6 +117,33 @@ public class Level extends PersistableDataObject implements ISerializableObject private transient boolean dirtyFlag = true; + /** + * Constructor + */ + public Level() { + + } + + /** + * Constructor + * + * @param level + */ + public Level(String level) { + Matcher m = PATTERN.matcher(level); + if (m.matches()) { + String levelOne = m.group(1); + String levelTwo = m.group(4); + String name = m.group(5); + + levelonevalue = Double.parseDouble(levelOne); + if (levelTwo != null) { + leveltwovalue = Double.parseDouble(levelTwo); + } + masterLevel = new MasterLevel(name); + } + } + public long getId() { return id; } diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnitConvertingDataDestination.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnitConvertingDataDestination.java index 093669023e..d68a1c8573 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnitConvertingDataDestination.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnitConvertingDataDestination.java @@ -64,4 +64,8 @@ public class UnitConvertingDataDestination implements DataDestination { wrappedDestination.setDataValue(unitConverter.convert(dataValue), x, y); } + public DataDestination getWrappedDestination() { + return wrappedDestination; + } + } diff --git a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/PythonNumpyFloatArray.java b/edexOsgi/com.raytheon.uf.common.python/src/com/raytheon/uf/common/python/PythonNumpyFloatArray.java similarity index 97% rename from cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/PythonNumpyFloatArray.java rename to edexOsgi/com.raytheon.uf.common.python/src/com/raytheon/uf/common/python/PythonNumpyFloatArray.java index 1f20590bcc..ec3357c58a 100644 --- a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/PythonNumpyFloatArray.java +++ b/edexOsgi/com.raytheon.uf.common.python/src/com/raytheon/uf/common/python/PythonNumpyFloatArray.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.viz.derivparam.python; +package com.raytheon.uf.common.python; import jep.INumpyable; diff --git a/pythonPackages/ufpy/dataaccess/DataAccessLayer.py b/pythonPackages/ufpy/dataaccess/DataAccessLayer.py new file mode 100644 index 0000000000..76ba9b5b43 --- /dev/null +++ b/pythonPackages/ufpy/dataaccess/DataAccessLayer.py @@ -0,0 +1,69 @@ +## +# 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. +## + + +# +# Published interface for ufpy.dataaccess package +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 12/10/12 njensen Initial Creation. +# +# +# + + +import sys + +if sys.modules.has_key('jep'): + import JepRouter + router = JepRouter +else: + #router = ThriftClientRouter() + import exceptions + raise exceptions.NotImplementedError("Must use inside a JVM until ThriftClient support is added") + + +def getAvailableTimes(request): + return router.getAvailableTimes(request) + +def getData(request, times): + return router.getData(request, times) + +def getLatCoords(gridRequest): + return router.getLatCoords(gridRequest) + +def getLonCoords(gridRequest): + return router.getLonCoords(gridRequest) + +def getAvailableLocationNames(geometryRequest): + return router.getAvailableLocaitonNames(geometryRequest) + +def newGeometryRequest(): + return router.newGeometryRequest() + +def newGridRequest(): + return router.newGridRequest() + + + diff --git a/pythonPackages/ufpy/dataaccess/__init__.py b/pythonPackages/ufpy/dataaccess/__init__.py new file mode 100644 index 0000000000..4084a6b361 --- /dev/null +++ b/pythonPackages/ufpy/dataaccess/__init__.py @@ -0,0 +1,165 @@ +## +# 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. +## + + +# +# __init__.py for ufpy.dataaccess package +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 12/10/12 njensen Initial Creation. +# +# +# + +__all__ = [ + + ] + +import abc + +class IDataRequest(object): + __metaclass__ = abc.ABCMeta + + @abc.abstractmethod + def setDatatype(self, datatype): + return + + @abc.abstractmethod + def addIdentifier(self, key, value): + return + + @abc.abstractmethod + def setParameters(self, params): + return + + @abc.abstractmethod + def setLevels(self, levels): + return + + @abc.abstractmethod + def getDatatype(self): + return + + @abc.abstractmethod + def getIdentifiers(self): + return + + @abc.abstractmethod + def getParameters(self): + return + + @abc.abstractmethod + def getLevels(self): + return + + +class IGridRequest(IDataRequest): + __metaclass__ = abc.ABCMeta + + +class IGeometryRequest(IDataRequest): + __metaclass__ = abc.ABCMeta + + @abc.abstractmethod + def getEnvelope(self): + return + + @abc.abstractmethod + def setEnvelope(self, env): + return + + @abc.abstractmethod + def getLocationNames(self): + return + + @abc.abstractmethod + def setLocationNames(self, locationNames): + return + + +class IData(object): + __metaclass__ = abc.ABCMeta + + @abc.abstractmethod + def getAttribute(self, key): + return + + @abc.abstractmethod + def getDataTime(self): + return + + @abc.abstractmethod + def getLevel(self): + return + + + +class IGridData(IData): + __metaclass__ = abc.ABCMeta + + @abc.abstractmethod + def getParameter(self): + return + + @abc.abstractmethod + def getUnit(self): + return + + @abc.abstractmethod + def getRawData(self): + return + + + +class IGeometryData(IData): + #__metaclass__ = abc.ABCMeta + + @abc.abstractmethod + def getGeometry(self): + return + + @abc.abstractmethod + def getParameters(self): + return + + @abc.abstractmethod + def getString(self, param): + return + + @abc.abstractmethod + def getNumber(self, param): + return + + @abc.abstractmethod + def getUnit(self, param): + return + + @abc.abstractmethod + def getType(self, param): + return + + @abc.abstractmethod + def getLocationName(self, param): + return +