From e722fa0723f959f3aac586f38d8f6158857b9a3b Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Mon, 25 Mar 2013 15:09:02 -0500 Subject: [PATCH] Issue #1821 Reshape grib data arrays in place to improve performance. Former-commit-id: 5d01725feac4449b7e54f901caa3fbc25f5b3830 [formerly 4621133ff175fa7566bc56f6223feccc682f9245] [formerly 75c8d46901ad291361372022ff93ad433e21bf02 [formerly 30354883c5dff0fdbf196e7f405525451df1e81e]] Former-commit-id: 75c8d46901ad291361372022ff93ad433e21bf02 Former-commit-id: 04028b0136e45c223c4a87a347c5a92ccb3b56b4 --- edexOsgi/com.raytheon.edex.plugin.grib/GribDecoder.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/GribDecoder.py b/edexOsgi/com.raytheon.edex.plugin.grib/GribDecoder.py index 9da78b1cab..4c979a433a 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/GribDecoder.py +++ b/edexOsgi/com.raytheon.edex.plugin.grib/GribDecoder.py @@ -129,6 +129,8 @@ THINNED_GRID_VALUES = THINNED_GRID_PT_MAP.values() # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # 04/7/09 #1994 bphillip Initial Creation. +# Mar 25, 2013 1821 bsteffen Reshape grib data arrays in +# place to improve performance. # class GribDecoder(): @@ -327,7 +329,7 @@ class GribDecoder(): if scanMode is not None: if not thinnedGrid: - numpyDataArray = numpy.resize(data, (ny, nx)) + numpyDataArray = numpy.reshape(data, (ny, nx)) # Check if rows are scanned in opposite direction. If so, we need to flip them around if scanMode & 16 == 16: @@ -373,7 +375,7 @@ class GribDecoder(): if subCoverage is not None: subGrid = spatialCache.getSubGrid(modelName, gridCoverage) # resize the data array - numpyDataArray = numpy.resize(numpyDataArray, (ny, nx)) + numpyDataArray = numpy.reshape(numpyDataArray, (ny, nx)) startx = subGrid.getUpperLeftX() starty = subGrid.getUpperLeftY() subnx = subGrid.getNX() @@ -399,7 +401,7 @@ class GribDecoder(): # set the new coverage gdsSectionValues['coverage'] = subCoverage - numpyDataArray = numpy.resize(numpyDataArray, (1, metadata[4])) + numpyDataArray = numpy.reshape(numpyDataArray, (1, metadata[4])) newAbbr = GribParamTranslator.getInstance().translateParameter(2, pdsSectionValues['parameterAbbreviation'], pdsSectionValues['centerid'], pdsSectionValues['subcenterid'], pdsSectionValues['genprocess'], dataTime, gridCoverage)