Merge "Omaha #3185 only import java DAF support classes when they're actually used" into omaha_14.4.1
Former-commit-id: 6d2d12891f1ca1b7cf3dcc492c5418d5ff10b2e3
This commit is contained in:
commit
2c942239bb
2 changed files with 20 additions and 16 deletions
|
@ -30,12 +30,12 @@
|
|||
# 12/10/12 njensen Initial Creation.
|
||||
# 06/03/13 #2023 dgilling Remove "unit" support from
|
||||
# __getitem__ as it only threw errors.
|
||||
# 08/06/14 3185 njensen Only import shapely when necessary
|
||||
#
|
||||
#
|
||||
|
||||
from ufpy.dataaccess import IGeometryData
|
||||
import JData
|
||||
import shapely.wkt
|
||||
|
||||
class JGeometryData(IGeometryData, JData.JData):
|
||||
|
||||
|
@ -61,6 +61,7 @@ class JGeometryData(IGeometryData, JData.JData):
|
|||
return self.getNumber(key)
|
||||
|
||||
def getGeometry(self):
|
||||
import shapely.wkt
|
||||
return shapely.wkt.loads(self.jobj.getGeometry().toText())
|
||||
|
||||
def getParameters(self):
|
||||
|
|
|
@ -29,21 +29,14 @@
|
|||
# ------------ ---------- ----------- --------------------------
|
||||
# 12/10/12 njensen Initial Creation.
|
||||
# 05/01/14 3095 bsteffen Move numeric data access to new plugin.
|
||||
|
||||
# 08/06/14 3185 njensen Only import Java classes when necessary
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
from ufpy.dataaccess import IGridData
|
||||
import JData
|
||||
from jep import jarray
|
||||
|
||||
from com.raytheon.uf.common.numeric.buffer import FloatBufferWrapper
|
||||
from com.raytheon.uf.common.geospatial.data import UnitConvertingDataFilter
|
||||
from com.raytheon.uf.common.numeric.dest import FilteredDataDestination
|
||||
from com.raytheon.uf.common.python import PythonNumpyFloatArray
|
||||
from com.raytheon.uf.common.geospatial import LatLonReprojection
|
||||
from javax.measure.unit import UnitFormat
|
||||
|
||||
class JGridData(IGridData, JData.JData):
|
||||
|
||||
|
@ -69,15 +62,23 @@ class JGridData(IGridData, JData.JData):
|
|||
return str(self.jobj.getUnit())
|
||||
|
||||
def getRawData(self, unit=None):
|
||||
# import only the modules that are needed
|
||||
from com.raytheon.uf.common.numeric.buffer import FloatBufferWrapper
|
||||
from com.raytheon.uf.common.python import PythonNumpyFloatArray
|
||||
|
||||
nx = self.jobj.getGridGeometry().getGridRange().getSpan(0)
|
||||
ny = self.jobj.getGridGeometry().getGridRange().getSpan(1)
|
||||
dest = FloatBufferWrapper(nx, ny)
|
||||
pnfa = None
|
||||
if unit:
|
||||
from javax.measure.unit import UnitFormat
|
||||
from com.raytheon.uf.common.geospatial.data import UnitConvertingDataFilter
|
||||
from com.raytheon.uf.common.numeric.dest import FilteredDataDestination
|
||||
from jep import jarray
|
||||
|
||||
unitObj = UnitFormat.getUCUMInstance().parseObject(unit)
|
||||
converter = self.jobj.getUnit().getConverterTo(unitObj)
|
||||
filter = UnitConvertingDataFilter(converter)
|
||||
filter = UnitConvertingDataFilter(converter)
|
||||
filters = jarray(1, UnitConvertingDataFilter)
|
||||
filters[0] = filter
|
||||
unitDest = FilteredDataDestination.addFilters(dest, filters)
|
||||
|
@ -98,6 +99,8 @@ class JGridData(IGridData, JData.JData):
|
|||
gridGeometry = self.jobj.getGridGeometry()
|
||||
if gridGeometry is None :
|
||||
return None
|
||||
|
||||
from com.raytheon.uf.common.geospatial import LatLonReprojection
|
||||
latlons = LatLonReprojection.getLatLons(gridGeometry)
|
||||
nx = gridGeometry.getGridRange().getSpan(0)
|
||||
ny = gridGeometry.getGridRange().getSpan(1)
|
||||
|
|
Loading…
Add table
Reference in a new issue