ASM #17308 - Correct lifted index units

Change-Id: I872a48255c137d7221b6cd2be7f70e9d2171d617

Former-commit-id: 3b5ddbed8f115eba688e0b48893a910e1f036972
This commit is contained in:
Melissa Porricel 2016-02-24 13:42:59 -05:00
parent f6698f1db4
commit 3bcda66074
5 changed files with 70 additions and 87 deletions

View file

@ -19,34 +19,61 @@
**/
package com.raytheon.edex.plugin.grib.decoderpostprocessors;
import com.raytheon.edex.plugin.grib.exception.GribException;
import java.util.Arrays;
import java.util.List;
import javax.measure.converter.UnitConverter;
import javax.measure.unit.SI;
import com.raytheon.edex.plugin.grib.exception.GribException;
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
/**
*
* @deprecated Only exists for backwards compatibility in localization files,
* use TemperatureCorrectionPostProcessor directly in the future.
* Adjusts data values on Lifted Index to store as Celcius values.
*
* <pre>
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Nov 18, 2010 bsteffen Initial creation
* Mar 28, 2010 2874 bsteffen Deprecated
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 18, 2010 bsteffen Initial creation
* Mar 28, 2010 2874 bsteffen Deprecated
* Jan 07, 2016 DR17308 MPorricelli Reinstated
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
@Deprecated
public class LiftedIndexPostProcessor extends
TemperatureCorrectionPostProcessor {
public class LiftedIndexPostProcessor extends DecoderPostProcessor {
public LiftedIndexPostProcessor() throws GribException {
super();
private static final List<String> LIFTED_INDEX_PARAMETERS = Arrays.asList(
"SLI", "BLI", "PLI");
private static final String KELVIN_UNIT_STRING = "K";
private static final float MAX_VALID = 150;
private static final UnitConverter k2c = SI.KELVIN
.getConverterTo(SI.CELSIUS);
@Override
public GridRecord[] process(GridRecord record) throws GribException {
// Change units of Lifted Index to match the data
if (LIFTED_INDEX_PARAMETERS.contains(record.getParameter()
.getAbbreviation())
&& KELVIN_UNIT_STRING.equals(record.getParameter()
.getUnitString())) {
float[] data = (float[]) record.getMessageData();
for (int i = 0; i < data.length; i++) {
if (data[i] > MAX_VALID) {
data[i] = (float) k2c.convert(data[i]);
}
}
}
return new GridRecord[] { record };
}
}

View file

@ -29,10 +29,15 @@
post processor. These models may have some parameters which are incorrectly
labeled Celsius vs. Kelvin. The list of parameters to correct is in temperatureCorrectionParameters.xml -->
<postProcessedModel id="TempCorrection">
<modelName>ETA218|GFS212|GFS213|ETA242|RTOFS-.*</modelName>
<modelName>RTOFS-.*</modelName>
<processorName>TemperatureCorrectionPostProcessor</processorName>
</postProcessedModel>
<postProcessedModel id="LiftedIndex">
<modelName>GFS.*|ETA.*|DGEX.*|HiResW.*</modelName>
<processorName>LiftedIndexPostProcessor</processorName>
</postProcessedModel>
<!-- Post processor definition for the RTMA model -->
<postProcessedModel id="RTMA">
<modelName>RTMA</modelName>

View file

@ -13,8 +13,5 @@
are in Kelvin and will convert if the declared unit is Celsius. Values below
the threshold are assumed to be in Celsius and will be converted if the declared
unit is Kelvin -->
<parameter abbreviation="BLI" threshold="150" />
<parameter abbreviation="SLI" threshold="150" />
<parameter abbreviation="PLI" threshold="150" />
<parameter abbreviation="TEMPWTR" threshold="150" />
</temperatureCorrectionParameters>

View file

@ -1204,33 +1204,20 @@ mb | 1 | 0.0 | 4 |2:i4|1:i4|LH|8000F0FF| | 0 | 2
</contourLabeling>
</contourStyle>
</styleRule>
<!-- * SLI
C | 1 | 0 | 4 | | |..|8000F0FF| | 0 | 2
-->
<styleRule>
<paramLevelMatches>
<parameter>PLI</parameter>
</paramLevelMatches>
<contourStyle>
<displayUnits>C</displayUnits>
<contourLabeling labelSpacing="4">
<increment>2</increment>
</contourLabeling>
</contourStyle>
</styleRule>
<styleRule>
<paramLevelMatches>
<paramLevelMatches>
<parameter>SLI</parameter>
<parameter>PLI</parameter>
<parameter>BLI</parameter>
</paramLevelMatches>
<contourStyle>
<displayUnits>C</displayUnits>
<contourStyle>
<displayUnits label="C">K</displayUnits>
<displayFlags>NoPlane</displayFlags>
<contourLabeling labelSpacing="4">
<increment>2</increment>
</contourLabeling>
</contourStyle>
</styleRule>
<!-- * SLI, Laps
C | 1 | 0 | 4 | | |..|8000F0FF|,900| 0 | 2
-->
@ -1247,20 +1234,6 @@ C | 1 | 0 | 4 | | |..|8000F0FF|,900| 0 | 2
</contourLabeling>
</contourStyle>
</styleRule>
<!-- * BLI
C | 1 | 0 | 4 | | |..|8000F0FF| | 0 | 2
-->
<styleRule>
<paramLevelMatches>
<parameter>BLI</parameter>
</paramLevelMatches>
<contourStyle>
<displayUnits>C</displayUnits>
<contourLabeling labelSpacing="4">
<increment>2</increment>
</contourLabeling>
</contourStyle>
</styleRule>
<!-- * L-I, shWlt, LIsfc2x
C | 1 | 0 | 4 | | |..|8000F0FF| | 0 | 2
-->
@ -2796,7 +2769,7 @@ C | 1 | 0 | 4 | | |..|8000F0FF|,,,80 | 0 | 2
</paramLevelMatches>
<contourStyle>
<smoothingDistance>80</smoothingDistance>
<displayUnits>C</displayUnits>
<displayUnits label="C">K</displayUnits>
<displayFlags>NoPlane</displayFlags>
<contourLabeling labelSpacing="4">
<increment>2</increment>

View file

@ -1735,43 +1735,24 @@
* SLI
C | 1 | 0 | -15 | 15 | | | 29 | 0 | 4
-->
<styleRule>
<paramLevelMatches>
<parameter>SLI</parameter>
<parameter>PLI</parameter>
</paramLevelMatches>
<imageStyle>
<displayUnits>C</displayUnits>
<range scale="LINEAR">
<minValue>-15</minValue>
<maxValue>15</maxValue>
</range>
<defaultColormap>Grid/gridded data</defaultColormap>
<colorbarLabeling>
<increment>4</increment>
</colorbarLabeling>
</imageStyle>
</styleRule>
<!--
* BLI
C | 1 | 0 | -15 | 15 | | | 29 | 0 | 4
-->
<styleRule>
<paramLevelMatches>
<parameter>BLI</parameter>
</paramLevelMatches>
<imageStyle>
<displayUnits>C</displayUnits>
<range scale="LINEAR">
<minValue>-15</minValue>
<maxValue>15</maxValue>
</range>
<defaultColormap>Grid/gridded data</defaultColormap>
<colorbarLabeling>
<increment>4</increment>
</colorbarLabeling>
</imageStyle>
</styleRule>
<styleRule>
<paramLevelMatches>
<parameter>SLI</parameter>
<parameter>PLI</parameter>
<parameter>BLI</parameter>
</paramLevelMatches>
<imageStyle>
<displayUnits label="C">K</displayUnits>
<range scale="LINEAR">
<minValue>-15</minValue>
<maxValue>15</maxValue>
</range>
<defaultColormap>Grid/gridded data</defaultColormap>
<colorbarLabeling>
<increment>4</increment>
</colorbarLabeling>
</imageStyle>
</styleRule>
<!--
* L-I, LIsfc2x
C | 1 | 0 | -15 | 15 | | | 29 | 0 | 4