From afae4700a678ac99b3e26001bc69b8693f0e6ef7 Mon Sep 17 00:00:00 2001 From: "Loubna.Bousaidi" Date: Tue, 29 Apr 2014 21:09:34 +0000 Subject: [PATCH] ASM #511 changes to transmit_rfc_bias calls from MPE Change-Id: I40c582b8d2c97e16593b8abbf8a8051e21c93004 Former-commit-id: d41e489cedc162b8f29efcb17a592c1126141b58 [formerly a43ad03838d53d3b9688b48851f41a1af6b043f6] Former-commit-id: 8c15d1f1247eca02ef02e04b11dfa8705aa63993 --- .../viz/mpe/ui/actions/SaveBestEstimate.java | 25 +++++++++++++------ .../raytheon/viz/mpe/core/RegenHrFlds.java | 20 +++++++++++++++ .../precip_proc/bin/rerun_mpe_fieldgen | 7 +++++- .../precip_proc/bin/transmit_rfc_bias | 4 +-- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/SaveBestEstimate.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/SaveBestEstimate.java index 0a0ff218c9..342cf0281c 100644 --- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/SaveBestEstimate.java +++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/SaveBestEstimate.java @@ -22,6 +22,7 @@ package com.raytheon.viz.mpe.ui.actions; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; +import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; import java.util.Iterator; @@ -58,6 +59,8 @@ import com.raytheon.viz.mpe.ui.MPEDisplayManager; * Dec 11, 2012 mschenke Initial creation * Feb 2, 2014 16201 snaples Added saved data flag support * + * Apr29, 2014 16308 lbousaidi transmit RFC Bias when an hour + * MPE is saved via the GUI. * * * @author mschenke @@ -256,13 +259,21 @@ public class SaveBestEstimate { boolean transmit_bias_on_save = appsDefaults.getBoolean( "transmit_bias_on_save", true); if (transmit_rfc_bias && transmit_bias_on_save) { - // sprintf ( command_string, "%s/transmit_rfc_bias %s", - // precip_proc_bin_dir, cdate ); - // UFStatus.handle(Priority.VERBOSE, Activator.PLUGIN_ID, - // StatusConstants.CATEGORY_MPE, null, - // String.format("Invoking transmit_rfc_bias script using command:\n" - // "%s\n", command_string )); - // system ( command_string ); + + Date currentDate = MPEDisplayManager.getCurrent().getCurrentEditDate(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHH"); + String transmitDate = formatter.format(currentDate); + String scriptDir = appsDefaults.getToken("pproc_bin"); + String scriptName = "transmit_rfc_bias"; + ProcessBuilder pb = new ProcessBuilder(scriptDir + "/" + scriptName, + transmitDate); + try { + pb.start(); + } catch (IOException e) { + e.printStackTrace(); + } + + } MPEDisplayManager.getCurrent().setSavedData(true); } diff --git a/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/core/RegenHrFlds.java b/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/core/RegenHrFlds.java index 0bbe63a515..a9883bba40 100644 --- a/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/core/RegenHrFlds.java +++ b/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/core/RegenHrFlds.java @@ -19,6 +19,7 @@ **/ package com.raytheon.viz.mpe.core; +import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; @@ -38,6 +39,7 @@ import com.raytheon.uf.common.dataplugin.shef.tables.Hourlypp; import com.raytheon.uf.common.dataplugin.shef.tables.Pseudogageval; import com.raytheon.uf.common.dataplugin.shef.tables.Rawpp; import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants; +import com.raytheon.uf.common.ohd.AppsDefaults; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.viz.hydrocommon.whfslib.GagePPOptions; import com.raytheon.viz.hydrocommon.whfslib.GagePPOptions.shef_dup; @@ -56,6 +58,8 @@ import com.raytheon.viz.mpe.core.MPEDataManager.MPEGageData; * Jan 02, 2013 15565 snaples Fixed problem with wrong time being sent to mpe_fieldgen * Mar 14, 2013 1457 mpduff Fixed memory leak. * Jun 18, 2013 16053 snaples Removed check for Radar Edit flag + * Apr 24, 2014 16308 lbousaidi added the ability to send RFC Bias across the WAN + * after Mpe fieldgen run. * * * @author snaples @@ -293,6 +297,22 @@ public class RegenHrFlds { e.printStackTrace(); } + /*-------------------------------------------------------------------------*/ + /* send RFC Bias across the WAN if the tokens TRANSMIT_BIAS_ON_RERUN + * and MPE_TRANSMIT_BIAS are both ON. The script rerun_mpe_fieldgen + * only run transmit_rfc_bias but it doesn't rerun mpe_fieldgen + /*-------------------------------------------------------------------------*/ + AppsDefaults appsDefaults = AppsDefaults.getInstance(); + String scriptDir = appsDefaults.getToken("pproc_bin"); + String scriptName ="rerun_mpe_fieldgen"; + String transmitRun= dr.format(datetime); + ProcessBuilder pb = new ProcessBuilder(scriptDir + "/" + scriptName ,hour, + transmitRun); + try { + pb.start(); + } catch (IOException e) { + e.printStackTrace(); + } MPEDataManager.getInstance().clearEditGages(); shell.setCursor(null); } diff --git a/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/rerun_mpe_fieldgen b/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/rerun_mpe_fieldgen index c047ad068f..8c471b9e8d 100755 --- a/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/rerun_mpe_fieldgen +++ b/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/rerun_mpe_fieldgen @@ -12,8 +12,11 @@ # This allows you to call this script from outside of ./standard/bin RUN_FROM_DIR=`dirname $0` +. $RUN_FROM_DIR/../../set_hydro_env +export MPE_TRANSMIT_BIAS=$(get_apps_defaults mpe_transmit_bias) +export TRANSMIT_BIAS_ON_RERUN=$(get_apps_defaults transmit_bias_on_rerun) +export PPROC_BIN=$(get_apps_defaults pproc_bin) -# # Transmit the RFC bias message if the user has # elected to do so on reruns. # @@ -21,6 +24,8 @@ if [[ "$MPE_TRANSMIT_BIAS" = "ON" && "$TRANSMIT_BIAS_ON_RERUN" = "YES" ]] then year=`echo $2 | cut -c5-8` monthday=`echo $2 | cut -c1-4` + hour=`echo $1` + echo $year$monthday$1 $PPROC_BIN/transmit_rfc_bias $year$monthday$1 fi diff --git a/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/transmit_rfc_bias b/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/transmit_rfc_bias index 17f2448b5a..8c0023a9cf 100755 --- a/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/transmit_rfc_bias +++ b/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/transmit_rfc_bias @@ -43,13 +43,13 @@ RUN_FROM_DIR=`dirname $0` # These lines are commented out because this script will be run # from mpe_editor using mpe_editor's environment. If this script # is run stand alone, these lines must be uncommented. -export FXA_HOME=/awips/fxa -. $FXA_HOME/readenv.sh . $RUN_FROM_DIR/../../set_hydro_env export RFC_BIAS_OUTPUT_DIR=$(get_apps_defaults rfc_bias_output_dir) export PROCESS_BIAS_LOG_DIR=$(get_apps_defaults process_bias_log_dir) export MPE_TRANSMIT_BIAS=$(get_apps_defaults mpe_transmit_bias) export PPROC_BIN=$(get_apps_defaults pproc_bin) +export FXA_LOCAL_SITE=$(get_apps_defaults fxa_local_site) +export SYS_JAVA_DIR=$(get_apps_defaults sys_java_dir) # set java classpath export CLASSPATH=$DB_DRIVER_PATH:$PPROC_BIN/bias_trans.jar