From 9fc779bbfb496cb440cb0579f886670ea6c2ddd6 Mon Sep 17 00:00:00 2001 From: "steve.naples" Date: Mon, 10 Mar 2014 17:47:25 +0000 Subject: [PATCH] ASM #337 MeanMonthlyPrecip updated to handle precip values from PRISM data less than 1 inch. Change-Id: Iffa8644f68df362d4f988fa3d1a9bd16acd4be97 Former-commit-id: 0d44e46f885b688897f77226acbc5720ed02ff76 [formerly 212677f94bf08953f1efa83747e75429058d55e0] [formerly 0d44e46f885b688897f77226acbc5720ed02ff76 [formerly 212677f94bf08953f1efa83747e75429058d55e0] [formerly 20582ab173fbda543fcf5cf9db1ec0d2de140fee [formerly cd7d6876338b98c320a8d7559c518e32e90e3000]]] Former-commit-id: 20582ab173fbda543fcf5cf9db1ec0d2de140fee Former-commit-id: 38fca1641f5df8fa442a2f31793b9e34871eada0 [formerly 488d87dbe4185c733ffce033c9bf26f476105cd7] Former-commit-id: dc08fb750bbb86f6cd9be0cca71fff5b7bf05b52 --- .../viz/mpe/util/MeanMonthlyPrecip.java | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/util/MeanMonthlyPrecip.java b/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/util/MeanMonthlyPrecip.java index bc1805e894..6991c5a041 100644 --- a/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/util/MeanMonthlyPrecip.java +++ b/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/util/MeanMonthlyPrecip.java @@ -22,6 +22,7 @@ package com.raytheon.viz.mpe.util; import java.io.File; import java.io.IOException; +import javax.measure.converter.UnitConverter; import javax.measure.unit.NonSI; import javax.measure.unit.SI; import javax.measure.unit.Unit; @@ -85,9 +86,10 @@ public class MeanMonthlyPrecip { Unit dataUnit = Unit.ONE; displayUnit = NonSI.INCH; - dataUnit = NonSI.INCH; + dataUnit = SI.MILLIMETER; cmc.setDisplayUnit(displayUnit); cmc.setDataUnit(dataUnit); + UnitConverter dataToImage = cmc.getDataToImageConverter(); /* * Loop over the months. Determine for which months PRISM data are @@ -142,23 +144,11 @@ public class MeanMonthlyPrecip { for (int i = MaxY - 1; i >= 0; i--) { for (int j = 0; j < MaxX; j++) { float f = 0; - short s= pdata[j + MaxX * (MaxY - i -1)]; + short s = pdata[j + MaxX * (MaxY - i -1)]; if (s < 0) { - if (s == -9999 || s == -999 || s == -99 || (s == -9)) { - f = s; - } else if (s == -8888 || s == -899) { - f = s; - } else { - f = (float) cmc.getDataToDisplayConverter() - .convert(s); - } + f = 0; } else { - if (s < 30 && s > 24) { - s = 26; - } else if (s > 0 && s <= 24) { - s = 0; - } - f = (float) cmc.getDataToDisplayConverter().convert(s); + f = (float) dataToImage.convert(s); } float aa = (float) ((Math.floor((int) (f * 100))) / 100.0); isoh.value[k][i][j] = (int) aa;