diff --git a/build/deploy.edex.awips2/esb/etc/ingestGrib.sh b/build/deploy.edex.awips2/esb/etc/ingestGrib.sh index 573827df31..4310c38200 100644 --- a/build/deploy.edex.awips2/esb/etc/ingestGrib.sh +++ b/build/deploy.edex.awips2/esb/etc/ingestGrib.sh @@ -32,6 +32,7 @@ fi let "MAX_MEM = GRIB_DECODE_THREADS * 128" # in Meg let "GRIB_MAX_GRID_POINTS = GRIB_DECODE_THREADS * 25000000" let "GRID_PERSIST_THREADS = GRIB_DECODE_THREADS / 2" +let "GRID_POSTPROCESS_THREADS = 1" let "GRID_MAX_PERSIST_MEMORY_IN_MB = GRID_PERSIST_THREADS * 50" export INIT_MEM=128 # in Meg @@ -39,6 +40,7 @@ export MAX_MEM export GRIB_DECODE_THREADS export GRIB_MAX_GRID_POINTS export GRID_PERSIST_THREADS +export GRID_POSTPROCESS_THREADS export GRID_MAX_PERSIST_MEMORY_IN_MB export METADATA_POOL_MAX=10 diff --git a/crh/gov.noaa.nws.crh.edex.grib.decoderpostprocessor/src/gov/noaa/nws/crh/edex/grib/decoderpostprocessor/OneHrPrecipGridProcessor.java b/crh/gov.noaa.nws.crh.edex.grib.decoderpostprocessor/src/gov/noaa/nws/crh/edex/grib/decoderpostprocessor/OneHrPrecipGridProcessor.java index 4419e04796..a844a0989a 100644 --- a/crh/gov.noaa.nws.crh.edex.grib.decoderpostprocessor/src/gov/noaa/nws/crh/edex/grib/decoderpostprocessor/OneHrPrecipGridProcessor.java +++ b/crh/gov.noaa.nws.crh.edex.grib.decoderpostprocessor/src/gov/noaa/nws/crh/edex/grib/decoderpostprocessor/OneHrPrecipGridProcessor.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.List; -import com.raytheon.edex.plugin.grib.decoderpostprocessors.IDecoderPostProcessor; +import com.raytheon.edex.plugin.grib.decoderpostprocessors.DecoderPostProcessor; import com.raytheon.edex.plugin.grib.exception.GribException; import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.grid.GridRecord; @@ -16,23 +16,24 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao; /** * Abstract class to generate 1-hour precip grids - * + * *
- * + * * SOFTWARE HISTORY - * + * * Date Ticket# Engineer Description * ------------- -------- ------------- -------------------------- * Sep 05, 2014 M. Foster Initial creation - * + * Oct 07, 2015 3756 nabowle Extends DecoderPostProcessor. + * *- * + * * @author matthew.foster * @version 1.0 - * + * */ -public abstract class OneHrPrecipGridProcessor implements IDecoderPostProcessor { +public abstract class OneHrPrecipGridProcessor extends DecoderPostProcessor { /** The number of seconds in 1 hour */ protected static final int SECONDS_IN_1_HR = 3600; diff --git a/deltaScripts/16.2.1/DR3756/updatePostProcessorOverrides.sh b/deltaScripts/16.2.1/DR3756/updatePostProcessorOverrides.sh new file mode 100644 index 0000000000..10c7d40114 --- /dev/null +++ b/deltaScripts/16.2.1/DR3756/updatePostProcessorOverrides.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# AWIPS2 #3756 +# +# Updates the non-base postProcessedModels.xml localization files to replace +# precipitation post-processors that have been removed from the baseline with +# the configurable PrecipAccumPostProcessor. +# +# + +for file in `find /awips2/edex/data/utility/edex_static/ -name postProcessedModels.xml` +do + level=`echo $file | cut -f 7 -d '/'` + if [ $level != 'base' ] # base is assumed to be correct as deployed. + then + checkForUpdate=`grep PrecipAccumPostProcessor $file` + if [ "${checkForUpdate}" == "" ] + then + echo "Updating $file" + # create a copy of the file with the changes in a temporary file + newFile="${file}_`date +%s`.dr3756" + cat $file | sed 's/com.raytheon.edex.plugin.grib.decoderpostprocessors.//g' | sed -r 's/Nam80PostProcessor|CanadianNHPostProcessor|CanadianRegPostProcessor|gov.noaa.nws.crh.edex.grib.decoderpostprocessor.GFS20PostProcessor/PrecipAccumPostProcessor/g' | sed 's/
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------- -------- ----------- -------------------------- - * Jan 18, 2012 porricel Initial Creation - * Oct 15, 2013 2473 bsteffen Removed unused method argument. - * - *- * - * @author bphillip - * @version 1 - */ -public class CanadianNHPostProcessor extends SixHrPrecipGridProcessor { - - @Override - public GridRecord[] process(GridRecord record) throws GribException { - // Post process the data if this is a Total Precipitation grid - if (record.getParameter().getAbbreviation().equals("TPrun")) { - return super.process(record); - } - return new GridRecord[] { record }; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - protected List
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------- -------- ----------- -------------------------- - * Jan 18, 2012 porricel Initial Creation - * Oct 15, 2013 2473 bsteffen Removed unused method argument. - * - * - *- * - * @author bphillip - * @version 1 - */ -public class CanadianRegPostProcessor extends ThreeHrPrecipGridProcessor { - - @Override - public GridRecord[] process(GridRecord record) throws GribException { - // Post process the data if this is a Total Precipitation grid - if (record.getParameter().getAbbreviation().equals("TPrun")) { - return super.process(record); - } - return new GridRecord[] { record }; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - protected List
+ * + * SOFTWARE HISTORY + * + * Date Ticket# Engineer Description + * ------------ ---------- ----------- -------------------------- + * 8/30/10 5875 bphillip Initial Creation + * Oct 07, 2015 3756 nabowle Switch interface to abstract class, + * rename from IDecoderPostProcessor, add + * getMessageData(), getType(), and + * relevant enum, + * + *+ * + * @author bphillip + * @version 1 + */ +public abstract class DecoderPostProcessor { + + /** + * Processes the provided record to see if it needs to be post processed + * + * @param record + * The record to examine to determine if it needs to be post + * processed + * @return The array of grib records including any created during post + * processing + * @throws GribException + */ + public abstract GridRecord[] process(GridRecord record) + throws GribException; + + /** Get the type of post processor. Defaults to {@link #PRE_PERSIST}. */ + public PostProcessorType getType() { + return PostProcessorType.PRE_PERSIST; + } + + /** + * Gets the message data for a record. If the record's messagedata is null, + * the data will be retrieved from the data store, set on the record, and + * returned. + * + * @param record + * The record to get the message data for. + * @return + * @throws GribException + */ + protected float[] getMessageData(GridRecord record) throws GribException { + float[] data = (float[]) record.getMessageData(); + if (data == null) { + GridDao dao = null; + try { + dao = new GridDao(); + record.setMessageData(((FloatDataRecord) dao.getHDF5Data( + record, -1)[0]).getFloatData()); + data = (float[]) record.getMessageData(); + } catch (PluginException e) { + throw new GribException("Error populating grib data", e); + } + } + return data; + } + + /** + * Defines the types of IDecoderPostProcessors. + * + * It is expected that {@link #POST_PERSIST} processors do not return the + * input record. + */ + public static enum PostProcessorType { + /** + * Processors that process a GridRecord that was just decoded and before + * being persisted. + */ + PRE_PERSIST, + + /** + * Processors that process a GridRecord after it was persisted. It is + * expected these processors do not return the input record. + */ + POST_PERSIST + } +} diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/ECMWFHiResProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/ECMWFHiResProcessor.java index 85083c24a4..ffeeb95853 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/ECMWFHiResProcessor.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/ECMWFHiResProcessor.java @@ -1,187 +1,59 @@ /** * 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. **/ package com.raytheon.edex.plugin.grib.decoderpostprocessors; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - import com.raytheon.edex.plugin.grib.exception.GribException; -import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grid.GridConstants; import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.edex.database.DataAccessLayerException; -import com.raytheon.uf.edex.database.query.DatabaseQuery; -import com.raytheon.uf.edex.plugin.grid.dao.GridDao; /** - * Grib post processor implementation to generate 6-hr precipitation grids from - * run accumulated total precipitation - * + * Grib post processor implementation to scale TP-ECMWF data to the proper unit. + * *
- * + * * SOFTWARE HISTORY - * + * * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * Aug 30, 2010 5875 bphillip Initial Creation * Oct 15, 2013 2473 bsteffen Removed unused method argument. - * - * + * Oct 07, 2015 3756 nabowle Changed to only do data scaling. Extends + * DecoderPostProcessor. + * + * *- * + * * @author bphillip * @version 1 */ -public class ECMWFHiResProcessor extends SixHrPrecipGridProcessor { +public class ECMWFHiResProcessor extends DecoderPostProcessor { @Override public GridRecord[] process(GridRecord record) throws GribException { // Post process the data if this is a Total Precipitation grid if (record.getParameter().getAbbreviation().equals("TP-ECMWF")) { - return super.process(record); + float[] data = getMessageData(record); + for (int i = 0; i < data.length; i++) { + data[i] = data[i] * 1000; + } } return new GridRecord[] { record }; } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - protected List
- * + * * SOFTWARE HISTORY - * + * * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * Apr 09, 2010 4638 bphillip Initial Creation @@ -70,12 +70,13 @@ import com.raytheon.uf.edex.plugin.grid.PartialGrid; * Jul 21, 2014 3373 bclement JAXB manager api changes * Aug 18, 2014 4360 rferrel Set secondaryId in {@link #createAssembledRecord(GridRecord, CompositeModel)} * Sep 09, 2015 4868 rjpeter Updated to be stored in partial grids as part of normal route. + * Oct 07, 2015 3756 nabowle Extends DecoderPostProcessor. *- * + * * @author bphillip * @version 1 */ -public class EnsembleGridAssembler implements IDecoderPostProcessor { +public class EnsembleGridAssembler extends DecoderPostProcessor { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(EnsembleGridAssembler.class); @@ -145,7 +146,7 @@ public class EnsembleGridAssembler implements IDecoderPostProcessor { /** * Gets the composite model for the provided model name0 - * + * * @param modelName * The model name to determine the composite model name for * @return The composite model. Null if not found @@ -175,7 +176,7 @@ public class EnsembleGridAssembler implements IDecoderPostProcessor { /** * Merges the data from a GridRecord into the composite GridRecord - * + * * @param record * The GridRecord containing the data to add * @param assembledRecord @@ -216,7 +217,7 @@ public class EnsembleGridAssembler implements IDecoderPostProcessor { pGrid.setxOffset((nx * modIndex) - modIndex); pGrid.setyOffset(0); assembledRecord.addExtraAttribute(PartialGrid.KEY, pGrid); - assembledRecord.setMessageData(recordToAssemble.getMessageData()); + assembledRecord.setMessageData(getMessageData(recordToAssemble)); return checkWorldWrap(assembledRecord); } @@ -225,7 +226,7 @@ public class EnsembleGridAssembler implements IDecoderPostProcessor { * Checks if assembledRecord's partial grid has extra columns that wrap * around. This is due to partial grids having 1 column of overlap between * each partial grid. - * + * * @param assembledRecord * @return */ @@ -278,5 +279,4 @@ public class EnsembleGridAssembler implements IDecoderPostProcessor { return Util.resizeDataTo1D(rval, ny, nx); } - } diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/FFGGribPostProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/FFGGribPostProcessor.java index 83cb17b975..1848510506 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/FFGGribPostProcessor.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/FFGGribPostProcessor.java @@ -1,19 +1,19 @@ /** * 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. **/ @@ -43,13 +43,14 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao; * Mar 26, 2013 1821 bsteffen Optimize FFG version query. * Oct 15, 2013 2473 bsteffen Remove deprecated method calls. * Apr 25, 2014 2060 njensen Remove dependency on grid dataURI column + * Oct 07, 2015 3756 nabowle Extends DecoderPostProcessor. * * * * @author bphillip * @version 1 */ -public class FFGGribPostProcessor implements IDecoderPostProcessor { +public class FFGGribPostProcessor extends DecoderPostProcessor { @Override public GridRecord[] process(GridRecord record) throws GribException { diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/GFSProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/GFSProcessor.java deleted file mode 100644 index ccbcfa248c..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/GFSProcessor.java +++ /dev/null @@ -1,226 +0,0 @@ -/** - * 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. - **/ - -package com.raytheon.edex.plugin.grib.decoderpostprocessors; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.List; - -import com.raytheon.edex.plugin.grib.exception.GribException; -import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grid.GridConstants; -import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.common.dataquery.db.QueryParam.QueryOperand; -import com.raytheon.uf.common.datastorage.records.FloatDataRecord; -import com.raytheon.uf.common.parameter.Parameter; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.common.time.TimeRange; -import com.raytheon.uf.edex.database.DataAccessLayerException; -import com.raytheon.uf.edex.database.query.DatabaseQuery; -import com.raytheon.uf.edex.plugin.grid.dao.GridDao; - -/** - * Used to generate 6hr record from 12hr intervals. - * - *
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------- -------- ----------- -------------------------- - * Apr 25, 2011 rgeorge Initial creation - * Aug 30, 2013 2298 rjpeter Make getPluginName abstract - * Oct 15, 2013 2473 bsteffen Remove deprecated method calls. - * - *- * - * @author rgeorge - * @version 1.0 - */ -public class GFSProcessor extends SixHrPrecipGridProcessor { - private static final int SECONDS_IN_12_HRS = 43200; - - @Override - public GridRecord[] process(GridRecord record) throws GribException { - // Post process the data if this is a Total Precipitation grid - if (record.getParameter().getAbbreviation().equals("TP12hr") - && ((record.getDataTime().getFcstTime() / 3600) > 180)) { - return super.process(record); - } - return new GridRecord[] { record }; - } - - /** - * Generates the 6 hour accumulated grid from the run accumulated - * precipitation grids. This function will look in the inventory and - * generate any 6 hr grids that can be generated. - * - * @param record - * The grib record for which to generate the 6 hour accumulated - * precipitation grid - * @return The generated 6-hr precipitation grids - * @throws GribException - */ - @Override - protected synchronized GridRecord[] generate6hrPrecipGrids(GridRecord record) - throws GribException { - List
- * + * * SOFTWARE HISTORY - * + * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 6/11/2015 4542 bphillip Initial creation - * + * Oct 07, 2015 3756 nabowle Extends DecoderPostProcessor. + * * @author bphillip * @version 1.0 */ -public class HPCqpfPostProcessor implements IDecoderPostProcessor { +public class HPCqpfPostProcessor extends DecoderPostProcessor { /** Parameter abbreviation patter for perecent probability grids */ private static final String PCT_PROB_PATTERN = "ProbTP\\dp\\d{2}in\\d{1,2}hr"; @@ -51,7 +52,7 @@ public class HPCqpfPostProcessor implements IDecoderPostProcessor { // Check to see if this is a grid we are looking for if (parameterAbbreviation.matches(PCT_PROB_PATTERN)) { // If so, multiply the data by 100 to obtain a percent - float[] data = (float[]) record.getMessageData(); + float[] data = getMessageData(record); for (int i = 0; i < data.length; i++) { if (data[i] >= 0.0 && data[i] <= 1.0) { data[i] *= 100; diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/HWRFPostProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/HWRFPostProcessor.java index 5eaea84000..5e9b0a8d49 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/HWRFPostProcessor.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/HWRFPostProcessor.java @@ -1,19 +1,19 @@ /** * 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. **/ @@ -46,21 +46,22 @@ import com.vividsolutions.jts.geom.Geometry; /** * HWRF post processor implementation. - * + * *@@ -45,7 +46,7 @@ import com.raytheon.uf.common.parameter.Parameter; * @version 1.0 */ -public class MSASPostProcessor implements IDecoderPostProcessor { +public class MSASPostProcessor extends DecoderPostProcessor { private static final String TSLSA = "TSLSA"; @@ -65,7 +66,7 @@ public class MSASPostProcessor implements IDecoderPostProcessor { /* * (non-Javadoc) - * + * * @see * com.raytheon.edex.plugin.grib.decoderpostprocessors.IDecoderPostProcessor * #process(com.raytheon.uf.common.dataplugin.grib.GridRecord) diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/Nam80PostProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/Nam80PostProcessor.java deleted file mode 100644 index dda454a13b..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/Nam80PostProcessor.java +++ /dev/null @@ -1,215 +0,0 @@ -/** - * 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. - **/ -package com.raytheon.edex.plugin.grib.decoderpostprocessors; - -import java.util.Calendar; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import com.raytheon.edex.plugin.grib.exception.GribException; -import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grid.GridConstants; -import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.common.datastorage.records.FloatDataRecord; -import com.raytheon.uf.common.parameter.Parameter; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.common.time.TimeRange; -import com.raytheon.uf.edex.database.DataAccessLayerException; -import com.raytheon.uf.edex.database.query.DatabaseQuery; -import com.raytheon.uf.edex.plugin.grid.dao.GridDao; - -/** - * Post processor for the NAM80 (ETA) model. This post processor generates the - * missing 6 hour total and convective precipitation grids. - * - *- * + * * SOFTWARE HISTORY - * + * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Sep 10, 2015 4819 rferrel Initial Creation - * + * Sep 10, 2015 4819 rferrel Initial Creation + * Oct 07, 2015 3756 nabowle Extends DecoderPostProcessor. + * *- * + * * @author rferrel * @version 1 */ -public class HWRFPostProcessor implements IDecoderPostProcessor { +public class HWRFPostProcessor extends DecoderPostProcessor { /** * Format for datasetId prefix- -. @@ -131,7 +132,7 @@ public class HWRFPostProcessor implements IDecoderPostProcessor { /** * Add the count in ct's extrainfo to the dataset name prefix. - * + * * @param ct * @param datasetIdPrefix * @return datasetId @@ -156,7 +157,7 @@ public class HWRFPostProcessor implements IDecoderPostProcessor { /** * Find datasetId a result grid that has > 95% intersection with the record. - * + * * @param record * @param result * @return datasetId or null when > 95% intersection not found @@ -189,7 +190,7 @@ public class HWRFPostProcessor implements IDecoderPostProcessor { /** * While locked get datasetId for the record's grid info and update the grid * info list associated with dsIdPrefix. - * + * * @param record * @param datasetIdPrefix */ diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/IDecoderPostProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/IDecoderPostProcessor.java deleted file mode 100644 index d1c254b6f6..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/IDecoderPostProcessor.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * 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. - **/ - -package com.raytheon.edex.plugin.grib.decoderpostprocessors; - -import com.raytheon.edex.plugin.grib.exception.GribException; -import com.raytheon.uf.common.dataplugin.grid.GridRecord; - -/** - * Grib decoder post processor interface - * - * - * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * 8/30/10 5875 bphillip Initial Creation - * - *- * - * @author bphillip - * @version 1 - */ -public interface IDecoderPostProcessor { - - /** - * Processes the provided record to see if it needs to be post processed - * - * @param record - * The record to examine to determine if it needs to be post - * processed - * @return The array of grib records including any created during post - * processing - * @throws GribException - */ - public GridRecord[] process(GridRecord record) throws GribException; -} diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/LapsPostProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/LapsPostProcessor.java index 1566aa7e66..458be08bd7 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/LapsPostProcessor.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/LapsPostProcessor.java @@ -1,19 +1,19 @@ /** * 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. **/ @@ -28,23 +28,24 @@ import com.raytheon.uf.common.parameter.Parameter; /** * Adjusts the LAPS Grib data to have to correct level information - * + * *- * + * * SOFTWARE HISTORY - * + * * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * Apr 07, 2011 6619 bphillip Initial creation * Oct 15, 2013 2473 bsteffen Remove deprecated method calls. * Sep 09, 2014 3356 njensen Remove CommunicationException - * + * Oct 07, 2015 3756 nabowle Extends DecoderPostProcessor. + * *- * + * * @author bphillip * @version 1.0 */ -public class LapsPostProcessor implements IDecoderPostProcessor { +public class LapsPostProcessor extends DecoderPostProcessor { private static final String FHAG = "FHAG"; diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/MSASPostProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/MSASPostProcessor.java index b799b8fded..5ba89a6458 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/MSASPostProcessor.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/MSASPostProcessor.java @@ -1,19 +1,19 @@ /** * 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. **/ @@ -37,6 +37,7 @@ import com.raytheon.uf.common.parameter.Parameter; * ------------- -------- ----------- -------------------------- * Aug 18, 2011 bphillip Initial creation * Oct 15, 2013 2473 bsteffen Remove deprecated method calls. + * Oct 07, 2015 3756 nabowle Extends DecoderPostProcessor. * * *
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------- -------- ----------- -------------------------- - * Nov 17, 2011 bphillip Initial creation - * Aug 30, 2013 2298 rjpeter Make getPluginName abstract - * Oct 15, 2013 2473 bsteffen Remove deprecated method calls. - * - *- * - * @author bphillip - * @version 1.0 - */ - -public class Nam80PostProcessor implements IDecoderPostProcessor { - - /** The number of seconds in 6 hours */ - private static final int SECONDS_IN_6_HRS = 21600; - - /** Parameter abbreviation for 12 hr total precipitation accumulation */ - private static final String TP_12HR = "TP12hr"; - - /** Parameter abbreviation for 6 hr total precipitation accumulation */ - private static final String TP_6HR = "TP6hr"; - - /** Parameter abbreviation for 12 hr convective precipitation accumulation */ - private static final String CP_12HR = "CP12hr"; - - /** Parameter abbreviation for 6 hr convective precipitation accumulation */ - private static final String CP_6HR = "CP6hr"; - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.edex.plugin.grib.decoderpostprocessors.IDecoderPostProcessor - * #process(com.raytheon.uf.common.dataplugin.grib.GridRecord) - */ - @Override - public GridRecord[] process(GridRecord record) throws GribException { - - /* - * Determine if this record is a 6 or 12 hour total precipitation - * accumulation grid - */ - if (record.getParameter().getAbbreviation().equals(TP_12HR)) { - return generate6HrGrids(record, false, TP_6HR, TP_12HR); - } else if (record.getParameter().getAbbreviation().equals(TP_6HR)) { - return generate6HrGrids(record, true, TP_6HR, TP_12HR); - } else if (record.getParameter().getAbbreviation().equals(CP_12HR)) { - return generate6HrGrids(record, false, CP_6HR, CP_12HR); - } else if (record.getParameter().getAbbreviation().equals(CP_6HR)) { - return generate6HrGrids(record, true, CP_6HR, CP_12HR); - } - - return new GridRecord[] { record }; - } - - @SuppressWarnings("unchecked") - private GridRecord[] generate6HrGrids(GridRecord currentRecord, - boolean sixHr, String parameter6hr, String parameter12hr) - throws GribException { - // The 12 hr accumulation grid to use in the calculations - GridRecord tp12record = null; - - // The 6 hr accumulation grid to use in the calculations - GridRecord tp6record = null; - Date refTime = currentRecord.getDataTime().getRefTime(); - GridDao dao = null; - try { - dao = new GridDao(); - } catch (PluginException e) { - throw new GribException("Error instantiating Grib Dao!", e); - } - - /* - * If the current record is a 6 hr accumulation grid, get the 12 hr grid - * and vice versa - */ - DatabaseQuery dbQuery = new DatabaseQuery(GridRecord.class); - dbQuery.addQueryParam(GridConstants.DATASET_ID, "ETA"); - dbQuery.addQueryParam("dataTime.refTime", refTime); - if (sixHr) { - tp6record = currentRecord; - dbQuery.addQueryParam(GridConstants.PARAMETER_ABBREVIATION, - parameter12hr); - dbQuery.addQueryParam("dataTime.fcstTime", currentRecord - .getDataTime().getFcstTime() + SECONDS_IN_6_HRS); - } else { - tp12record = currentRecord; - dbQuery.addQueryParam(GridConstants.PARAMETER_ABBREVIATION, - parameter6hr); - dbQuery.addQueryParam("dataTime.fcstTime", currentRecord - .getDataTime().getFcstTime() - SECONDS_IN_6_HRS); - } - try { - List
- * + * * SOFTWARE HISTORY - * + * * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * Feb 01, 2011 6320 bphillip Initial Creation * Oct 15, 2013 2473 bsteffen Remove deprecated method calls. - * - * + * Oct 07, 2015 3756 nabowle Extends DecoderPostProcessor. + * + * *- * + * * @author bphillip * @version 1 */ -public class RTMAGribPostProcessor implements IDecoderPostProcessor { +public class RTMAGribPostProcessor extends DecoderPostProcessor { @Override public GridRecord[] process(GridRecord record) throws GribException { diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/RUC130GribPostProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/RUC130GribPostProcessor.java index b8de53253b..ced7686669 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/RUC130GribPostProcessor.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/RUC130GribPostProcessor.java @@ -1,19 +1,19 @@ /** * 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. **/ @@ -26,21 +26,22 @@ import com.raytheon.uf.common.dataplugin.grid.GridRecord; /** * Grib post processor implementation to eliminate 2-3hr duration grids from the * RUC130 model - * + * *
- * + * * SOFTWARE HISTORY - * + * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 9/9/10 #4419 bphillip Initial Creation - * + * Oct 07, 2015 3756 nabowle Extends DecoderPostProcessor. + * *- * + * * @author bphillip * @version 1 */ -public class RUC130GribPostProcessor implements IDecoderPostProcessor { +public class RUC130GribPostProcessor extends DecoderPostProcessor { @Override public GridRecord[] process(GridRecord record) throws GribException { diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/RUC236GribPostProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/RUC236GribPostProcessor.java index 74c8e65164..722bdb12a5 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/RUC236GribPostProcessor.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/RUC236GribPostProcessor.java @@ -1,19 +1,19 @@ /** * 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. **/ @@ -34,13 +34,13 @@ import com.raytheon.uf.common.dataplugin.grid.GridRecord; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 1/24/2012 DR 14263 M. Porricelli Initial Creation - * + * Oct 07, 2015 3756 nabowle Extends DecoderPostProcessor. * * * @author porricel * @version 1 */ -public class RUC236GribPostProcessor implements IDecoderPostProcessor { +public class RUC236GribPostProcessor extends DecoderPostProcessor { @Override public GridRecord[] process(GridRecord record) throws GribException { diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/SixHrPrecipGridProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/SixHrPrecipGridProcessor.java deleted file mode 100644 index 4ddb30ba4c..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/SixHrPrecipGridProcessor.java +++ /dev/null @@ -1,214 +0,0 @@ -/** - * 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. - **/ - -package com.raytheon.edex.plugin.grib.decoderpostprocessors; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; - -import com.raytheon.edex.plugin.grib.exception.GribException; -import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.common.datastorage.records.FloatDataRecord; -import com.raytheon.uf.common.parameter.Parameter; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.common.time.TimeRange; -import com.raytheon.uf.edex.plugin.grid.dao.GridDao; - -/** - * Abstract class to generate 6hr records - * - * - *
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------- -------- ----------- -------------------------- - * Apr 25, 2011 rgeorge Initial creation - * Aug 30, 2013 2298 rjpeter Make getPluginName abstract - * Oct 15, 2013 2473 bsteffen Removed deprecated and unused code. - * - *- * - * @author rgeorge - * @version 1.0 - */ -public abstract class SixHrPrecipGridProcessor implements IDecoderPostProcessor { - - /** The number of seconds in 6 hours */ - protected static final int SECONDS_IN_6_HRS = 21600; - - @Override - public GridRecord[] process(GridRecord record) throws GribException { - - // Post process the data if this is a Total Precipitation grid - - GridRecord[] newRecords = generate6hrPrecipGrids(record); - GridRecord[] retVal = new GridRecord[newRecords.length + 1]; - retVal[0] = record; - for (int i = 1; i < retVal.length; i++) { - retVal[i] = newRecords[i - 1]; - } - return retVal; - - } - - protected abstract GridRecord[] generate6hrPrecipGrids(GridRecord record) - throws GribException; - - /** - * Generates the 6hr precipitation grid - * - * @param record - * The current record to clone and modify to produce the new 6hr - * grid - * @param precipInventory - * The current run accumulated grid inventory - * @return The generated 6hr precipitation grid - * @throws GribException - */ - protected List
- * + * * SOFTWARE HISTORY - * + * * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * Mar 28, 2010 2874 bsteffen Initial creation * Apr 25, 2014 2060 njensen Use JAXB instead of JAXBManager - * - * + * Oct 07, 2015 3756 nabowle Extends DecoderPostProcessor. + * + * *- * + * * @author bsteffen * @version 1.0 */ -public class TemperatureCorrectionPostProcessor implements - IDecoderPostProcessor, ILocalizationFileObserver { +public class TemperatureCorrectionPostProcessor extends DecoderPostProcessor + implements ILocalizationFileObserver { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(TemperatureCorrectionPostProcessor.class); @@ -208,5 +209,4 @@ public class TemperatureCorrectionPostProcessor implements } } - } diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/ThreeHrPrecipGridProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/ThreeHrPrecipGridProcessor.java index abd504a54d..f2ac5511b0 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/ThreeHrPrecipGridProcessor.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/ThreeHrPrecipGridProcessor.java @@ -1,19 +1,19 @@ /** * 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. **/ @@ -34,7 +34,11 @@ import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.edex.plugin.grid.dao.GridDao; /** - * Abstract class to generate 3hr records + * Abstract class to generate 3hr records. + * + * Note: This class has been replaced by PrecipAccumPostProcessor and only + * remains for + * gov.noaa.nws.crh.edex.grib.decoderpostprocessor.GFS20PostProcessor * * *
@@ -46,14 +50,15 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao; * Jan 24, 2012 14299 M. Porricelli Initial creation * Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Oct 15, 2013 2473 bsteffen Removed deprecated and unused code. + * Oct 07, 2015 3756 nabowle Extends DecoderPostProcessor. * ** * @author porricel * @version 1.0 */ -public abstract class ThreeHrPrecipGridProcessor implements - IDecoderPostProcessor { +public abstract class ThreeHrPrecipGridProcessor extends + DecoderPostProcessor { /** The number of seconds in 3 hours */ protected static final int SECONDS_IN_3_HRS = 10800; @@ -78,7 +83,7 @@ public abstract class ThreeHrPrecipGridProcessor implements /** * Generates the 3hr precipitation grid - * + * * @param record * The current record to clone and modify to produce the new 3hr * grid @@ -113,7 +118,7 @@ public abstract class ThreeHrPrecipGridProcessor implements /** * Generates the 3hr precipitation grid from the current grid and the * previous grid - * + * * @param inventoryRecord * The previous grid from the inventory * @param currentRecord @@ -178,7 +183,7 @@ public abstract class ThreeHrPrecipGridProcessor implements /** * Calculates the new data by subtracting the previous inventory data from * the current data - * + * * @param inventoryData * The data from the previous precipitation record * @param newData @@ -189,7 +194,7 @@ public abstract class ThreeHrPrecipGridProcessor implements /** * Modifies the DataTime of the provided record to include a 3hr time range - * + * * @param record * The record to modify the datatime for */ diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/precipitation/AccumulationConfig.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/precipitation/AccumulationConfig.java new file mode 100644 index 0000000000..0858e6d94a --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/precipitation/AccumulationConfig.java @@ -0,0 +1,228 @@ +/** + * 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. + **/ +package com.raytheon.edex.plugin.grib.decoderpostprocessors.precipitation; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + +/** + * Stores a list of models and a list of AccumulationCreationConfigs to apply + * for those models. + * + *
+ * + * SOFTWARE HISTORY + * + * Date Ticket# Engineer Description + * ------------ ---------- ----------- -------------------------- + * Sep 28, 2015 3756 nabowle Initial creation + * + *+ * + * @author nabowle + * @version 1.0 + */ +@XmlAccessorType(XmlAccessType.NONE) +public class AccumulationConfig { + + @XmlElement(name = "model") + private List
+ * + * SOFTWARE HISTORY + * + * Date Ticket# Engineer Description + * ------------ ---------- ----------- -------------------------- + * Sep 28, 2015 3756 nabowle Initial creation + * + *+ * + * @author nabowle + * @version 1.0 + */ +@XmlRootElement +@XmlAccessorType(XmlAccessType.NONE) +public class AccumulationConfigs { + + @XmlElement(name = "accumulation") + private List
+ * + * + * SOFTWARE HISTORY + * + * Date Ticket# Engineer Description + * ------------ ---------- ----------- -------------------------- + * Sep 28, 2015 3756 nabowle Initial creation + * + *+ * + * @author nabowle + * @version 1.0 + */ +@XmlAccessorType(XmlAccessType.NONE) +public class AccumulationCreationConfig { + + @XmlAttribute(required = true) + private int forecastPeriodHours; + + @XmlAttribute(required = true) + private String accumulationParam; + + @XmlAttribute(required = true) + private String minuendParam; + + @XmlAttribute(required = true) + private String subtrahendParam; + + /** + * Constructor. + */ + public AccumulationCreationConfig() { + super(); + } + + /** + * Constructor. + * + * + * @param forecastPeriod + * The forecast period in hours. + * @param accumulation + * The parameter to use for the calculated accumulation. + * @param minuend + * The parameter subtracted from in calculating accumulation. + * @param subtrahend + * The parameter being subtracted. + */ + public AccumulationCreationConfig(int forecastPeriod, String accumulation, + String minuend, String subtrahend) { + super(); + this.forecastPeriodHours = forecastPeriod; + this.accumulationParam = accumulation; + this.minuendParam = minuend; + this.subtrahendParam = subtrahend; + } + + /** + * @return the forecastPeriod + */ + public int getForecastPeriodHours() { + return forecastPeriodHours; + } + + /** + * @param forecastPeriod + * the forecastPeriod to set + */ + public void setForecastPeriodHours(int forecastPeriod) { + this.forecastPeriodHours = forecastPeriod; + } + + /** + * @return the forecastPeriod in seconds. + */ + public int getForecastPeriodSeconds() { + return forecastPeriodHours * TimeUtil.SECONDS_PER_HOUR; + } + + /** + * @return the accumulation + */ + public String getAccumulationParam() { + return accumulationParam; + } + + /** + * @param accumulation + * the accumulation to set + */ + public void setAccumulationParam(String accumulation) { + this.accumulationParam = accumulation; + } + + /** + * @return the minuend + */ + public String getMinuendParam() { + return minuendParam; + } + + /** + * @param minuend + * the minuend to set + */ + public void setMinuendParam(String minuend) { + this.minuendParam = minuend; + } + + /** + * @return the subtrahend + */ + public String getSubtrahendParam() { + return subtrahendParam; + } + + /** + * @param subtrahend + * the subtrahend to set + */ + public void setSubtrahendParam(String subtrahend) { + this.subtrahendParam = subtrahend; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime + * result + + ((accumulationParam == null) ? 0 : accumulationParam + .hashCode()); + result = prime * result + forecastPeriodHours; + result = prime * result + + ((minuendParam == null) ? 0 : minuendParam.hashCode()); + result = prime * result + + ((subtrahendParam == null) ? 0 : subtrahendParam.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + AccumulationCreationConfig other = (AccumulationCreationConfig) obj; + if (accumulationParam == null) { + if (other.accumulationParam != null) { + return false; + } + } else if (!accumulationParam.equals(other.accumulationParam)) { + return false; + } + if (forecastPeriodHours != other.forecastPeriodHours) { + return false; + } + if (minuendParam == null) { + if (other.minuendParam != null) { + return false; + } + } else if (!minuendParam.equals(other.minuendParam)) { + return false; + } + if (subtrahendParam == null) { + if (other.subtrahendParam != null) { + return false; + } + } else if (!subtrahendParam.equals(other.subtrahendParam)) { + return false; + } + return true; + } +} diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/precipitation/PrecipAccumPostProcessor.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/precipitation/PrecipAccumPostProcessor.java new file mode 100644 index 0000000000..790dd5edbd --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/decoderpostprocessors/precipitation/PrecipAccumPostProcessor.java @@ -0,0 +1,479 @@ +/** + * 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. + **/ +package com.raytheon.edex.plugin.grib.decoderpostprocessors.precipitation; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.xml.bind.JAXBException; + +import com.raytheon.edex.plugin.grib.decoderpostprocessors.DecoderPostProcessor; +import com.raytheon.edex.plugin.grib.decoderpostprocessors.GribPostProcessor; +import com.raytheon.edex.plugin.grib.exception.GribException; +import com.raytheon.uf.common.dataplugin.PluginException; +import com.raytheon.uf.common.dataplugin.grid.GridConstants; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; +import com.raytheon.uf.common.localization.IPathManager; +import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; +import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; +import com.raytheon.uf.common.localization.LocalizationFile; +import com.raytheon.uf.common.localization.PathManagerFactory; +import com.raytheon.uf.common.localization.exception.LocalizationException; +import com.raytheon.uf.common.parameter.Parameter; +import com.raytheon.uf.common.parameter.lookup.ParameterLookup; +import com.raytheon.uf.common.serialization.JAXBManager; +import com.raytheon.uf.common.serialization.SerializationException; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.common.time.TimeRange; +import com.raytheon.uf.edex.database.DataAccessLayerException; +import com.raytheon.uf.edex.database.query.DatabaseQuery; +import com.raytheon.uf.edex.plugin.grid.dao.GridDao; + +/** + * Configurable grib post processor for accumulating precipitation. + * + *
+ * + * SOFTWARE HISTORY + * + * Date Ticket# Engineer Description + * ------------ ---------- ----------- -------------------------- + * Sep 28, 2015 3756 nabowle Initial creation + * + *+ * + * @author nabowle + * @version 1.0 + */ +public class PrecipAccumPostProcessor extends DecoderPostProcessor { + + private static final GridRecord[] EMPTY_ARR = new GridRecord[0]; + + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(GribPostProcessor.class); + + /** + * The configured set of Accumulation Configurations. Note: This is not + * thread safe if modified. + */ + private static final AccumulationConfigs configs = initConfigs(); + + /** + * Constructor. + * + * @throws JAXBException + */ + public PrecipAccumPostProcessor() { + super(); + } + + @Override + public GridRecord[] process(GridRecord record) throws GribException { + if (configs == null) { + return EMPTY_ARR; + } + + return generatePrecipGrids(record); + } + + /** + * Generates precipitation grids for a record. If no records can be + * generated, an empty array is returned. + * + * @param record + * The record. + * @return The generated precipitation grids, if any. + * @throws GribException + */ + private GridRecord[] generatePrecipGrids(GridRecord record) + throws GribException { + List