Merge tag 'OB_15.1.1-18' into omaha_15.1.1

15.1.1-18


Former-commit-id: 9caee5d030e5fd26649c556fca072a059373527a
This commit is contained in:
Steve Harris 2015-06-16 08:26:45 -05:00
commit 12b9ebe84d
9 changed files with 309 additions and 25 deletions

View file

@ -37,10 +37,11 @@ import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.viz.core.localization.CAVELocalizationAdapter; import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
/** /**
* TODO Add Description * A {@link BooleanFieldEditor} which adds a button that can be used to
* synchronize localization files with the server.
* *
* <pre> * <pre>
* *
@ -48,7 +49,8 @@ import com.raytheon.uf.viz.core.localization.CAVELocalizationAdapter;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 22, 2011 bsteffen Initial creation * Nov 22, 2011 bsteffen Initial creation
* May 29, 2015 4532 bsteffen Notify the preference store when sync is running.
* *
* </pre> * </pre>
* *
@ -75,8 +77,9 @@ public class SyncLocalizationEditor extends BooleanFieldEditor {
@Override @Override
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
IPathManager pathManager = PathManagerFactory getPreferenceStore().firePropertyChangeEvent(ThinClientPreferenceConstants.P_SYNC_REMOTE_LOCALIZATION,
.getPathManager(new CAVELocalizationAdapter()); false, true);
IPathManager pathManager = PathManagerFactory.getPathManager();
LocalizationType[] types = { LocalizationType.CAVE_CONFIG, LocalizationType[] types = { LocalizationType.CAVE_CONFIG,
LocalizationType.CAVE_STATIC, LocalizationType.CAVE_STATIC,
LocalizationType.COMMON_STATIC }; LocalizationType.COMMON_STATIC };
@ -105,6 +108,8 @@ public class SyncLocalizationEditor extends BooleanFieldEditor {
System.out.println("Time to download " + type + ": " System.out.println("Time to download " + type + ": "
+ (endTime - startTime) + "ms"); + (endTime - startTime) + "ms");
} }
getPreferenceStore().firePropertyChangeEvent(ThinClientPreferenceConstants.P_SYNC_REMOTE_LOCALIZATION,
true, false);
monitor.done(); monitor.done();
return Status.OK_STATUS; return Status.OK_STATUS;
} }

View file

@ -25,6 +25,7 @@ import java.util.Date;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.IPropertyChangeListener;
@ -53,6 +54,7 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
* Aug 9, 2011 njensen Initial creation * Aug 9, 2011 njensen Initial creation
* Aug 13, 2013 2033 mschenke Changed to search all plugins when * Aug 13, 2013 2033 mschenke Changed to search all plugins when
* CAVE_STATIC BASE context searched * CAVE_STATIC BASE context searched
* May 29, 2015 4532 bsteffen Always use super when sync job is running.
* *
* </pre> * </pre>
* *
@ -63,6 +65,12 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
public class ThinClientLocalizationAdapter extends CAVELocalizationAdapter public class ThinClientLocalizationAdapter extends CAVELocalizationAdapter
implements IPropertyChangeListener { implements IPropertyChangeListener {
/**
* Whenever there is a sync job running, always call super to allow it to go
* to the server.
*/
private final AtomicInteger syncJobsRunning = new AtomicInteger(0);
private boolean useRemoteFiles = true; private boolean useRemoteFiles = true;
public ThinClientLocalizationAdapter() { public ThinClientLocalizationAdapter() {
@ -83,6 +91,10 @@ public class ThinClientLocalizationAdapter extends CAVELocalizationAdapter
@Override @Override
public void retrieve(LocalizationFile file) public void retrieve(LocalizationFile file)
throws LocalizationOpFailedException { throws LocalizationOpFailedException {
if (syncJobsRunning.get() > 0) {
super.retrieve(file);
return;
}
try { try {
File localFile = file.getFile(false); File localFile = file.getFile(false);
if (localFile.exists() == false || localFile.length() == 0) { if (localFile.exists() == false || localFile.length() == 0) {
@ -91,8 +103,15 @@ public class ThinClientLocalizationAdapter extends CAVELocalizationAdapter
} catch (LocalizationOpFailedException e) { } catch (LocalizationOpFailedException e) {
throw e; throw e;
} catch (LocalizationException e) { } catch (LocalizationException e) {
// Ignore exception /*
e.printStackTrace(); * At the time of this writing, nothing will actually throw any
* LocalizationException other than LocalizationOpFailedException.
* However since LocalizationFile.getFile(boolean) has a method
* signature indicating it could throw any LocalizationException
* this code should be able to handle any LocalizationException in
* case the implementation of getFile changes in the future.
*/
throw new LocalizationOpFailedException(e);
} }
} }
@ -108,7 +127,7 @@ public class ThinClientLocalizationAdapter extends CAVELocalizationAdapter
public ListResponse[] listDirectory(LocalizationContext[] contexts, public ListResponse[] listDirectory(LocalizationContext[] contexts,
String path, boolean recursive, boolean filesOnly) String path, boolean recursive, boolean filesOnly)
throws LocalizationOpFailedException { throws LocalizationOpFailedException {
if (useRemoteFiles) { if (shouldUseRemoteFiles()) {
return super.listDirectory(contexts, path, recursive, filesOnly); return super.listDirectory(contexts, path, recursive, filesOnly);
} else { } else {
@ -164,7 +183,7 @@ public class ThinClientLocalizationAdapter extends CAVELocalizationAdapter
public ListResponse[] getLocalizationMetadata( public ListResponse[] getLocalizationMetadata(
LocalizationContext[] context, String fileName) LocalizationContext[] context, String fileName)
throws LocalizationOpFailedException { throws LocalizationOpFailedException {
if (useRemoteFiles) { if (shouldUseRemoteFiles()) {
return super.getLocalizationMetadata(context, fileName); return super.getLocalizationMetadata(context, fileName);
} else { } else {
List<ListResponse> responses = new ArrayList<ListResponse>( List<ListResponse> responses = new ArrayList<ListResponse>(
@ -193,19 +212,30 @@ public class ThinClientLocalizationAdapter extends CAVELocalizationAdapter
@Override @Override
public boolean exists(LocalizationFile file) { public boolean exists(LocalizationFile file) {
if (useRemoteFiles) { if (shouldUseRemoteFiles()) {
return super.exists(file); return super.exists(file);
} else { } else {
return file.getFile().exists(); return file.getFile().exists();
} }
} }
private boolean shouldUseRemoteFiles() {
return useRemoteFiles || syncJobsRunning.get() > 0;
}
@Override @Override
public void propertyChange(PropertyChangeEvent event) { public void propertyChange(PropertyChangeEvent event) {
if (ThinClientPreferenceConstants.P_DISABLE_REMOTE_LOCALIZATION if (ThinClientPreferenceConstants.P_DISABLE_REMOTE_LOCALIZATION
.equals(event.getProperty())) { .equals(event.getProperty())) {
useRemoteFiles = !Boolean.valueOf(String.valueOf(event useRemoteFiles = !Boolean.valueOf(String.valueOf(event
.getNewValue())); .getNewValue()));
} else if (ThinClientPreferenceConstants.P_SYNC_REMOTE_LOCALIZATION.equals(event.getProperty())) {
boolean sync = Boolean.valueOf(String.valueOf(event.getNewValue()));
if (sync) {
syncJobsRunning.incrementAndGet();
} else {
syncJobsRunning.decrementAndGet();
}
} }
} }

View file

@ -19,6 +19,8 @@
**/ **/
package com.raytheon.uf.viz.thinclient.preferences; package com.raytheon.uf.viz.thinclient.preferences;
import org.eclipse.jface.preference.IPreferenceStore;
/** /**
* Preference constants for the thin client mode * Preference constants for the thin client mode
* *
@ -32,6 +34,8 @@ package com.raytheon.uf.viz.thinclient.preferences;
* Jan 14, 2013 1469 bkowal The hdf5 data directory is no longer a preference constant. * Jan 14, 2013 1469 bkowal The hdf5 data directory is no longer a preference constant.
* Feb 04, 2014 2704 njensen Consolidate services and pypies proxy addresses * Feb 04, 2014 2704 njensen Consolidate services and pypies proxy addresses
* Jun 24, 2014 3236 njensen Added proxy address options * Jun 24, 2014 3236 njensen Added proxy address options
* May 29, 2015 4532 bsteffen Add sync localization option.
*
* *
* </pre> * </pre>
* *
@ -61,6 +65,19 @@ public class ThinClientPreferenceConstants {
public static String P_DISABLE_REMOTE_LOCALIZATION = "disableRemoteLocalization"; public static String P_DISABLE_REMOTE_LOCALIZATION = "disableRemoteLocalization";
/**
* This preference is not stored but is used to send notification through
* the preference store that the {@link #P_CACHE_LOCALIZATION} and
* {@link #P_DISABLE_REMOTE_LOCALIZATION} should be temporarily ignored so
* that the localization files can be synchronized with the server. Before
* performing synchronization, an event should be fired using
* {@link IPreferenceStore#firePropertyChangeEvent(String, Object, Object)}
* with the preference name as {@link #P_SYNC_REMOTE_LOCALIZATION} and a
* newValue of true. When synchronization has completed another event should
* be fired with a newValue of false.
*/
public static String P_SYNC_REMOTE_LOCALIZATION = "syncRemoteFiles";
public static String P_DISABLE_MENU_TIMES = "disableMenuTimes"; public static String P_DISABLE_MENU_TIMES = "disableMenuTimes";
public static String P_DISABLE_JMS = "disableJms"; public static String P_DISABLE_JMS = "disableJms";

View file

@ -17,6 +17,13 @@ then
echo "CAVE and/or gfeclient not installed on this workstation ..exiting" echo "CAVE and/or gfeclient not installed on this workstation ..exiting"
exit 1 exit 1
else else
$_GFECLI $_MODULE "$@" CONFDIR=${HOME}/.runProc-$(hostname)-$$
cleanup() {
rm -rf "$CONFDIR"
}
mkdir -p "$CONFDIR" || exit 1
trap cleanup EXIT
$_GFECLI -configuration $CONFDIR $_MODULE "$@"
fi fi

View file

@ -166,6 +166,7 @@ import com.vividsolutions.jts.geom.Polygon;
* not be as expected if percentage/area is different between the two products. But the * not be as expected if percentage/area is different between the two products. But the
* chance for that to occur is trivial. * chance for that to occur is trivial.
* May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging. * May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging.
* Jun 05, 2015 DR 17428 D. Friedman Fixed duration-related user interface issues. Added duration logging.
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -1095,15 +1096,25 @@ public class WarngenDialog extends CaveSWTDialog implements
* @param durations * @param durations
*/ */
public void setDurations(int[] durations) { public void setDurations(int[] durations) {
String[] durList = new String[durations.length]; ArrayList<String> durList = new ArrayList<String>(durations.length);
boolean isDefaultDurationInList = false;
durationList.removeAll(); durationList.removeAll();
for (int i = 0; i < durations.length; i++) { for (int i = 0; i < durations.length; i++) {
if (defaultDuration != null
&& defaultDuration.minutes == durations[i]) {
isDefaultDurationInList = true;
}
DurationData data = new DurationData(durations[i]); DurationData data = new DurationData(durations[i]);
durationList.setData(data.displayString, data); durationList.setData(data.displayString, data);
durList[i] = data.displayString; durList.add(data.displayString);
}
// Add the default duration to the list if what was missing
if (! isDefaultDurationInList && defaultDuration != null) {
durationList.setData(defaultDuration.displayString, defaultDuration);
durList.add(0, defaultDuration.displayString);
} }
durationList.setItems(durList); durationList.setItems(durList.toArray(new String[durList.size()]));
} }
/** /**
@ -1179,6 +1190,8 @@ public class WarngenDialog extends CaveSWTDialog implements
long t0 = System.currentTimeMillis(); long t0 = System.currentTimeMillis();
try { try {
monitor.beginTask("Generating product", 1); monitor.beginTask("Generating product", 1);
statusHandler.debug("using startTime " + startTime.getTime()
+ " endTime " + endTime.getTime());
String result = TemplateRunner.runTemplate( String result = TemplateRunner.runTemplate(
warngenLayer, startTime.getTime(), warngenLayer, startTime.getTime(),
endTime.getTime(), selectedBullets, endTime.getTime(), selectedBullets,
@ -1328,9 +1341,10 @@ public class WarngenDialog extends CaveSWTDialog implements
* Action for Reset button * Action for Reset button
*/ */
private void resetPressed() { private void resetPressed() {
statusHandler.debug("resetPressed");
int durationToUse = getSelectedDuration();
warngenLayer.resetState(); warngenLayer.resetState();
warngenLayer.getStormTrackState().duration = ((DurationData) durationList restoreDuration(durationToUse);
.getData(durationList.getItem(durationList.getSelectionIndex()))).minutes;
durationList.setEnabled(warngenLayer.getConfiguration() durationList.setEnabled(warngenLayer.getConfiguration()
.isEnableDuration()); .isEnableDuration());
if (lineOfStorms.getSelection()) { if (lineOfStorms.getSelection()) {
@ -1366,6 +1380,7 @@ public class WarngenDialog extends CaveSWTDialog implements
warngenLayer.resetInitialFrame(); warngenLayer.resetInitialFrame();
warngenLayer.setWarningAction(null); warngenLayer.setWarningAction(null);
instructionsLabel.setText("Instructions:"); instructionsLabel.setText("Instructions:");
changeStartEndTimes();
warngenLayer.issueRefresh(); warngenLayer.issueRefresh();
} }
@ -1430,8 +1445,11 @@ public class WarngenDialog extends CaveSWTDialog implements
* Select one storm * Select one storm
*/ */
private void selectOneStorm() { private void selectOneStorm() {
statusHandler.debug("selectOneStorm");
if (warngenLayer.state.followupData == null) { if (warngenLayer.state.followupData == null) {
int savedDuration = warngenLayer.getStormTrackState().duration;
warngenLayer.resetState(); warngenLayer.resetState();
restoreDuration(savedDuration);
warngenLayer.reset("oneStorm"); warngenLayer.reset("oneStorm");
warngenLayer.clearWarningGeometries(); warngenLayer.clearWarningGeometries();
warngenLayer.getStormTrackState().dragMeLine = null; warngenLayer.getStormTrackState().dragMeLine = null;
@ -1447,8 +1465,11 @@ public class WarngenDialog extends CaveSWTDialog implements
* Select line of storms * Select line of storms
*/ */
private void selectLineOfStorms() { private void selectLineOfStorms() {
statusHandler.debug("selectLineOfStorms");
if (warngenLayer.state.followupData == null) { if (warngenLayer.state.followupData == null) {
int savedDuration = warngenLayer.getStormTrackState().duration;
warngenLayer.resetState(); warngenLayer.resetState();
restoreDuration(savedDuration);
warngenLayer.reset("lineOfStorms"); warngenLayer.reset("lineOfStorms");
warngenLayer.clearWarningGeometries(); warngenLayer.clearWarningGeometries();
warngenLayer.getStormTrackState().dragMeLine = null; warngenLayer.getStormTrackState().dragMeLine = null;
@ -1596,6 +1617,7 @@ public class WarngenDialog extends CaveSWTDialog implements
* - The button that has been clicked * - The button that has been clicked
*/ */
private void changeTemplate(String templateName) { private void changeTemplate(String templateName) {
statusHandler.debug("changeTemplate: " + templateName);
String lastAreaSource = warngenLayer.getConfiguration() String lastAreaSource = warngenLayer.getConfiguration()
.getHatchedAreaSource().getAreaSource(); .getHatchedAreaSource().getAreaSource();
@ -1689,11 +1711,11 @@ public class WarngenDialog extends CaveSWTDialog implements
} }
protected void recreateDurations(Combo durList) { protected void recreateDurations(Combo durList) {
setDurations(warngenLayer.getConfiguration().getDurations());
if (warngenLayer.getConfiguration().getDefaultDuration() != 0) { if (warngenLayer.getConfiguration().getDefaultDuration() != 0) {
setDefaultDuration(warngenLayer.getConfiguration() setDefaultDuration(warngenLayer.getConfiguration()
.getDefaultDuration()); .getDefaultDuration());
} }
setDurations(warngenLayer.getConfiguration().getDurations());
durList.setText(defaultDuration.displayString); durList.setText(defaultDuration.displayString);
endTime = DurationUtil.calcEndTime(startTime, defaultDuration.minutes); endTime = DurationUtil.calcEndTime(startTime, defaultDuration.minutes);
end.setText(df.format(endTime.getTime())); end.setText(df.format(endTime.getTime()));
@ -1754,6 +1776,7 @@ public class WarngenDialog extends CaveSWTDialog implements
FollowupData data = (FollowupData) updateListCbo FollowupData data = (FollowupData) updateListCbo
.getData(updateListCbo.getItem(updateListCbo .getData(updateListCbo.getItem(updateListCbo
.getSelectionIndex())); .getSelectionIndex()));
statusHandler.debug("updateListSelected: " + (data != null ? data.getDisplayString() : "(null)"));
Mode currMode = warngenLayer.getStormTrackState().mode; Mode currMode = warngenLayer.getStormTrackState().mode;
if (data != null) { if (data != null) {
// does not refesh if user selected already highlighted option // does not refesh if user selected already highlighted option
@ -1863,6 +1886,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|| (action == WarningAction.EXT)) { || (action == WarningAction.EXT)) {
recreateDurations(durationList); recreateDurations(durationList);
} }
} else {
statusHandler.debug("updateListSelected");
} }
updateListCbo.pack(true); updateListCbo.pack(true);
productType.layout(); productType.layout();
@ -1895,6 +1920,7 @@ public class WarngenDialog extends CaveSWTDialog implements
} }
private void changeSelected() { private void changeSelected() {
statusHandler.debug("changeSelected");
if ((validPeriodDlg == null) || validPeriodDlg.isDisposed()) { if ((validPeriodDlg == null) || validPeriodDlg.isDisposed()) {
validPeriodDlg = new ValidPeriodDialog(shell, startTime, endTime); validPeriodDlg = new ValidPeriodDialog(shell, startTime, endTime);
validPeriodDlg.setCloseCallback(new ICloseCallback() { validPeriodDlg.setCloseCallback(new ICloseCallback() {
@ -1902,6 +1928,7 @@ public class WarngenDialog extends CaveSWTDialog implements
@Override @Override
public void dialogClosed(Object returnValue) { public void dialogClosed(Object returnValue) {
int duration = (Integer) returnValue; int duration = (Integer) returnValue;
statusHandler.debug("changeSelected.dialogClosed: " + duration);
if (duration != -1) { if (duration != -1) {
durationList.setEnabled(false); durationList.setEnabled(false);
endTime.add(Calendar.MINUTE, duration); endTime.add(Calendar.MINUTE, duration);
@ -1926,6 +1953,7 @@ public class WarngenDialog extends CaveSWTDialog implements
private void durationSelected() { private void durationSelected() {
String selection = durationList.getItem(durationList String selection = durationList.getItem(durationList
.getSelectionIndex()); .getSelectionIndex());
statusHandler.debug("durationSelected: " + selection);
endTime = DurationUtil.calcEndTime(extEndTime != null ? extEndTime endTime = DurationUtil.calcEndTime(extEndTime != null ? extEndTime
: startTime, : startTime,
((DurationData) durationList.getData(selection)).minutes); ((DurationData) durationList.getData(selection)).minutes);
@ -2292,8 +2320,7 @@ public class WarngenDialog extends CaveSWTDialog implements
updatePolygon(newWarn); updatePolygon(newWarn);
recreateDurations(durationList); recreateDurations(durationList);
int duration = ((DurationData) durationList.getData(durationList int duration = getSelectedDuration();
.getItem(durationList.getSelectionIndex()))).minutes;
warngenLayer.getStormTrackState().duration = duration; warngenLayer.getStormTrackState().duration = duration;
startTime = TimeUtil.newCalendar(); startTime = TimeUtil.newCalendar();
@ -2615,4 +2642,39 @@ public class WarngenDialog extends CaveSWTDialog implements
return defaultTemplate; return defaultTemplate;
} }
private void restoreDuration(int duration) {
warngenLayer.getStormTrackState().duration =
warngenLayer.getStormTrackState().newDuration = duration;
warngenLayer.getStormTrackState().geomChanged = true;
}
private int getSelectedDuration() {
Exception excToReport= null;
DurationData data = null;
try {
data = (DurationData) durationList.getData(durationList
.getItem(durationList.getSelectionIndex()));
} catch (RuntimeException e) {
excToReport = e;
}
int duration;
if (data != null) {
duration = data.minutes;
} else {
try {
duration = warngenLayer.getConfiguration().getDefaultDuration();
} catch (RuntimeException e) {
if (excToReport == null) {
excToReport = e;
}
duration = 30;
}
statusHandler.handle(Priority.WARN,
"Unable to determine duration from selection in WarnGen dialog. Using default of "
+ duration + " minutes.", excToReport);
}
statusHandler.debug("selected duration is " + duration);
return duration;
}
} }

View file

@ -0,0 +1,154 @@
package gov.noaa.nws.crh.edex.grib.decoderpostprocessor;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.raytheon.edex.plugin.grib.decoderpostprocessors.ThreeHrPrecipGridProcessor;
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 3-hr precipitation grids from
* the alternating (3-hr, 6-hr, 3-hr, 3-hr, 6-hr, etc.) precip grids in the
* GFS20 output.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jun 08, 2015 M. Foster Initial Creation
*
*
* </pre>
*
* @author matthew.foster
* @version 1.0
*/
public class GFS20PostProcessor 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("TP6hr")) {
return super.process(record);
}
return new GridRecord[] { record };
}
/**
* Retrieves a List of GridRecord via DAO query for the given datasetId, parm
* and refTime.
*
* @param datasetId
* The datasetId from which to retrieve the GridRecords
* @param parm
* The parameter for which to retrieve GridRecords
* @param refTime
* The reference (cycle) time for the aforementioned datasetId
* @return
* @throws GribException
*/
@SuppressWarnings("unchecked")
protected List<GridRecord> getPrecipInventory(String datasetId, String parm,
Date refTime) throws GribException {
GridDao dao = null;
try {
dao = new GridDao();
} catch (PluginException e) {
throw new GribException("Error instantiating grib dao!", e);
}
DatabaseQuery query = new DatabaseQuery(GridRecord.class);
query.addQueryParam(GridConstants.PARAMETER_ABBREVIATION, parm);
query.addQueryParam(GridConstants.DATASET_ID, datasetId);
query.addQueryParam("dataTime.refTime", refTime);
query.addOrder("dataTime.fcstTime", true);
try {
return (List<GridRecord>) dao.queryByCriteria(query);
} catch (DataAccessLayerException e) {
throw new GribException(
"Error getting Precip inventory for "+datasetId, e);
}
}
/**
* Generates the 3 hour accumulated grid by taking the difference of the
* current 6-hr accumulation and the previous 3-hr accumulation.
* This function will look in the inventory and generate any 3-hr grids
* that can be generated.
*
* @param record
* The grib record for which to generate the 3 hour accumulated
* precipitation grid
* @return The generated 3-hr precipitation grids
* @throws GribException
*/
protected synchronized GridRecord[] generate3hrPrecipGrids(GridRecord record)
throws GribException {
// The current 6-hr precipitation grid inventory in the database
List<GridRecord> precip6hrInventory = getPrecipInventory(record.getDatasetId(),
"TP6hr", record.getDataTime().getRefTime());
// The current 3-hr precipitation grid inventory in the database
List<GridRecord> precip3hrInventory = getPrecipInventory(record.getDatasetId(),
"TP3hr", record.getDataTime().getRefTime());
// Make a list of the 3-hr forecast times
List<Integer> precip3hrTimes = new ArrayList<Integer>();
for (int i=0; i < precip3hrInventory.size(); i++) {
precip3hrTimes.add(precip3hrInventory.get(i)
.getDataTime().getFcstTime());
}
// Adds the current record to the precip inventory
float[] currentData = (float[]) record.getMessageData();
record.setMessageData(currentData);
precip6hrInventory.add(record);
// Examine each grid in the inventory and generate the 3hr precipitation
// grid if possible
List<GridRecord> generatedRecords = new ArrayList<GridRecord>();
for (int i = 0; i < precip6hrInventory.size(); i++) {
// Check if the 3hr precipitation grid has already been produced
if (!precip3hrTimes.contains(precip6hrInventory.get(i)
.getDataTime().getFcstTime())) {
// If the precipitation grid has not been produced, generate it
List<GridRecord> generated3hrPrecips = generate3hrPrecip(
precip6hrInventory.get(i), precip3hrInventory);
for (GridRecord newRecord : generated3hrPrecips) {
// Add the generated grid to the current inventory
if (newRecord != null) {
precip3hrTimes.add(newRecord.getDataTime()
.getFcstTime());
generatedRecords.add(newRecord);
}
}
}
}
return generatedRecords.toArray(new GridRecord[] {});
}
/**
* {@inheritDoc}
*/
@Override
protected void calculatePrecipValues(float[] inventoryData, float[] newData) {
for (int i = 0; i < inventoryData.length; i++) {
newData[i] = newData[i] - inventoryData[i];
if (newData[i] < 0) {
newData[i] = 0;
}
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -1516,12 +1516,11 @@ class SectionCommon():
pass pass
# If this is the "default" case # If this is the "default" case
if self._tr == "default" and len(statements) > 0: #if self._tr == "default" and len(statements) > 0:
#
if elementName in ["Wind", "Storm Surge"]: # if elementName in ["Wind", "Storm Surge"]:
if statements[0].find("If realized, ") == -1: # if statements[0].find("If realized, ") == -1:
statements[0] = "If realized, " + statements[0] + \ # statements[0] = "If realized, " + statements[0][0].lower() + statements[0][1:]
statements[0][1:]
return statements return statements

View file

@ -111,6 +111,12 @@
<modelName>RUC130</modelName> <modelName>RUC130</modelName>
<processorName>RUC130GribPostProcessor</processorName> <processorName>RUC130GribPostProcessor</processorName>
</postProcessedModel> </postProcessedModel>
<!-- Post processor definition for the GFS20 model -->
<postProcessedModel>
<modelName>GFS215|GFS217|GFS20-*</modelName>
<processorName>gov.noaa.nws.crh.edex.grib.decoderpostprocessor.GFS20PostProcessor</processorName>
</postProcessedModel>
</postProcessedModels> </postProcessedModels>