VLab Issue #3454 (OHD Dual-Pol enhancements for MPE and HPE/HPN (DCS #167,DCS #168) and PostAnalysis (DR #9784) )

Change-Id: Id96c25de545144d769309fef608c431d67d1bada

Former-commit-id: 4e4d00792d [formerly 65d2135ac2] [formerly 4e4d00792d [formerly 65d2135ac2] [formerly e42bef2a33 [formerly 1f43b57d7dffe0d1c4002ff9f1dd789a47b97734]]]
Former-commit-id: e42bef2a33
Former-commit-id: c075175e8e [formerly 593b36d722]
Former-commit-id: 1b7f762617
This commit is contained in:
Chip Gobs 2014-05-02 19:13:55 -04:00
parent f16c305ae4
commit 47068a7939
223 changed files with 35471 additions and 1574 deletions

View file

@ -82,6 +82,117 @@ public class MPEColors {
static final double precip_levels[] = { -9999.0, -8888.0, 0.00, 0.01, 0.10,
0.20, 0.30, 0.40, 0.50, 0.75, 1.00, 1.25, 1.50, 1.75, 2.00, 2.50,
3.00 };
static final String precip_bias_colors[] ={"DarkGray", "Gray", "Light Gray", "DarkBlue",
"Blue", "DarkCyan", "Cyan", "DarkGreen", "Green",
"Yellow", "Orange", "Red", "Dark Red", "Magenta", "White" };
static final double precip_bias_levels[] ={ 0.0, 0.05, 0.1, .2, .4, 0.8, 1.2, 2.0, 3.0, 4.0, 5.0, 8.0, 16.0, 32.0, 100.0};
static final String precip_diff_colors[] =
{
"GRAY30", "GRAY30",
"MAGENTA1", "MEDIUMORCHID", "DARKORCHID",
"MEDIUMBLUE", "BLUE", "DODGERBLUE", "DARKTURQUOISE",
"CYAN",
"BLACK", "BLACK",
"GREEN", "GREENYELLOW","YELLOW",
"DARKORANGE1",
"ORANGERED", "RED2", "RED3",
};
static final double precip_diff_levels[] =
{ -9999.0, -8888.0,
-10.0, -0.75, -0.5,
-.25,-0.1, -0.08, -0.06, -0.03,
-0.01, //CYAN
0.0, 0.01,
0.03,
0.06, 0.08,
0.1,0.25, 0.50
};
static final String precip_ratio_colors[] =
{
"GRAY30", "GRAY30",
"MAGENTA1", "MEDIUMORCHID", "DARKORCHID",
"BLUE", "DODGERBLUE", "DARKTURQUOISE",
"CYAN", "BLACK",
"GREEN", "GREENYELLOW","YELLOW",
"DARKORANGE1",
"ORANGERED", "RED2", "RED3",
};
static final double precip_ratio_levels[] =
{
-9999.0, -8888.0,
0.0, 0.1, 0.2, 0.3,
0.5, 0.6, 0.75,
0.95, 1.05, //between this number shows up as black
1.5, 2.0, 4.0,
6.0,
8.0, 16.0
};
/*
* static final String precip_ratio_colors[] =
{
"GRAY30", "GRAY30",
"MAGENTA1", "MEDIUMORCHID", "DARKORCHID",
"MEDIUMBLUE", "BLUE", "DODGERBLUE", "DARKTURQUOISE",
"CYAN", "BLACK",
"GREEN", "GREENYELLOW","YELLOW",
"DARKORANGE1",
"ORANGERED", "RED2", "RED3",
};
static final double precip_ratio_levels[] =
{
-9999.0, -8888.0,
0.1, 0.2, 0.3, 0.4,
0.5, 0.6, 0.75, 0.85,
0.95, 1.05, //between this number shows up as black
1.5, 2.0, 4.0,
6.0,
8.0, 16.0
};
*
*
*/
static final String prism_colors[] = { "GRAY30", "GRAY20", "GRAY10",
"DODGERBLUE1", "CYAN", "DARKGREEN", "GREEN", "GREENYELLOW",
@ -266,6 +377,86 @@ public class MPEColors {
/* Create a color use group for each of the MPE products. */
/* PRECIP_BIAS */
pColorUseSet = new NamedColorUseSet("PRECIP_BIAS", "Precip Bias",
precip_bias_levels, precip_bias_colors, "GRAY30", "GRAY10", 3600);
pColorSetGroup.add(pColorUseSet);
pColorUseSet = new NamedColorUseSet("PRECIP_DIFF", "Precip Difference",
precip_diff_levels, precip_diff_colors, "GRAY30", "GRAY30", 3600);
pColorSetGroup.add(pColorUseSet);
pColorUseSet = new NamedColorUseSet("PRECIP_RATIO", "Precip Ratio",
precip_ratio_levels, precip_ratio_colors, "GRAY30", "GRAY30", 3600);
pColorSetGroup.add(pColorUseSet);
pColorUseSet = new NamedColorUseSet("PRECIP_ACCUM", "Precip Accumulated",
precip_levels, precip_colors, "GRAY30", "GRAY30", 3600);
pColorSetGroup.add(pColorUseSet);
/* Radar Mosaic */
pColorUseSet = new NamedColorUseSet("RMOSAIC", "Radar Mosaic",
precip_levels, precip_colors, "GRAY30", "GRAY30", 3600);
pColorSetGroup.add(pColorUseSet);
/* DP Radar Mosaic */
pColorUseSet = new NamedColorUseSet("RDMOSAIC", "DP Radar Mosaic",
precip_levels, precip_colors, "GRAY30", "GRAY30", 3600);
pColorSetGroup.add(pColorUseSet);
pColorUseSet = new NamedColorUseSet("AVGRDMOSAIC", "DP Avg Radar Mosaic",
precip_levels, precip_colors, "GRAY30", "GRAY10", 3600);
pColorSetGroup.add(pColorUseSet);
pColorUseSet = new NamedColorUseSet("MAXRDMOSAIC", "DP Max Radar Mosaic",
precip_levels, precip_colors, "GRAY30", "GRAY10", 3600);
pColorSetGroup.add(pColorUseSet);
pColorUseSet = new NamedColorUseSet("BDMOSAIC", "DP Field Bias Radar Mosaic",
precip_levels, precip_colors, "GRAY30", "GRAY10", 3600);
pColorSetGroup.add(pColorUseSet);
pColorUseSet = new NamedColorUseSet("LDMOSAIC", "DP Local Bias Radar Mosaic",
precip_levels, precip_colors, "GRAY30", "GRAY10", 3600);
pColorSetGroup.add(pColorUseSet);
pColorUseSet = new NamedColorUseSet("MDMOSAIC", "DP Field Bias Multisensor Radar Mosaic",
precip_levels, precip_colors, "GRAY30", "GRAY10", 3600);
pColorSetGroup.add(pColorUseSet);
pColorUseSet = new NamedColorUseSet("MLDMOSAIC", "DP Local Bias Multisensor Radar Mosaic",
precip_levels, precip_colors, "GRAY30", "GRAY10", 3600);
pColorSetGroup.add(pColorUseSet);
pColorUseSet = new NamedColorUseSet("SRDMOSAIC", "DP Satellite Radar Mosaic",
precip_levels, precip_colors, "GRAY30", "GRAY10", 3600);
pColorSetGroup.add(pColorUseSet);
pColorUseSet = new NamedColorUseSet("SRDGMOSAIC", "DP Satellite Radar Gage Mosaic",
precip_levels, precip_colors, "GRAY30", "GRAY10", 3600);
pColorSetGroup.add(pColorUseSet);
/* Radar Mosaic */
pColorUseSet = new NamedColorUseSet("RMOSAIC", "Radar Mosaic",
precip_levels, precip_colors, "GRAY30", "GRAY10", 3600);

View file

@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
import com.raytheon.uf.common.dataplugin.shef.tables.DAARadarResult;
import com.raytheon.uf.common.dataplugin.shef.tables.Hourlypc;
import com.raytheon.uf.common.dataplugin.shef.tables.Hourlypp;
import com.raytheon.uf.common.dataplugin.shef.tables.Ingestfilter;
@ -261,5 +262,39 @@ public class IHFSDbGenerated {
return -1;
}
public static List<DAARadarResult> GetDAARadarResult(String where) {
StringBuilder query = new StringBuilder("FROM ");
query.append(DAARadarResult.class.getName());
query.append(" ");
query.append(where);
ArrayList<DAARadarResult> retVal = new ArrayList<DAARadarResult>();
try {
List<Object[]> results = DirectDbQuery.executeQuery(query
.toString(), "ihfs", QueryLanguage.HQL);
retVal.ensureCapacity(results.size());
for (Object[] item : results) {
retVal.add((DAARadarResult) item[0]);
}
} catch (VizException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return retVal;
}
public static int UpdateDAARadarResult(DAARadarResult obj) {
try {
return DirectDbQuery.saveOrUpdate(obj, "ihfs");
} catch (VizException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return -1;
}
}

View file

@ -160,7 +160,7 @@ public class GetColorValues {
+ " Colors/levels not defined for application "
+ application_name + " use_name = "
+ coloruse_name
+ " logname = user_id");
+ " user_id = " + user_id);
}
}
}

View file

@ -197,6 +197,28 @@
value="Locbias">
</parameter>
</command>
<command
commandId="com.raytheon.viz.mpe.ui.actions.setDisplayField"
label="DP Local Span"
mnemonic="L">
<parameter
name="Field"
value="LocspanDP">
</parameter>
</command>
<command
commandId="com.raytheon.viz.mpe.ui.actions.setDisplayField"
label="DP Local Bias"
mnemonic="L">
<parameter
name="Field"
value="LocbiasDP">
</parameter>
</command>
<separator
name="separator6"
visible="true">
</separator>
<command
commandId="com.raytheon.viz.mpe.ui.actions.setDisplayField"
label="Height Field"
@ -215,6 +237,42 @@
value="Index">
</parameter>
</command>
<separator
name="separator4"
visible="true">
</separator>
<command
commandId="com.raytheon.viz.mpe.ui.actions.setDisplayField"
label="Precip Difference Field"
mnemonic="L">
<parameter
name="Field"
value="precipDifferenceField">
</parameter>
</command>
<command
commandId="com.raytheon.viz.mpe.ui.actions.setDisplayField"
label="Precip Ratio Field"
mnemonic="L">
<parameter
name="Field"
value="precipRatioField">
</parameter>
</command>
<command
commandId="com.raytheon.viz.mpe.ui.actions.selectComparisonFields"
label="Select Comparison Fields"
mnemonic="C">
</command>
<command
commandId="com.raytheon.viz.mpe.ui.actions.reverseComparisonFields"
label="Reverse Comparison Fields"
mnemonic="R">
</command>
<separator
name="separator5"
visible="true">
</separator>
<dynamic
class="com.raytheon.viz.mpe.ui.BaseFieldsPopulator"
id="com.raytheon.viz.mpe.ui.baseFieldsPopulator">
@ -897,6 +955,17 @@
id="com.raytheon.viz.mpe.ui.actions.fullScreen"
name="Full Screen">
</command>
<command
id="com.raytheon.viz.mpe.ui.actions.selectComparisonFields"
name="Select Comparison Fields">
</command>
<command
id="com.raytheon.viz.mpe.ui.actions.reverseComparisonFields"
name="Reverse Comparison Fields">
</command>
<command
id="com.raytheon.viz.mpe.ui.actions.setDisplayField"
name="Set Display Field">
@ -1198,6 +1267,29 @@
</reference>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.mpe.ui.actions.SelectComparisonFields"
commandId="com.raytheon.viz.mpe.ui.actions.selectComparisonFields">
<activeWhen>
<reference
definitionId="com.raytheon.viz.inMPEActionSet">
</reference>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.mpe.ui.actions.ReverseComparisonFields"
commandId="com.raytheon.viz.mpe.ui.actions.reverseComparisonFields">
<activeWhen>
<reference
definitionId="com.raytheon.viz.inMPEActionSet">
</reference>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.mpe.ui.actions.SetDisplayField"
commandId="com.raytheon.viz.mpe.ui.actions.setDisplayField">
@ -1558,6 +1650,21 @@
name="MPEPolygonResource"
renderingOrderId="PLOT">
</resource>
<resource
class="com.raytheon.viz.mpe.ui.rsc.PAAsciiXmrgResource"
name="MA_PRECIP"
renderingOrderId="IMAGE_REGION"
resourceType="PLAN_VIEW">
</resource>
<resource
class="com.raytheon.viz.mpe.ui.rsc.PAXmrgResource"
name="MA_PRECIP"
renderingOrderId="IMAGE_REGION"
resourceType="PLAN_VIEW">
</resource>
PAAsciiXmrgResource
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">

View file

@ -0,0 +1,72 @@
package com.raytheon.viz.mpe.ui;
/**
* Keeps track of which 1-hour precip fields have been selected to be compared within the MPE Perspective.
* This selection is still "remembered" when MPE is not displaying a comparison field of either type: difference or ratio.
* <p>
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* November 2013 DCS 167 C. Gobs Initial Creation
*
* </pre>
*
*
* @author Chip Gobs
*
*/
public class ComparisonFields {
//These 2 fields are only valid when the outer DisplayFieldData object is
//either precipDifferenceField or precipRatioField
private DisplayFieldData field1 = DisplayFieldData.rMosaic;
private DisplayFieldData field2 = DisplayFieldData.rdMosaic;
public void setComparisonFields(DisplayFieldData field1, DisplayFieldData field2)
{
setField1(field1);
setField2(field2);
}
public void reverse()
{
DisplayFieldData field1 = getField1();
DisplayFieldData field2 = getField2();
setField2(field1);
setField1(field2);
}
public DisplayFieldData getField1() {
return field1;
}
public void setField1(DisplayFieldData field1) {
this.field1 = field1;
}
public DisplayFieldData getField2() {
return field2;
}
public void setField2(DisplayFieldData field2) {
this.field2 = field2;
}
public String toString()
{
StringBuffer buffer = new StringBuffer();
DisplayFieldData field1 = getField1();
DisplayFieldData field2 = getField2();
buffer.append("Field 1 = " + field1);
buffer.append(" Field 2 = " + field2);
return buffer.toString();
}
}

View file

@ -18,48 +18,86 @@ package com.raytheon.viz.mpe.ui;
*/
public enum DisplayFieldData {
rMosaic("rfcwide_rmosaic_dir", "Radar-Derived Precip"), //
avgrMosaic("rfcwide_avg_rmosaic_dir", "Average Radar-Derived Precip"), //
maxrMosaic("rfcwide_max_rmosaic_dir", "Max Radar-Derived Precip"), //
rMosaic("rfcwide_rmosaic_dir", "Radar-Derived Precip", 3600, "PRECIP_ACCUM"), //
avgrMosaic("rfcwide_avg_rmosaic_dir", "Average Radar-Derived Precip", 3600, "PRECIP_ACCUM"), //
maxrMosaic("rfcwide_max_rmosaic_dir", "Max Radar-Derived Precip", 3600, "PRECIP_ACCUM"), //
bMosaic("rfcwide_bmosaic_dir",
"Mean Field Bias Corrected Radar-Derived Precip"), //
"Mean Field Bias Corrected Radar-Derived Precip", 3600, "PRECIP_ACCUM"), //
lMosaic("rfcwide_lmosaic_dir",
"Local Bias Corrected Radar-Derived Precip (in)"), //
gageOnly("rfcwide_gageonly_dir", "Gage Only Analysis (in)"), //
satPre("rfcwide_satpre_dir", "Satellite-Derived Precip (in)"), //
"Local Bias Corrected Radar-Derived Precip (in)", 3600, "PRECIP_ACCUM"), //
gageOnly("rfcwide_gageonly_dir", "Gage Only Analysis (in)", 3600, "PRECIP_ACCUM"), //
satPre("rfcwide_satpre_dir", "Satellite-Derived Precip (in)", 3600, "PRECIP_ACCUM"), //
lsatPre("rfcwide_lsatpre_dir",
"Local Bias Corrected Satellite-Derived Precip"), //
mMosaic("rfcwide_mmosaic_dir", "Multisensor Precip"), //
mlMosaic("rfcwide_mlmosaic_dir", "Local Bias Multisensor Precip"), //
p3lMosaic("rfcwide_p3lmosaic_dir",
"P3 Local Bias Corrected Radar-Derived Precip (in)"), //
"Local Bias Corrected Satellite-Derived Precip", 3600, "PRECIP_ACCUM"), //
mMosaic("rfcwide_mmosaic_dir", "Multisensor Precip", 3600, "PRECIP_ACCUM"), //
mlMosaic("rfcwide_mlmosaic_dir", "Local Bias Multisensor Precip", 3600, "PRECIP_ACCUM"), //
//Dual Pol Fields
rdMosaic("mpe_rdmosaic_dir", "DP Radar Mosaic", 3600, "PRECIP_ACCUM"), //
avgrdMosaic("mpe_avgrdmosaic_dir", "DP Avg Radar Mosaic", 3600, "PRECIP_ACCUM"), //
maxrdMosaic("mpe_maxrdmosaic_dir", "DP Max Radar Mosaic", 3600, "PRECIP_ACCUM"), //
bdMosaic("mpe_bdmosaic_dir", "DP Field Bias Radar Mosaic", 3600, "PRECIP_ACCUM"), //
ldMosaic("mpe_ldmosaic_dir", "DP Local Bias Radar Mosaic", 3600, "PRECIP_ACCUM"), //
mdMosaic("mpe_mdmosaic_dir", "DP Field Bias Multisensor Radar Mosaic", 3600, "PRECIP_ACCUM"), //
mldMosaic("mpe_mldmosaic_dir", "DP Local Bias Multisensor Radar Mosaic", 3600, "PRECIP_ACCUM"), //
srdMosaic("mpe_srdmosaic_dir", "DP Satellite Radar Mosaic", 3600, "PRECIP_ACCUM"), //
srdgMosaic("mpe_srdgmosaic_dir", "DP Satellite Radar Gage Mosaic", 3600, "PRECIP_ACCUM"), //
rfcMosaic("gaq_xmrg_1hr_dir", "RFC Best Estimate Mosaic", 3600, "PRECIP_ACCUM"), //
sgMosaic("mpe_sgmosaic_dir", "Satellite Gage Mosaic (in)", 3600, "PRECIP_ACCUM"), //
srMosaic("mpe_srmosaic_dir", "Satellite Radar Mosaic (in)", 3600, "PRECIP_ACCUM"), //
srgMosaic("mpe_srgmosaic_dir", "Satellite Gage Radar Mosaic (in)", 3600, "PRECIP_ACCUM"), //
rfcbMosaic("mpe_rfcbmosaic_dir","RFC Bias Corrected Radar-Derived Precip (in)", 3600, "PRECIP_ACCUM"), //
rfcmMosaic("mpe_rfcmmosaic_dir", "RFC Multisensor Precip (in)", 3600, "PRECIP_ACCUM"), //
qmosaic("mpe_qmosaic_dir", "Q2 Radar Mosaic", 3600, "PRECIP_ACCUM"),
lqmosaic("mpe_lqmosaic_dir","Q2 Local Bias Mosaic", 3600, "PRECIP_ACCUM"),
mlqmosaic("mpe_mlqmosaic_dir", "Q2 MultiSensor Mosaic", 3600, "PRECIP_ACCUM"),
//best estimate QPE
Xmrg("rfcwide_xmrg_dir", "Best Estimate QPE (in)"), //
multiHour("", "%d hr Saved Precip Estimate For %s Ending %s (in)"), //
p3lMosaic("rfcwide_p3lmosaic_dir",
"P3 Local Bias Corrected Radar-Derived Precip (in)", 3600, "PRECIP_ACCUM"), //
localField1("mpe_localfield1_dir", "Local Field #1", 3600, "PRECIP_ACCUM"), //
localField2("mpe_localfield2_dir", "Local Field #2", 3600, "PRECIP_ACCUM"), //
localField3("mpe_localfield3_dir", "Local Field #3", 3600, "PRECIP_ACCUM"), //
//------------------------------------------------------------------
multiHour("", "%d hr Saved Precip Estimate For %s Ending %s (in)"), //
precipDifferenceField("", "Precip Difference Field", 3600, "PRECIP_DIFF"),
precipRatioField("", "Precip Ratio Field", 3600, "PRECIP_RATIO"),
Locspan("rfcwide_locspan_dir", "memory span index (local bias)", 0), //
Locbias("rfcwide_locbias_dir", "Local Bias Values", 0), //
localField1("mpe_localfield1_dir", "Local Field #1", 0), //
localField2("mpe_localfield2_dir", "Local Field #2", 0), //
localField3("mpe_localfield3_dir", "Local Field #3", 0), //
LocspanDP("mpe_locspandp_dir", "DP memory span index (local bias)", 0, "LOCSPAN"), //
LocbiasDP("mpe_locbiasdp_dir", "DP Local Bias Values", 0, "LOCBIAS"), //
Height("rfcwide_height_dir", "Height of Radar Coverage (ft) ", 0), //
Index("rfcwide_index_dir", "Radar Coverage Map (in)", 0), //
Index("rfcwide_index_dir", "Radar Coverage Map", 0), //
Prism("mpe_prism_dir", "Monthly Normal Precipitation (in)", 0), //
maxtempPrism("mpe_prism_dir", "Monthly Normal Max Temperature (F)", 0), //
mintempPrism("mpe_prism_dir", "Monthly Normal Min Temperature (F)", 0), //
rfcMosaic("gaq_xmrg_1hr_dir", "RFC Best Estimate Mosaic"), //
sgMosaic("mpe_sgmosaic_dir", "Satellite Gage Mosaic (in)"), //
srMosaic("mpe_srmosaic_dir", "Satellite Radar Mosaic (in)"), //
srgMosaic("mpe_srgmosaic_dir", "Satellite Gage Radar Mosaic (in)"), //
rfcbMosaic("mpe_rfcbmosaic_dir",
"RFC Bias Corrected Radar-Derived Precip (in)"), //
rfcmMosaic("mpe_rfcmmosaic_dir", "RFC Multisensor Precip (in)"), //
qmosaic("mpe_qmosaic_dir", "Q2 Radar Mosaic"), lqmosaic("mpe_lqmosaic_dir",
"Q2 Local Bias Mosaic"), mlqmosaic("mpe_mlqmosaic_dir",
"Q2 MultiSensor Mosaic"), subValue("", ""), //
missing("", ""), gageTriangles("rfcwide_p3lmosaic_dir", "Gage Triangles"), savelevel2(
"", "Save Level 2 Data"), qc_precipitation("",
"QC Precipitation..."), qc_temperatures("", "QC Temperatures.."), qc_freezinglevel(
"", "QC Freezing Level..."); //
subValue("", ""), //
missing("", ""),
gageTriangles("rfcwide_p3lmosaic_dir", "Gage Triangles"),
savelevel2("", "Save Level 2 Data"),
qc_precipitation("", "QC Precipitation..."),
qc_temperatures("", "QC Temperatures.."),
qc_freezinglevel("", "QC Freezing Level..."); //
// ------------------------------------------------------------
private String dirToken;
String cv_use;
@ -67,7 +105,10 @@ public enum DisplayFieldData {
private int cv_duration;
private String displayString;
private ComparisonFields comparisonFields = null;
private DisplayFieldData(String dirToken, String displayString) {
this(dirToken, displayString, 1, null);
}
@ -83,12 +124,27 @@ public enum DisplayFieldData {
this.displayString = displayString;
this.cv_duration = cv_duration;
this.cv_use = cv_use;
}
public String getDirToken() {
return dirToken;
}
public boolean isAComparisonField()
{
if ( (this.equals(precipDifferenceField)) ||
(this.equals(precipRatioField))
)
{
return true;
}
else
{
return false;
}
}
/**
* @return the cv_use
*/
@ -102,10 +158,45 @@ public enum DisplayFieldData {
public int getCv_duration() {
return cv_duration;
}
public String getFileNamePrefix()
{
return name().toUpperCase();
}
@Override
public String toString() {
return displayString;
public String toString()
{
// String header = "DisplayFieldData.toString(): ";
if (isAComparisonField())
{
ComparisonFields comparisonFields = getComparisonFields();
DisplayFieldData field1 = comparisonFields.getField1();
DisplayFieldData field2 = comparisonFields.getField2();
String fieldName1 = field1.name().toUpperCase();
String fieldName2 = field2.name().toUpperCase();
if (this.equals(DisplayFieldData.precipDifferenceField))
{
String newString = String.format("Difference field: %s - %s(in)",
fieldName1, fieldName2);
return newString;
}
else if (this.equals(DisplayFieldData.precipRatioField))
{
String newString = String.format("Ratio field: %s / %s",
fieldName1, fieldName2);
return newString;
}
return "ERROR";
}
else // not a comparison field
{
return displayString;
}
}
/**
@ -122,4 +213,24 @@ public enum DisplayFieldData {
}
return null;
}
public static DisplayFieldData fromDisplayNameString(String displayFieldData) {
for (DisplayFieldData fieldData : DisplayFieldData.values()) {
if (fieldData.displayString.equalsIgnoreCase(displayFieldData)) {
return fieldData;
}
}
return null;
}
public ComparisonFields getComparisonFields() {
return comparisonFields;
}
public void setComparisonFields(ComparisonFields comparisonFields) {
this.comparisonFields = comparisonFields;
}
}

View file

@ -80,6 +80,7 @@ import com.raytheon.viz.mpe.MPECommandConstants;
import com.raytheon.viz.mpe.MPEDateFormatter;
import com.raytheon.viz.mpe.core.MPEDataManager;
import com.raytheon.viz.mpe.core.MPEDataManager.MPERadarLoc;
import com.raytheon.viz.mpe.ui.dialogs.hourlyradar.RadarDataManager;
import com.raytheon.viz.mpe.ui.displays.MPEMapRenderableDisplay;
import com.raytheon.viz.mpe.ui.rsc.MPEFieldResource;
import com.raytheon.viz.mpe.ui.rsc.MPEFieldResourceData;
@ -132,6 +133,12 @@ public class MPEDisplayManager {
private int dqcDays = Integer.parseInt(AppsDefaults.getInstance().getToken(
"mpe_dqc_num_days"));
/** Radar Type for Radar Coverage Map Legend **/
public static enum AvailableRadarGridType
{
DUAL_POL, SINGLE_POL, SINGLE_AND_DUAL_POL, MISSING
};
/**
* @return the qpf
*/
@ -273,7 +280,16 @@ public class MPEDisplayManager {
DisplayFieldData.Xmrg, DisplayFieldData.rfcMosaic,
DisplayFieldData.rfcbMosaic, DisplayFieldData.rfcmMosaic,
DisplayFieldData.qmosaic, DisplayFieldData.lqmosaic,
DisplayFieldData.mlqmosaic, DisplayFieldData.localField1,
DisplayFieldData.mlqmosaic,
// Dual Pol fields
DisplayFieldData.rdMosaic, DisplayFieldData.avgrdMosaic,
DisplayFieldData.maxrdMosaic, DisplayFieldData.bdMosaic,
DisplayFieldData.ldMosaic,
DisplayFieldData.mdMosaic, DisplayFieldData.mldMosaic,
DisplayFieldData.srdMosaic, DisplayFieldData.srdgMosaic,
DisplayFieldData.localField1,
DisplayFieldData.localField2, DisplayFieldData.localField3 };
public static final String APPLICATION_NAME = "hmapmpe";
@ -417,6 +433,8 @@ public class MPEDisplayManager {
private final MPEFieldResourceData fieldResourceData = new MPEFieldResourceData();
private MPEFieldResource displayedFieldResource;
private ComparisonFields comparisonFields = new ComparisonFields();
private Date editTime;
@ -718,11 +736,23 @@ public class MPEDisplayManager {
*/
public void displayFieldData(DisplayFieldData fieldToDisplay,
int accumulationHrs, ArealDisplay arealDisplay) {
if (displayedField != fieldToDisplay || displayedFieldResource == null
|| accumulationHrs != displayedAccumHrs
|| arealDisplay != displayedArealDisplay) {
DisplayFieldData oldField = displayedField;
displayedField = fieldToDisplay;
//check for comparisonFields
if ( displayedField.isAComparisonField() )
{
displayedField.setComparisonFields(comparisonFields);
}
else
{
displayedField.setComparisonFields(null);
}
displayedAccumHrs = accumulationHrs;
displayedArealDisplay = arealDisplay;
ResourceList list = display.getDescriptor().getResourceList();
@ -938,14 +968,15 @@ public class MPEDisplayManager {
AppsDefaults appsDefaults = AppsDefaults.getInstance();
String dirname = appsDefaults.getToken(fieldData.getDirToken());
String cv_use = fieldData.getCv_use();
String fileNamePrefix = fieldData.getFileNamePrefix();
String prismType = null;
String dateFormatString = MPEDateFormatter.yyyyMMddHH;
switch (fieldData) {
case rfcMosaic:
cv_use += "01";
fileNamePrefix += "01";
break;
case Xmrg:
cv_use = cv_use.toLowerCase();
fileNamePrefix = fileNamePrefix.toLowerCase();
dateFormatString = MPEDateFormatter.MMddyyyyHH;
break;
case Prism:
@ -972,7 +1003,7 @@ public class MPEDisplayManager {
fname = FileUtil.join(dirname, "prism_" + prismType + "_"
+ mpe_site_id + "_" + dateString);
} else {
fname = FileUtil.join(dirname, cv_use + dateString + "z");
fname = FileUtil.join(dirname, fileNamePrefix + dateString + "z");
}
return new XmrgFile(fname);
}
@ -992,6 +1023,7 @@ public class MPEDisplayManager {
if (durationInHrs == 0) {
durationInHrs = 1;
}
ColorMapParameters params = new ColorMapParameters();
params.setFormatString("0.00");
params.setDisplayUnit(displayUnit);
@ -1059,18 +1091,25 @@ public class MPEDisplayManager {
params.setColorMapMax(params.getDataMax());
// Check for Index parameter and set labels to radar sites
if (displayField == DisplayFieldData.Index) {
// Determine and store radar type (S/D/M) for display in legend
// See getAvailableRadarGridType method in .../MPEGui/TEXT/drawMpeLegend.c
if (displayField == DisplayFieldData.Index)
{
MPERadarLoc[] radars = MPEDataManager.getInstance().getRadars()
.toArray(new MPERadarLoc[0]);
DataMappingEntry[] entries = dm.getEntries().toArray(
new DataMappingEntry[0]);
int offset = 2;
for (int i = offset; i < entries.length; ++i) {
for (int i = offset; i < entries.length; ++i)
{
int radarIdx = i - offset;
if (radarIdx < radars.length) {
if (radarIdx < radars.length)
{
entries[i].setLabel(radars[radarIdx].getId());
} else {
}
else
{
entries[i].setLabel("");
}
}
@ -1168,4 +1207,75 @@ public class MPEDisplayManager {
rsc.reloadGages();
}
}
public ComparisonFields getComparisonFields() {
return comparisonFields;
}
public void setComparisonFields(ComparisonFields comparisonFields) {
this.comparisonFields = comparisonFields;
}
public AvailableRadarGridType getAvailableRadarType(String radId) {
// get radar type (SINGLE_POL/DUAL_POL/MISSING)
// check for DAA radar in DAARadarResult table - if found then return "DUAL_POL"
// else check for DPA radar in RWRadarResult table - if found then return "SINGLE_POL"
// else return "MISSING" - this is the default value
AvailableRadarGridType type = AvailableRadarGridType.MISSING;
Date dateTime = getCurrentDisplayedDate();
int available;
boolean dualPolAvailable = false;
boolean singlePolAvailable = false;
RadarDataManager radarDataManager = RadarDataManager.getInstance();
try
{
available = radarDataManager.getAvailableRadarDP(radId, dateTime);
if(available == 0 || available == 2)
{
dualPolAvailable = true;
}
available = radarDataManager.getAvailableRadarSP(radId, dateTime);
if(available == 0 || available == 2)
{
singlePolAvailable = true;
}
}
catch (VizException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
if (singlePolAvailable)
{
if (dualPolAvailable)
{
type = AvailableRadarGridType.SINGLE_AND_DUAL_POL;
}
else
{
type = AvailableRadarGridType.SINGLE_POL;
}
}
else if (dualPolAvailable)
{
type = AvailableRadarGridType.DUAL_POL;
}
else
{
type = AvailableRadarGridType.MISSING;
}
return type;
}
}

View file

@ -55,8 +55,21 @@ public class PrecipFieldsPopulator extends FieldsPopulator {
DisplayFieldData.srMosaic, DisplayFieldData.sgMosaic,
DisplayFieldData.srgMosaic, DisplayFieldData.p3lMosaic,
DisplayFieldData.qmosaic, DisplayFieldData.lqmosaic,
DisplayFieldData.mlqmosaic, DisplayFieldData.localField1,
DisplayFieldData.localField2, DisplayFieldData.localField3 };
DisplayFieldData.mlqmosaic,
DisplayFieldData.rdMosaic,
DisplayFieldData.avgrdMosaic,
DisplayFieldData.maxrdMosaic,
DisplayFieldData.bdMosaic,
DisplayFieldData.ldMosaic,
DisplayFieldData.mdMosaic,
DisplayFieldData.mldMosaic,
DisplayFieldData.srdMosaic,
DisplayFieldData.srdgMosaic,
DisplayFieldData.localField1,
DisplayFieldData.localField2,
DisplayFieldData.localField3 };
private static Map<DisplayFieldData, MenuData> textMap = new HashMap<DisplayFieldData, MenuData>();
static {
@ -78,7 +91,7 @@ public class PrecipFieldsPopulator extends FieldsPopulator {
textMap.put(DisplayFieldData.satPre, new MenuData("Satellite Precip",
"S"));
textMap.put(DisplayFieldData.lsatPre, new MenuData(
"Local Bias Satellite Preci", "o"));
"Local Bias Satellite Precip", "o"));
textMap.put(DisplayFieldData.srMosaic, new MenuData(
"Satellite Radar Mosaic", "e"));
textMap.put(DisplayFieldData.sgMosaic, new MenuData(
@ -92,6 +105,26 @@ public class PrecipFieldsPopulator extends FieldsPopulator {
"Q2 Local Bias Mosaic", "B"));
textMap.put(DisplayFieldData.mlqmosaic, new MenuData(
"Q2 Multi-sensor Mosaic", "i"));
textMap.put(DisplayFieldData.rdMosaic, new MenuData(
"DP Radar Mosaic", "3"));
textMap.put(DisplayFieldData.avgrdMosaic, new MenuData(
"DP Avg Radar Mosaic", "4"));
textMap.put(DisplayFieldData.maxrdMosaic, new MenuData(
"DP Max Radar Mosaic", "5"));
textMap.put(DisplayFieldData.bdMosaic, new MenuData(
"DP Field Bias Radar Mosaic", "6"));
textMap.put(DisplayFieldData.ldMosaic, new MenuData(
"DP Local Bias Radar Mosaic", "7"));
textMap.put(DisplayFieldData.mdMosaic, new MenuData(
"DP Field Bias Multisensor Radar Mosaic", "8"));
textMap.put(DisplayFieldData.mldMosaic, new MenuData(
"DP Local Bias Multisensor Radar Mosaic", "9"));
textMap.put(DisplayFieldData.srdMosaic, new MenuData(
"DP Satellite Radar Mosaic", "0"));
textMap.put(DisplayFieldData.srdgMosaic, new MenuData(
"DP Satellite Radar Gage Mosaic", "1"));
textMap.put(DisplayFieldData.localField1, new MenuData(
"Local Field #1", "d"));
textMap.put(DisplayFieldData.localField2, new MenuData(

View file

@ -0,0 +1,113 @@
/**
* 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.viz.mpe.ui.actions;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.viz.mpe.ui.ComparisonFields;
import com.raytheon.viz.mpe.ui.DisplayFieldData;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.mpe.ui.rsc.MPEFieldResource;
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
/**
* TODO Add Description
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 23, 2008 randerso Initial creation
* </pre>
*
* @author randerso
* @version 1.0
*/
public class ReverseComparisonFields extends AbstractHandler {
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
* .ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
IDisplayPane pane = null;
if (editor instanceof IMultiPaneEditor) {
IMultiPaneEditor multiPane = (IMultiPaneEditor) editor;
if (multiPane.getNumberofPanes() > 1
&& multiPane.displayedPaneCount() > 1) {
pane = multiPane.getSelectedPane(IMultiPaneEditor.LOAD_ACTION);
} else {
pane = ((IDisplayPaneContainer) editor).getDisplayPanes()[0];
}
}
MPEDisplayManager displayMgr = MPEDisplayManager.getInstance(pane);
DisplayFieldData field = displayMgr.getDisplayFieldType();
ComparisonFields comparisonFields = displayMgr.getComparisonFields();
comparisonFields.reverse();
return setDisplayField((IDisplayPaneContainer) editor, field);
}
public static MPEFieldResource setDisplayField(
IDisplayPaneContainer editor, DisplayFieldData field) {
if (editor == null) {
return null;
}
IDisplayPane[] panes = editor.getDisplayPanes();
IDisplayPane pane = panes[0];
if (panes.length > 1) {
if (editor instanceof IMultiPaneEditor) {
IMultiPaneEditor multiPane = (IMultiPaneEditor) editor;
IDisplayPane loadTo = multiPane
.getSelectedPane(IMultiPaneEditor.LOAD_ACTION);
if (loadTo != null) {
pane = loadTo;
}
}
}
MPEDisplayManager displayMgr = MPEDisplayManager.getInstance(pane);
displayMgr.displayFieldData(DisplayFieldData.satPre);
displayMgr.displayFieldData(field);
// Update the screen
return displayMgr.getDisplayedFieldResource();
}
}

View file

@ -0,0 +1,120 @@
/**
* 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.viz.mpe.ui.actions;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.viz.mpe.ui.ComparisonFields;
import com.raytheon.viz.mpe.ui.DisplayFieldData;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.mpe.ui.dialogs.SelectComparisonFieldsDialog;
import com.raytheon.viz.mpe.ui.rsc.MPEFieldResource;
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
/**
* TODO Add Description
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 23, 2008 randerso Initial creation
* </pre>
*
* @author randerso
* @version 1.0
*/
public class SelectComparisonFields extends AbstractHandler {
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
* .ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
IDisplayPane pane = null;
if (editor instanceof IMultiPaneEditor) {
IMultiPaneEditor multiPane = (IMultiPaneEditor) editor;
if (multiPane.getNumberofPanes() > 1
&& multiPane.displayedPaneCount() > 1) {
pane = multiPane.getSelectedPane(IMultiPaneEditor.LOAD_ACTION);
} else {
pane = ((IDisplayPaneContainer) editor).getDisplayPanes()[0];
}
}
MPEDisplayManager displayMgr = MPEDisplayManager.getInstance(pane);
DisplayFieldData field = displayMgr.getDisplayFieldType();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
SelectComparisonFieldsDialog dialog = new SelectComparisonFieldsDialog(shell, displayMgr);
dialog.open();
return setDisplayField((IDisplayPaneContainer) editor, field);
}
public static MPEFieldResource setDisplayField(
IDisplayPaneContainer editor, DisplayFieldData field) {
if (editor == null) {
return null;
}
IDisplayPane[] panes = editor.getDisplayPanes();
IDisplayPane pane = panes[0];
if (panes.length > 1) {
if (editor instanceof IMultiPaneEditor) {
IMultiPaneEditor multiPane = (IMultiPaneEditor) editor;
IDisplayPane loadTo = multiPane
.getSelectedPane(IMultiPaneEditor.LOAD_ACTION);
if (loadTo != null) {
pane = loadTo;
}
}
}
MPEDisplayManager displayMgr = MPEDisplayManager.getInstance(pane);
displayMgr.displayFieldData(DisplayFieldData.satPre);
displayMgr.displayFieldData(field);
// Update the screen
return displayMgr.getDisplayedFieldResource();
}
}

View file

@ -19,10 +19,10 @@
**/
package com.raytheon.viz.mpe.ui.dialogs;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
@ -48,6 +48,8 @@ import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.dataplugin.shef.tables.Rwbiasstat;
import com.raytheon.uf.common.dataplugin.shef.tables.Rwradarresult;
import com.raytheon.uf.common.dataplugin.shef.tables.DAARadarResult;
// com.raytheon.uf.common.dataplugin.shef.tables.DAARadarResultId;
import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.hydrocommon.whfslib.IHFSDbGenerated;
@ -90,11 +92,8 @@ public class RadarBiasTableDialog extends Dialog {
private final Zerocoef_Data abzerocoef = new Zerocoef_Data();
private Shell shell;
private Font font;
private Button applyBtn;
private Button closeBtn;
Composite bcLblComp;
@ -102,36 +101,37 @@ public class RadarBiasTableDialog extends Dialog {
private final int retval = 0;
String[] radIds;
String rid = "";
private static String[] biasLabelStrings = { " Radar", "Bias :",
"Manually Specified", "A", "B", "Bias :", "Other Office" };
private static String[] biasLabelStrings = { " Radar", "SP Bias", "DP Bias",
"Man. SP Bias", "Man. DP Bias", "A", "B", "Bias", "Other Office" };
private final Label[] colHdr = new Label[biasLabelStrings.length];
private String abias = "";
private String bbias = "";
private String obias = "";
private String ooffice = "";
private String bias = "";
private String mbias = "";
private String biasSP = "";
private String mbiasSP = "";
private String biasDP = "";
private String mbiasDP = "";
public static int default_bias = 0;
private ArrayList<Rwbiasstat> bList = new ArrayList<Rwbiasstat>();
public static Rwbiasstat rwBias = new Rwbiasstat();
private Map<String, MPERadarData> rsList;
private MPERadarData radarresultdata = new MPERadarData();
private Map<String, MPERadarData> radarIdToSPDataMap;
private Map<String, MPERadarData> radarIdToDPDataMap;
private MPERadarData radarresultdata = new MPERadarData();
private MPERadarData daaradarresultdata = new MPERadarData();
public static String dt = "";
private static final AppsDefaults appsDefaults = AppsDefaults.getInstance();
@ -144,38 +144,60 @@ public class RadarBiasTableDialog extends Dialog {
private static final SimpleDateFormat st3sdf;
Button mbiasBtn = null;
Button mbiasSPBtn = null; //this is used only locally to create the button and then assigned to the array
Button[] manEditSP = null;
Button[] manEdit = null;
Button mbiasDPBtn = null; //this is used only locally to create the button and then assigned to the array
Button[] manEditDP = null;
//used only for code taken from HydroTimeUtility
private static ThreadLocal<SimpleDateFormat> sqlSdf = new ThreadLocal<SimpleDateFormat>() {
static {
@Override
protected SimpleDateFormat initialValue() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
return sdf;
}
};
static
{
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
pgsdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String date_form = appsDefaults.getToken("st3_date_form");
if ((date_form == null) || date_form.isEmpty()
|| date_form.equals("mdY")) {
|| date_form.equals("mdY"))
{
st3sdf = new SimpleDateFormat("MMM dd yyyy HH");
st3sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
} else {
}
else
{
st3sdf = sdf;
}
}
float[] oldbias = new float[60];
float[] editbias = new float[60];
float[] oldbiasSP = new float[60];
float[] editbiasSP = new float[60];
float[] oldbiasDP = new float[60];
float[] editbiasDP = new float[60];
public RadarBiasTableDialog(Shell parentShell) {
super(parentShell);
}
/**
* Open method used to display the Group Edit Stations dialog.
* Open method used to display the Radar Bias Table dialog == Edit Bias Table Dialog in A1.
*
* @return Null.
*/
public int open() {
public int open()
{
Shell parent = this.getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM);
@ -209,7 +231,8 @@ public class RadarBiasTableDialog extends Dialog {
/**
* Initialize the dialog components.
*/
private void initializeComponents() {
private void initializeComponents()
{
try {
radIds = GageTableDataManager.getInstance().getActiveRadarIds();
@ -219,7 +242,8 @@ public class RadarBiasTableDialog extends Dialog {
String fxa_local_site = appsDefaults.getToken("fxa_local_site");
String where = "WHERE office_id = '" + fxa_local_site + "'";
bList = IHFSDbGenerated.GetRWBiasstat(where);
if (!bList.isEmpty()) {
if (!bList.isEmpty())
{
rwBias = bList.get(0);
default_bias = rwBias.getNpairBiasSelect();
}
@ -230,7 +254,8 @@ public class RadarBiasTableDialog extends Dialog {
createButtonComp();
}
private void createButtonComp() {
private void createButtonComp()
{
// Create a container to hold the buttons.
GridData gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
@ -282,7 +307,8 @@ public class RadarBiasTableDialog extends Dialog {
});
}
private void createDateComp() {
private void createDateComp()
{
GridData bd = new GridData(SWT.LEFT, SWT.CENTER, true, true);
Composite dtLblComp = new Composite(shell, SWT.NONE);
@ -300,14 +326,16 @@ public class RadarBiasTableDialog extends Dialog {
/**
* Create the composite to hold the data column labels
*/
private void createBiasColLblComp() {
private void createBiasColLblComp()
{
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
bcLblComp = new Composite(shell, SWT.NONE);
GridLayout bcLblCompLayout = new GridLayout(7, true);
GridLayout bcLblCompLayout = new GridLayout(9, true);
bcLblCompLayout.marginWidth = 1;
bcLblComp.setLayout(bcLblCompLayout);
bcLblComp.setLayoutData(gd);
for (int i = 0; i < biasLabelStrings.length; i++) {
for (int i = 0; i < biasLabelStrings.length; i++)
{
colHdr[i] = new Label(bcLblComp, SWT.FILL);
colHdr[i].setText(biasLabelStrings[i]);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
@ -332,29 +360,51 @@ public class RadarBiasTableDialog extends Dialog {
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
final Composite biasListComp = new Composite(biasListScrollComp,
SWT.BORDER);
GridLayout biasListCompLayout = new GridLayout(7, true);
// new table has 9 columns; previous table had 7 columns
GridLayout biasListCompLayout = new GridLayout(9, true);
biasListComp.setLayout(biasListCompLayout);
gd.horizontalSpan = 7;
gd.horizontalSpan = 9;
biasListComp.setLayoutData(gd);
biasListComp
.setSize(biasListComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
Date dt3 = MPEDisplayManager.getCurrent().getCurrentEditDate();
dt = pgsdf.format(dt3);
rsList = new HashMap<String, MPERadarData>(radIds.length);
rsList = MPEDataManager.getInstance().readRadarData(dt3);
Text[] lbTxts = new Text[radIds.length];
manEdit = new Button[radIds.length];
radarIdToSPDataMap = MPEDataManager.getInstance().readSPRadarData(dt3);
radarIdToDPDataMap = MPEDataManager.getInstance().readDPRadarData(dt3);
Text[] biasSPTextArray = new Text[radIds.length];
Text[] biasDPTextArray = new Text[radIds.length];
manEditSP = new Button[radIds.length];
manEditDP = new Button[radIds.length];
for (int i = 0; i < radIds.length; i++) {
for (int i = 0; i < radIds.length; i++)
{
// get A and B coefficients from SP radar (does not apply to DP )
abzerocoef.mlt_zrcoef = 0.0f;
abzerocoef.pwr_zrcoef = 0.0f;
rid = radIds[i];
if (radarIdToDPDataMap.size() != 0)
{
daaradarresultdata = radarIdToDPDataMap.get(rid);
}
if (rsList.size() != 0) {
radarresultdata = rsList.get(rid);
} else {
if (radarIdToSPDataMap.size() != 0)
{
radarresultdata = radarIdToSPDataMap.get(rid);
}
else
{
continue;
}
@ -374,13 +424,19 @@ public class RadarBiasTableDialog extends Dialog {
abzerocoef.pwr_zrcoef = dpaz[1];
}
}
//-----------------------------------------------------
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
//radar id button
final Button ridBtn = new Button(biasListComp, SWT.PUSH);
ridBtn.setText(rid);
ridBtn.setData(rid);
ridBtn.setLayoutData(gd);
ridBtn.addSelectionListener(new SelectionAdapter() {
ridBtn.addSelectionListener(new SelectionAdapter()
{
/*
* (non-Javadoc)
@ -398,60 +454,120 @@ public class RadarBiasTableDialog extends Dialog {
});
bias = String.format("%-1.2f", radarresultdata.getRwBiasValUsed());
oldbias[i] = (float) radarresultdata.getRwBiasValUsed();
editbias[i] = 0.0f;
biasSP = String.format("%-1.2f", radarresultdata.getRwBiasValUsed());
oldbiasSP[i] = (float) radarresultdata.getRwBiasValUsed();
editbiasSP[i] = 1.0f;
biasDP = String.format("%-1.2f", daaradarresultdata.getRwBiasValUsed());
oldbiasDP[i] = (float) daaradarresultdata.getRwBiasValUsed();
editbiasDP[i] = 1.0f;
gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
final Text lbiasTxt = new Text(biasListComp, SWT.SINGLE
final Text lbiasSPTxt = new Text(biasListComp, SWT.SINGLE
| SWT.CENTER | SWT.BORDER);
if (radarresultdata.getProductDate() == null) {
ridBtn.setEnabled(false);
}
if (radarresultdata.getEditBias() != null) {
lbiasTxt.setText(bias.trim());
lbiasSPTxt.setText(biasSP.trim());
} else {
lbiasTxt.setText("DATA MISSING");
lbiasTxt.setEnabled(false);
lbiasSPTxt.setText("DATA MISSING");
lbiasSPTxt.setEnabled(false);
}
lbiasTxt.setLayoutData(gd);
lbiasTxt.setData(i);
lbiasSPTxt.setLayoutData(gd);
lbiasSPTxt.setData(i);
lbiasTxt.addModifyListener(new ModifyListener() {
final Text lbiasDPTxt = new Text(biasListComp, SWT.SINGLE
| SWT.CENTER | SWT.BORDER);
ridBtn.setEnabled(true);
if (daaradarresultdata.getEditBias() != null) {
lbiasDPTxt.setText(biasDP.trim());
} else {
lbiasDPTxt.setText("DATA MISSING");
lbiasDPTxt.setEnabled(false);
}
lbiasDPTxt.setLayoutData(gd);
lbiasDPTxt.setData(i);
//--------------------------------------------------------------
lbiasSPTxt.addModifyListener(new ModifyListener()
{
@Override
public void modifyText(ModifyEvent e) {
final int ei = (Integer) lbiasTxt.getData();
final int ei = (Integer) lbiasSPTxt.getData();
try {
float parsedFloat = Float.parseFloat(lbiasTxt.getText());
editbias[ei] = parsedFloat;
manEdit[ei].setSelection(!mbiasBtn.getSelection());
manEdit[ei].setText("YES");
lbiasTxt.setBackground(getParent().getDisplay()
float parsedFloat = Float.parseFloat(lbiasSPTxt.getText());
editbiasSP[ei] = parsedFloat;
manEditSP[ei].setSelection(!mbiasSPBtn.getSelection());
manEditSP[ei].setText("YES");
lbiasSPTxt.setBackground(getParent().getDisplay()
.getSystemColor(SWT.COLOR_WHITE));
applyBtn.setEnabled(true);
} catch (NumberFormatException e1) {
lbiasTxt.setBackground(getParent().getDisplay()
lbiasSPTxt.setBackground(getParent().getDisplay()
.getSystemColor(SWT.COLOR_RED));
applyBtn.setEnabled(false);
}
}
});
//-------------------------------------------------------------
lbiasDPTxt.addModifyListener(new ModifyListener()
{
lbTxts[i] = lbiasTxt;
@Override
public void modifyText(ModifyEvent e) {
final int ei = (Integer) lbiasDPTxt.getData();
try {
float parsedFloat = Float.parseFloat(lbiasDPTxt.getText());
editbiasDP[ei] = parsedFloat;
manEditDP[ei].setSelection(!mbiasDPBtn.getSelection());
manEditDP[ei].setText("YES");
lbiasDPTxt.setBackground(getParent().getDisplay()
.getSystemColor(SWT.COLOR_WHITE));
applyBtn.setEnabled(true);
} catch (NumberFormatException e1) {
lbiasDPTxt.setBackground(getParent().getDisplay()
.getSystemColor(SWT.COLOR_RED));
applyBtn.setEnabled(false);
}
}
});
//-------------------------------------------------------------
gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
mbiasBtn = new Button(biasListComp, SWT.TOGGLE | SWT.READ_ONLY);
// mbiasBtn.setEnabled(false);
mbias = ("n".equalsIgnoreCase(radarresultdata.getEditBias()) || radarresultdata
biasSPTextArray[i] = lbiasSPTxt;
mbiasSPBtn = new Button(biasListComp, SWT.TOGGLE | SWT.READ_ONLY);
mbiasSP = ("n".equalsIgnoreCase(radarresultdata.getEditBias()) || radarresultdata
.getEditBias() == null) ? "NO" : "YES";
mbiasBtn.setText(mbias);
mbiasBtn.setLayoutData(gd);
mbiasBtn.setData(i);
mbiasBtn.setSelection(false);
manEdit[i] = mbiasBtn;
mbiasSPBtn.setText(mbiasSP);
mbiasSPBtn.setLayoutData(gd);
mbiasSPBtn.setData(i);
mbiasSPBtn.setSelection(false);
manEditSP[i] = mbiasSPBtn;
//------------------------------------------------------
biasDPTextArray[i] = lbiasDPTxt;
mbiasDPBtn = new Button(biasListComp, SWT.TOGGLE | SWT.READ_ONLY);
mbiasDP = ("n".equalsIgnoreCase(daaradarresultdata.getEditBias()) || daaradarresultdata
.getEditBias() == null) ? "NO" : "YES";
mbiasDPBtn.setText(mbiasDP);
mbiasDPBtn.setLayoutData(gd);
mbiasDPBtn.setData(i);
mbiasDPBtn.setSelection(false);
manEditDP[i] = mbiasDPBtn;
//---------------------------------------------------------
gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
Label acoefLbl = new Label(biasListComp, SWT.CENTER);
if (abzerocoef.mlt_zrcoef == 0.0) {
@ -509,8 +625,15 @@ public class RadarBiasTableDialog extends Dialog {
}
});
}
private void applyBiasUpdate(String obstime)
{
applySPBiasUpdate(obstime);
applyDPBiasUpdate(obstime);
}
private void applyBiasUpdate(String obstime) {
private void applySPBiasUpdate(String obstime)
{
String where = "";
final float memspan = -99.0f;
ArrayList<Rwradarresult> rwr = new ArrayList<Rwradarresult>();
@ -519,8 +642,8 @@ public class RadarBiasTableDialog extends Dialog {
if (radIds[i].equals("ZZZ")) {
continue;
}
if (manEdit[i] != null
&& "YES".equalsIgnoreCase(manEdit[i].getText())) {
if (manEditSP[i] != null
&& "YES".equalsIgnoreCase(manEditSP[i].getText())) {
where = String.format("WHERE radid='%s' AND obstime='%s'",
radIds[i], obstime);
rwr = (ArrayList<Rwradarresult>) IHFSDbGenerated
@ -532,7 +655,7 @@ public class RadarBiasTableDialog extends Dialog {
}
rwrr.setEditBias("y");
rwrr.setMemSpanUsed((double) memspan);
rwrr.setRwBiasValUsed((double) editbias[i]);
rwrr.setRwBiasValUsed((double) editbiasSP[i]);
IHFSDbGenerated.UpdateRWRadarResult(rwrr);
} else {
continue;
@ -540,4 +663,45 @@ public class RadarBiasTableDialog extends Dialog {
}
return;
}
// ---------------------------------------------------------------------
private void applyDPBiasUpdate(String obstime)
{
String where = "";
final float memspan = -99.0f;
ArrayList<DAARadarResult> rwr = new ArrayList<DAARadarResult>();
DAARadarResult rwrr = new DAARadarResult();
for (int i = 0; i < radIds.length; i++) {
if (radIds[i].equals("ZZZ")) {
continue;
}
if (manEditDP[i] != null
&& "YES".equalsIgnoreCase(manEditDP[i].getText()))
{
where = String.format("WHERE radid='%s' AND obstime='%s'",
radIds[i], obstime);
rwr = (ArrayList<DAARadarResult>) IHFSDbGenerated
.GetDAARadarResult(where);
if (rwr.size() != 0) {
rwrr = rwr.get(0);
} else {
continue;
}
rwrr.setEditBias("y");
rwrr.setMemSpanUsed((double) memspan);
rwrr.setRwBiasValUsed((double) editbiasDP[i]);
IHFSDbGenerated.UpdateDAARadarResult(rwrr);
}
else
{
continue;
}
}
return;
}
}

View file

@ -0,0 +1,309 @@
/**
* 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.viz.mpe.ui.dialogs;
import java.util.ArrayList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.mpe.core.MPEDataManager;
import com.raytheon.viz.mpe.ui.ComparisonFields;
import com.raytheon.viz.mpe.ui.DisplayFieldData;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
/**
* Dialog to handle the selection of 1-hour precip fields to compare in MPE.
* <p>
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* December 2013 DCS 167 C. Gobs Initial Creation
*
* </pre>
*
*
* @author Chip Gobs
*
*/
public class SelectComparisonFieldsDialog extends AbstractMPEDialog {
private MPEDisplayManager displayManager;
private Combo fieldTypeCombo1 = null;
private Combo fieldTypeCombo2 = null;
private DisplayFieldData[] displayFieldDataArray;
private String[] displayTypeNameArray;
// ---------------------------------------------------------------------
/**
* Constructor.
*
* @param parent
*/
public SelectComparisonFieldsDialog(Shell parent, MPEDisplayManager displayManager) {
super(parent);
this.displayManager = displayManager;
}
/**
* Open the dialog.
*
* @return Return value (null).
*/
public Object open() {
Shell parent = this.getParent();
Display display = parent.getDisplay();
// Set up the shell and allow it to resize.
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE);
shell.setText("Select Comparison Fields");
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, true);
mainLayout.marginHeight = 1;
mainLayout.marginWidth = 1;
shell.setLayout(mainLayout);
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
AbstractVizPerspectiveManager mgr = VizPerspectiveListener
.getCurrentPerspectiveManager();
if (mgr != null) {
mgr.removePespectiveDialog(SelectComparisonFieldsDialog.this);
}
}
});
// Initialize all of the controls and layouts
initializeComponents();
shell.pack();
shell.open();
// Set the minimum size of the dialog so resizing does not hide
// the buttons.
shell.setMinimumSize(shell.getBounds().width, shell.getBounds().height);
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return null;
}
/**
* Initialize the widget components.
*/
private void initializeComponents() {
createProdListComp(shell);
addSeparator(shell);
createBottomButtons();
}
/**
* Create the data options group and controls.
*/
private void createProdListComp(Shell shell) {
// Create a container to hold the label and the combo box.
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite prodListComp = new Composite(shell, SWT.NONE);
GridLayout prodListCompLayout = new GridLayout(2, false);
prodListComp.setLayout(prodListCompLayout);
prodListComp.setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
Label fieldTypeLabel1 = new Label(prodListComp, SWT.CENTER);
fieldTypeLabel1.setText("Field 1:");
fieldTypeLabel1.setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
fieldTypeCombo1 = new Combo(prodListComp, SWT.LEFT | SWT.DROP_DOWN
| SWT.READ_ONLY);
gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
Label fieldTypeLabel2 = new Label(prodListComp, SWT.CENTER);
fieldTypeLabel2.setText("Field 2:");
fieldTypeLabel2.setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
fieldTypeCombo2 = new Combo(prodListComp, SWT.LEFT | SWT.DROP_DOWN
| SWT.READ_ONLY);
int selector1 = -1;
int selector2 = -1;
MPEDisplayManager displayMgr = MPEDisplayManager.getCurrent();
DisplayFieldData field1 = displayMgr.getComparisonFields().getField1();
DisplayFieldData field2 = displayMgr.getComparisonFields().getField2();
if (field1 == null)
{
field1 = DisplayFieldData.rMosaic;
}
if (field2 == null)
{
field2 = DisplayFieldData.rdMosaic;
}
if (displayFieldDataArray == null)
{
displayFieldDataArray = MPEDisplayManager.mpe_qpe_fields;
}
//find the index of the selected field
for (selector1 = 0; selector1 < displayFieldDataArray.length; ++selector1) {
if (displayFieldDataArray[selector1] == field1) {
break;
}
}
//find the index of the selected field
for (selector2 = 0; selector2 < displayFieldDataArray.length; ++selector2) {
if (displayFieldDataArray[selector2] == field2) {
break;
}
}
displayFieldDataArray = MPEDisplayManager.mpe_qpe_fields;
displayTypeNameArray = new String[displayFieldDataArray.length];
for (int i = 0; i < displayFieldDataArray.length; i++) {
displayTypeNameArray[i] = displayFieldDataArray[i].toString();
}
//select the current field1
fieldTypeCombo1.setTextLimit(35);
fieldTypeCombo1.setLayoutData(gd);
fieldTypeCombo1.setItems(displayTypeNameArray);
fieldTypeCombo1.select(selector1);
//select the current field2
fieldTypeCombo2.setTextLimit(35);
fieldTypeCombo2.setLayoutData(gd);
fieldTypeCombo2.setItems(displayTypeNameArray);
fieldTypeCombo2.select(selector2);
}
/**
* Create the bottom OK and Cancel buttons.
*/
private void createBottomButtons() {
Composite buttonComp = new Composite(shell, SWT.NONE);
buttonComp.setLayout(new GridLayout(2, true));
buttonComp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true,
false));
int buttonWidth = 80;
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = buttonWidth;
Button okBtn = new Button(buttonComp, SWT.PUSH);
okBtn.setText("OK");
okBtn.setLayoutData(gd);
okBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
okAction();
close();
}
});
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = buttonWidth;
Button cancelBtn = new Button(buttonComp, SWT.PUSH);
cancelBtn.setText("Cancel");
cancelBtn.setLayoutData(gd);
cancelBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
close();
}
});
}
/**
* Add a separator to the display.
*
* @param parentComp
* Parent Composite
*/
private void addSeparator(Composite parentComp) {
GridLayout gl = (GridLayout) parentComp.getLayout();
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
gd.horizontalSpan = gl.numColumns;
Label sepLbl = new Label(parentComp, SWT.SEPARATOR | SWT.HORIZONTAL);
sepLbl.setLayoutData(gd);
}
/**
* When the OK button is pressed, set the new field types to compare
*/
private void okAction()
{
String fieldName1 = fieldTypeCombo1.getText();
String fieldName2 = fieldTypeCombo2.getText();
DisplayFieldData newField1 = DisplayFieldData.fromDisplayNameString(fieldName1);
DisplayFieldData newField2 = DisplayFieldData.fromDisplayNameString(fieldName2);
ComparisonFields comparisonFields = displayManager.getComparisonFields();
comparisonFields.setField1(newField1);
comparisonFields.setField2(newField2);
}
}

View file

@ -93,6 +93,20 @@ public class GageTableDataManager {
private short[][] mMosaic = null;
private short[][] mlMosaic = null;
// Dual Pol Fields
private short[][] rdMosaic = null;
private short[][] avgrdMosaic = null;
private short[][] maxrdMosaic = null;
private short[][] bdMosaic = null;
private short[][] ldMosaic = null;
private short[][] mdMosaic = null;
private short[][] mldMosaic = null;
private short[][] srdMosaic = null;
private short[][] srdgMosaic = null;
//
private short[][] p3Mosaic = null;
@ -476,6 +490,113 @@ public class GageTableDataManager {
mMosaic = file.getData(extent);
}
return mMosaic;
//---------------------------------------
// Dual Pol Fields
} else if (type.equalsIgnoreCase(GageTableProductManager.MPE_RDMOSAIC)) {
if ((rdMosaic == null) || !currentDate.equals(dataDate)) {
// Set the dataDate
dataDate = currentDate;
XmrgFile file = new XmrgFile(path);
file.load();
rdMosaic = file.getData(extent);
}
return rdMosaic;
} else if (type.equalsIgnoreCase(GageTableProductManager.MPE_BDMOSAIC)) {
if ((bdMosaic == null) || !currentDate.equals(dataDate)) {
// Set the dataDate
dataDate = currentDate;
XmrgFile file = new XmrgFile(path);
file.load();
bdMosaic = file.getData(extent);
}
return bdMosaic;
} else if (type.equalsIgnoreCase(GageTableProductManager.MPE_LDMOSAIC)) {
if ((ldMosaic == null) || !currentDate.equals(dataDate)) {
// Set the dataDate
dataDate = currentDate;
XmrgFile file = new XmrgFile(path);
file.load();
ldMosaic = file.getData(extent);
}
return ldMosaic;
} else if (type.equalsIgnoreCase(GageTableProductManager.MPE_MDMOSAIC)) {
if ((mdMosaic == null) || !currentDate.equals(dataDate)) {
// Set the dataDate
dataDate = currentDate;
XmrgFile file = new XmrgFile(path);
file.load();
mdMosaic = file.getData(extent);
}
return mdMosaic;
} else if (type.equalsIgnoreCase(GageTableProductManager.MPE_MLDMOSAIC)) {
if ((mldMosaic == null) || !currentDate.equals(dataDate)) {
// Set the dataDate
dataDate = currentDate;
XmrgFile file = new XmrgFile(path);
file.load();
mldMosaic = file.getData(extent);
}
return mldMosaic;
} else if (type.equalsIgnoreCase(GageTableProductManager.MPE_AVGRDMOSAIC)) {
if ((avgrdMosaic == null) || !currentDate.equals(dataDate)) {
// Set the dataDate
dataDate = currentDate;
XmrgFile file = new XmrgFile(path);
file.load();
avgrdMosaic = file.getData(extent);
}
return avgrdMosaic;
} else if (type.equalsIgnoreCase(GageTableProductManager.MPE_MAXRDMOSAIC)) {
if ((maxrdMosaic == null) || !currentDate.equals(dataDate)) {
// Set the dataDate
dataDate = currentDate;
XmrgFile file = new XmrgFile(path);
file.load();
maxrdMosaic = file.getData(extent);
}
return maxrdMosaic;
} else if (type.equalsIgnoreCase(GageTableProductManager.MPE_SRDMOSAIC)) {
if ((srdMosaic == null) || !currentDate.equals(dataDate)) {
// Set the dataDate
dataDate = currentDate;
XmrgFile file = new XmrgFile(path);
file.load();
srdMosaic = file.getData(extent);
}
return srdMosaic;
} else if (type.equalsIgnoreCase(GageTableProductManager.MPE_SRDGMOSAIC)) {
if ((srdgMosaic == null) || !currentDate.equals(dataDate)) {
// Set the dataDate
dataDate = currentDate;
XmrgFile file = new XmrgFile(path);
file.load();
srdgMosaic = file.getData(extent);
}
return srdgMosaic;
//------------------------------------------------------
//
} else if (type.equalsIgnoreCase(GageTableProductManager.MPE_P3LMOSAIC)) {
if ((p3Mosaic == null) || !currentDate.equals(dataDate)) {
// Set the dataDate
@ -689,6 +810,75 @@ public class GageTableDataManager {
GageTableProductManager.MPE_MMOSAIC,
getData(DisplayFieldData.mMosaic, gage,
GageTableProductManager.MPE_MMOSAIC));
//-------------------------------------------
// Dual Pol Fields
} else if (col
.equalsIgnoreCase(GageTableProductManager.MPE_RDMOSAIC)) {
productValueMap.put(
GageTableProductManager.MPE_RDMOSAIC,
getData(DisplayFieldData.rdMosaic, gage,
GageTableProductManager.MPE_RDMOSAIC));
} else if (col
.equalsIgnoreCase(GageTableProductManager.MPE_BDMOSAIC)) {
productValueMap.put(
GageTableProductManager.MPE_BDMOSAIC,
getData(DisplayFieldData.bdMosaic, gage,
GageTableProductManager.MPE_BDMOSAIC));
} else if (col
.equalsIgnoreCase(GageTableProductManager.MPE_LDMOSAIC)) {
productValueMap.put(
GageTableProductManager.MPE_LDMOSAIC,
getData(DisplayFieldData.ldMosaic, gage,
GageTableProductManager.MPE_LDMOSAIC));
} else if (col
.equalsIgnoreCase(GageTableProductManager.MPE_MDMOSAIC)) {
productValueMap.put(
GageTableProductManager.MPE_MDMOSAIC,
getData(DisplayFieldData.mdMosaic, gage,
GageTableProductManager.MPE_MDMOSAIC));
} else if (col
.equalsIgnoreCase(GageTableProductManager.MPE_MLDMOSAIC)) {
productValueMap.put(
GageTableProductManager.MPE_MLDMOSAIC,
getData(DisplayFieldData.mldMosaic, gage,
GageTableProductManager.MPE_MLDMOSAIC));
} else if (col
.equalsIgnoreCase(GageTableProductManager.MPE_AVGRDMOSAIC)) {
productValueMap.put(
GageTableProductManager.MPE_AVGRDMOSAIC,
getData(DisplayFieldData.avgrdMosaic, gage,
GageTableProductManager.MPE_AVGRDMOSAIC));
} else if (col
.equalsIgnoreCase(GageTableProductManager.MPE_MAXRDMOSAIC)) {
productValueMap.put(
GageTableProductManager.MPE_MAXRDMOSAIC,
getData(DisplayFieldData.maxrdMosaic, gage,
GageTableProductManager.MPE_MAXRDMOSAIC));
} else if (col
.equalsIgnoreCase(GageTableProductManager.MPE_SRDMOSAIC)) {
productValueMap.put(
GageTableProductManager.MPE_SRDMOSAIC,
getData(DisplayFieldData.srdMosaic, gage,
GageTableProductManager.MPE_SRDMOSAIC));
} else if (col
.equalsIgnoreCase(GageTableProductManager.MPE_SRDGMOSAIC)) {
productValueMap.put(
GageTableProductManager.MPE_SRDGMOSAIC,
getData(DisplayFieldData.srdgMosaic, gage,
GageTableProductManager.MPE_SRDGMOSAIC));
//-------------------------------------------
} else if (col
.equalsIgnoreCase(GageTableProductManager.MPE_P3LMOSAIC)) {
productValueMap.put(

View file

@ -71,6 +71,29 @@ public class GageTableProductManager {
public static final String MPE_SRGMOSAIC = "SRGMOSAIC";
public static final String MPE_P3LMOSAIC = "P3LMOSAIC";
//-------------------------------------------
// Dual Pol Fields
public static final String MPE_RDMOSAIC = "RDMOSAIC";
public static final String MPE_BDMOSAIC = "BDMOSAIC";
public static final String MPE_MDMOSAIC = "MDMOSAIC";
public static final String MPE_LDMOSAIC = "LDMOSAIC";
public static final String MPE_MLDMOSAIC = "MLDMOSAIC";
public static final String MPE_AVGRDMOSAIC = "AVGRDMOSAIC";
public static final String MPE_MAXRDMOSAIC = "MAXRDMOSAIC";
public static final String MPE_SRDMOSAIC = "SRDMOSAIC";
public static final String MPE_SRDGMOSAIC = "SRDGMOSAIC";
//----------------------------------------------
public static final String MPE_BESTQPE = "xmrg";
@ -319,6 +342,111 @@ public class GageTableProductManager {
productNameLookup.put(satelliteRadarGageMosaic.getProductName(),
satelliteRadarGageMosaic.getProductFilenamePrefix());
//----------------------------------------------------------------------
// Dual Pol Fields
GageTableProductDescriptor DPradarMosaic= new GageTableProductDescriptor(
"DP Radar Mosaic", MPE_RDMOSAIC, "DP Radar Mosaic",
"mpe_rdmosaic_dir", new String[] { MPE_RMOSAIC, "RDMOSAIC" });
column = new GageTableColumn(DPradarMosaic);
column.setProductDescriptor(DPradarMosaic);
gageTableColumnList.add(column);
gageTableProductColumnMap.put(
DPradarMosaic.getProductFilenamePrefix(), column);
productNameLookup.put(DPradarMosaic.getProductName(),
DPradarMosaic.getProductFilenamePrefix());
GageTableProductDescriptor DPfieldBiasMosaic = new GageTableProductDescriptor(
"DP Field Bias Radar Mosaic", MPE_BDMOSAIC, "DP Field Bias Radar Mosaic",
"mpe_bdmosaic_dir", new String[] { MPE_RMOSAIC, "BDMOSAIC" });
column = new GageTableColumn(DPfieldBiasMosaic);
column.setProductDescriptor(DPfieldBiasMosaic);
gageTableColumnList.add(column);
gageTableProductColumnMap.put(
DPfieldBiasMosaic.getProductFilenamePrefix(), column);
productNameLookup.put(DPfieldBiasMosaic.getProductName(),
DPfieldBiasMosaic.getProductFilenamePrefix());
GageTableProductDescriptor DPlocalBiasMosaic = new GageTableProductDescriptor(
"DP Local Bias Radar Mosaic", MPE_LDMOSAIC, "DP Local Bias Radar Mosaic",
"mpe_ldmosaic_dir", new String[] { MPE_RMOSAIC, "LDMOSAIC" });
column = new GageTableColumn(DPlocalBiasMosaic);
column.setProductDescriptor(DPlocalBiasMosaic);
gageTableColumnList.add(column);
gageTableProductColumnMap.put(
DPlocalBiasMosaic.getProductFilenamePrefix(), column);
productNameLookup.put(DPlocalBiasMosaic.getProductName(),
DPlocalBiasMosaic.getProductFilenamePrefix());
GageTableProductDescriptor DPmultiSensorMosaic = new GageTableProductDescriptor(
"DP Field Bias Multisensor Radar Mosaic", MPE_MDMOSAIC,
"DP Field Bias Multisensor Radar Mosaic",
"mpe_mdmosaic_dir", new String[] { MPE_RMOSAIC, "MDMOSAIC" });
column = new GageTableColumn(DPmultiSensorMosaic);
column.setProductDescriptor(DPmultiSensorMosaic);
gageTableColumnList.add(column);
gageTableProductColumnMap.put(
DPmultiSensorMosaic.getProductFilenamePrefix(), column);
productNameLookup.put(DPmultiSensorMosaic.getProductName(),
DPmultiSensorMosaic.getProductFilenamePrefix());
GageTableProductDescriptor DPlocalBiasMultiSensorMosaic = new GageTableProductDescriptor(
"DP Local Bias Multisensor Radar Mosaic", MPE_MLDMOSAIC,"DP Local Bias Multisensor Radar Mosaic",
"mpe_mldmosaic_dir", new String[] { MPE_RMOSAIC, "MLDMOSAIC" });
column = new GageTableColumn(DPlocalBiasMultiSensorMosaic);
column.setProductDescriptor(DPlocalBiasMultiSensorMosaic);
gageTableColumnList.add(column);
gageTableProductColumnMap.put(
DPlocalBiasMultiSensorMosaic.getProductFilenamePrefix(), column);
productNameLookup.put(DPlocalBiasMultiSensorMosaic.getProductName(),
DPlocalBiasMultiSensorMosaic.getProductFilenamePrefix());
GageTableProductDescriptor DPavgRadarMosaic = new GageTableProductDescriptor(
"DP Avg Radar Mosaic", MPE_AVGRDMOSAIC, "DP Avg Radar Mosaic",
"mpe_avgrdmosaic_dir", new String[] { MPE_RMOSAIC, "AVGRDMOSAIC" });
column = new GageTableColumn(DPavgRadarMosaic);
column.setProductDescriptor(DPavgRadarMosaic);
gageTableColumnList.add(column);
gageTableProductColumnMap.put(
DPavgRadarMosaic.getProductFilenamePrefix(), column);
productNameLookup.put(DPavgRadarMosaic.getProductName(),
DPavgRadarMosaic.getProductFilenamePrefix());
GageTableProductDescriptor DPmaxRadarMosaic = new GageTableProductDescriptor(
"DP Max Radar Mosaic", MPE_MAXRDMOSAIC, "DP Max Radar Mosaic",
"mpe_maxrdmosaic_dir", new String[] { MPE_RMOSAIC, "MAXRDMOSAIC" });
column = new GageTableColumn(DPmaxRadarMosaic);
column.setProductDescriptor(DPmaxRadarMosaic);
gageTableColumnList.add(column);
gageTableProductColumnMap.put(
DPmaxRadarMosaic.getProductFilenamePrefix(), column);
productNameLookup.put(DPmaxRadarMosaic.getProductName(),
DPmaxRadarMosaic.getProductFilenamePrefix());
GageTableProductDescriptor DPsatelliteRadarMosaic = new GageTableProductDescriptor(
"DP Satellite Radar Mosaic", MPE_SRDMOSAIC, "DP Satellite Radar Mosaic",
"mpe_srdmosaic_dir", new String[] { MPE_RMOSAIC, "SRDMOSAIC" });
column = new GageTableColumn(DPsatelliteRadarMosaic);
column.setProductDescriptor(DPsatelliteRadarMosaic);
gageTableColumnList.add(column);
gageTableProductColumnMap.put(
DPsatelliteRadarMosaic.getProductFilenamePrefix(), column);
productNameLookup.put(DPsatelliteRadarMosaic.getProductName(),
DPsatelliteRadarMosaic.getProductFilenamePrefix());
GageTableProductDescriptor DPsatelliteRadarGageMosaic = new GageTableProductDescriptor(
"DP Satellite Radar Gage Mosaic", MPE_SRDGMOSAIC, "DP Satellite Radar Gage Mosaic",
"mpe_srdgmosaic_dir", new String[] { MPE_RMOSAIC, "SRDGMOSAIC" });
column = new GageTableColumn(DPsatelliteRadarGageMosaic);
column.setProductDescriptor(DPsatelliteRadarGageMosaic);
gageTableColumnList.add(column);
gageTableProductColumnMap.put(
DPsatelliteRadarGageMosaic.getProductFilenamePrefix(), column);
productNameLookup.put(DPsatelliteRadarGageMosaic.getProductName(),
DPsatelliteRadarGageMosaic.getProductFilenamePrefix());
//----------------------------------------------------------------------
GageTableProductDescriptor traiangulatedRadarMosaic = new GageTableProductDescriptor(
"Triangulated Radar Mosaic", MPE_P3LMOSAIC,
"Triangulated Radar Mosaic", "mpe_p3lmosaic_dir",
@ -430,7 +558,10 @@ public class GageTableProductManager {
final String DEFAULT_GENERATE_LIST = MPE_BESTQPE + ", " + MPE_BMOSAIC
+ "," + MPE_GAGEONLY + "," + MPE_LMOSAIC + "," + MPE_LSATPRE
+ "," + MPE_MLMOSAIC + "," + MPE_MMOSAIC + "," + MPE_RMOSAIC
+ "," + MPE_SATPRE;
+ "," + MPE_SATPRE
+ "," + MPE_RDMOSAIC + "," + MPE_BDMOSAIC + "," + MPE_LDMOSAIC
+ "," + MPE_MDMOSAIC + "," + MPE_MLDMOSAIC
;
AppsDefaults appsDefaults = AppsDefaults.getInstance();
GageTableColumn productColumn;
@ -541,6 +672,10 @@ public class GageTableProductManager {
}
}
// Should we add code to handle a DP base radar ????
/**
* Add the product to the generate list.
*
@ -713,10 +848,8 @@ public class GageTableProductManager {
public void fireUpdateEvent(GageTableUpdateEvent event) {
Iterator<GageTableListener> iter = gageTableListenerList.iterator();
int i = 0;
while (iter.hasNext()) {
(iter.next()).notifyUpdate(event);
i++;
}
}

View file

@ -191,13 +191,11 @@ public class DisplayDlg extends CaveSWTDialog {
RadarDataManager rdm = RadarDataManager.getInstance();
try {
DPAAdaptableParam adaptData = rdm
.getAdaptableParameters(radId, dtg);
DPAAdaptableParam adaptData = rdm.getAdaptableParameters(radId, dtg);
if (adaptData != null) {
buffer
.append(String
.format(
if (adaptData != null)
{
buffer.append(String.format(
" ***** Radar = %s *****\n"
+ " Preprocessing Algorithm Parameters\n"
+ "%.2f = min reflectivity for isolated bin test (dBZ)%s"

View file

@ -24,6 +24,7 @@ import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
import com.raytheon.uf.viz.core.exception.VizException;
@ -79,15 +80,13 @@ public class RadarDataManager {
* @param radId
* The radar id
* @param dtg
* The obstime for the file
* The obstime for the record and the associated file name
* @return The filename
* @throws VizException
*/
public String getDPAFileName(String radId, Date dtg) throws VizException {
String filename = null;
// String fname = FileUtil.join(dirname, radId.toUpperCase()
// + MPEConstants.DATE_FORMAT_MMDDYYYYHHMM.format(dtg) + "Z");
String where = " where radId = '" + radId + "' and obstime = '"
+ HydroConstants.DATE_FORMAT.format(dtg) + "'";
String query = "select grid_filename from dpaRadar " + where;
@ -103,6 +102,300 @@ public class RadarDataManager {
return filename;
}
/**
* Get the DAA filename.
*
* @param radId
* The radar id
* @param dtg
* The obstime for the record and the associated file name
* @return The filename
* @throws VizException
*/
public String getDAAFileName(String radId, Date dtg) throws VizException {
String filename = null;
String where = " where radId = '" + radId + "' and obstime = '"
+ HydroConstants.DATE_FORMAT.format(dtg) + "'";
String query = "select grid_filename from daaRadar " + where;
System.out.println(query);
List<Object[]> rs = DirectDbQuery.executeQuery(query,
HydroConstants.IHFS, QueryLanguage.SQL);
if (rs.size() > 0) {
filename = (String) rs.get(0)[0];
System.out.println("DAA filename: " + filename);
}
return filename;
}
/**
* Get the closest obstime to the TOH (top of hour) from either the DpaRadar table or the DaaRadar table,
* within the time window.
* @param topOfHourDateTime
* The current time looking for
* @return The best obstime for topOfHourDateTime
* @throws VizException
*/
public Date getClosestObstimeToTOH(String radId, Date topOfHourDateTime, String tableName)
{
AppsDefaults ad = AppsDefaults.getInstance();
int timeWindow = 0;
if (tableName.equalsIgnoreCase("DpaRadar"))
{
timeWindow = ad.getInt("dpa_wind", 10);
}
else if (tableName.equalsIgnoreCase("DaaRadar"))
{
timeWindow = ad.getInt("daa_wind", 10);
}
else
{
throw(new Error("You must pass in either DaaRadar or DpaRadar"));
}
Date beforeTime = getLatestObstimeBeforeTOH(radId, topOfHourDateTime, tableName);
Date atOrAfterTime = getEarliestObstimeOnOrAfterTOH(radId, topOfHourDateTime, tableName);
Date bestObstime = getBestObsTime(topOfHourDateTime, beforeTime, atOrAfterTime, timeWindow);
return bestObstime;
}
public Date getObstimeAtTOH(String radId, Date topOfHourDateTime, String tableName)
{
//TableName can be either "dparadar" or "daaradar"
Date bestObstime = null;
// Get the next hour
Calendar cal = new GregorianCalendar();
cal.setTime(topOfHourDateTime);
// cal.add(Calendar.HOUR, 1);
// Query for the latest obstime less than the next hour
String where = " where obstime = '"
+ HydroConstants.DATE_FORMAT.format(cal.getTime())
+ "' and radId = '" + radId + "'";
String query = "select obstime from " + tableName + " " + where;
try
{
List<Object[]> rs = DirectDbQuery.executeQuery(query,
HydroConstants.IHFS, QueryLanguage.SQL);
if (rs.size() > 0)
{
bestObstime = topOfHourDateTime;
}
else
{
bestObstime = null;
}
}
catch(VizException e)
{
e.printStackTrace();
bestObstime = null;
}
return bestObstime;
}
public Date getLatestObstimeBeforeTOH(String radId, Date topOfHourDateTime, String tableName)
{
Date latestObsTime = null;
// Get the next hour
Calendar topOfHourCalendar = new GregorianCalendar();
topOfHourCalendar.setTime(topOfHourDateTime);
Calendar previousTopOfHourCalendar = new GregorianCalendar();
previousTopOfHourCalendar.setTime(topOfHourDateTime);
previousTopOfHourCalendar.add(Calendar.HOUR, -1);
// Query for the latest obstime less than the next hour
String where = " where obstime < '"
+ HydroConstants.DATE_FORMAT.format(topOfHourCalendar.getTime())
+ "' AND obstime >= '"
+ HydroConstants.DATE_FORMAT.format(previousTopOfHourCalendar.getTime())
+ "' AND radId = '" + radId + "'";
String query = "select max(obstime) from " + tableName + " " + where;
try
{
List<Object[]> rs = DirectDbQuery.executeQuery(query,
HydroConstants.IHFS, QueryLanguage.SQL);
if (rs.size() > 0) {
latestObsTime = (Date) rs.get(0)[0];
}
else
{
latestObsTime = null;
}
}
catch (VizException e)
{
e.printStackTrace();
latestObsTime = null;
}
return latestObsTime;
}
public Date getEarliestObstimeOnOrAfterTOH(String radId, Date topOfHourDateTime, String tableName)
{
Date earliestObsTime = null;
// Get the next hour
Calendar topOfHourCalendar = new GregorianCalendar();
topOfHourCalendar.setTime(topOfHourDateTime);
Calendar nextTopOfHourCalendar = new GregorianCalendar();
nextTopOfHourCalendar.setTime(topOfHourDateTime);
nextTopOfHourCalendar.add(Calendar.HOUR, 1);
// Query for the latest obstime less than the next hour
String where = " where obstime >= '"
+ HydroConstants.DATE_FORMAT.format(topOfHourCalendar.getTime())
+ "' AND obstime < '"
+ HydroConstants.DATE_FORMAT.format(nextTopOfHourCalendar.getTime())
+ "' AND radId = '" + radId + "'";
String query = "select min(obstime) from " + tableName + " " + where;
try
{
List<Object[]> rs = DirectDbQuery.executeQuery(query,
HydroConstants.IHFS, QueryLanguage.SQL);
if (rs.size() > 0) {
earliestObsTime = (Date) rs.get(0)[0];
}
else
{
earliestObsTime = null;
}
}
catch (VizException e)
{
e.printStackTrace();
earliestObsTime = null;
}
return earliestObsTime;
}
private Date getBestObsTime(Date topOfHourDateTime,
Date beforeTOHDateTime,
Date atOrAfterTOHDateTime,
int timeWindowInMinutes)
{
Date bestDateTime = null;
final long MILLIS_PER_MINUTE = 1000 * 60;
long startTime = topOfHourDateTime.getTime() - timeWindowInMinutes * MILLIS_PER_MINUTE;
long endTime = topOfHourDateTime.getTime() + timeWindowInMinutes * MILLIS_PER_MINUTE;
long topOfHourTime = topOfHourDateTime.getTime();
long atOrAfterTime = -1;
long beforeTime = -1;
long millisAfter = -1;
long millisBefore = -1;
//check the obstime that is at or after the TOH
if (atOrAfterTOHDateTime != null )
{
atOrAfterTime = atOrAfterTOHDateTime.getTime();
//Check the time window
if ( (atOrAfterTime >= topOfHourTime) && (atOrAfterTime <= endTime) )
{
millisAfter = atOrAfterTime - topOfHourTime;
//Check for exactly TOH
if (millisAfter == 0)
{
return topOfHourDateTime; //found record exactly at TOH
}
}
}
if ( beforeTOHDateTime != null)
{
beforeTime = beforeTOHDateTime.getTime();
if ( (beforeTime >= startTime) && (beforeTime < topOfHourTime) )
{
millisBefore = topOfHourTime - beforeTime;
}
}
//both valid
if ( (millisAfter >= 0) && (millisBefore > 0 ) )
{
if (millisAfter <= millisBefore)
{
//after time wins
bestDateTime = atOrAfterTOHDateTime;
}
else
{
//before time wins
bestDateTime = beforeTOHDateTime;
}
}
//before is null
else if (millisAfter >= 0)
{
bestDateTime = atOrAfterTOHDateTime;
}
else if (millisBefore > 0)
{
bestDateTime = beforeTOHDateTime;
}
else //There are no valid records within the time window
{
bestDateTime = null;
}
return bestDateTime;
}
/**
* Get the latest obstime from the DpaRadar table.
*
@ -111,6 +404,13 @@ public class RadarDataManager {
* @return The max obstime for that date
* @throws VizException
*/
/*
* this function was previously used (erroneously) to find the date/time for a search
* in the RWRadarResult table for the 4 panel window
* it is not used anywhere else
* PST - 1/10/14
*/
public Date getLatestObstimeDpaRadar(String radId, Date date)
throws VizException {
Date latest = null;
@ -215,7 +515,7 @@ public class RadarDataManager {
* @return true if ignore_radar set to 'y'
* @throws VizException
*/
public boolean getIgnoreRadar(String radId, Date dpaDate)
public boolean getIgnoreRadarSP(String radId, Date dpaDate)
throws VizException {
boolean ignore = false;
@ -230,6 +530,8 @@ public class RadarDataManager {
+ HydroConstants.DATE_FORMAT.format(dpaDate) + "'";
final String query = "select ignore_radar from rwRadarResult ";
//System.out.printf("getIgnoreRadarSP: query = %s %s\n" ,query, where);
List<Object[]> rs = DirectDbQuery.executeQuery(query + where,
HydroConstants.IHFS, QueryLanguage.SQL);
@ -243,6 +545,46 @@ public class RadarDataManager {
return ignore;
}
/**
* Get the ignore_radar value in IHFS.
*
* @param radId
* The Radar ID
* @param dpaDate
* The data date
* @return true if ignore_radar set to 'y'
* @throws VizException
*/
public boolean getIgnoreRadarDP(String radId, Date daaDate)
throws VizException {
boolean ignore = false;
// need date to be to the current hour
Calendar cal = new GregorianCalendar();
cal.setTime(daaDate);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
daaDate = cal.getTime();
final String where = "WHERE radid='" + radId + "' AND obstime='"
+ HydroConstants.DATE_FORMAT.format(daaDate) + "'";
final String query = "select ignore_radar from DAARadarResult ";
//System.out.printf("getIgnoreRadarDP: query = %s %s\n" ,query, where);
List<Object[]> rs = DirectDbQuery.executeQuery(query + " " + where,
HydroConstants.IHFS, QueryLanguage.SQL);
if (rs.size() > 0) {
String value = (String) rs.get(0)[0];
if (value.equalsIgnoreCase("Y")) {
ignore = true;
}
}
return ignore;
}
/**
* Update the ignore_radar field in rwRadarResult table in IHFS.
*
@ -253,7 +595,7 @@ public class RadarDataManager {
* @return number of rows modified
* @throws VizException
*/
public int updateIgnoreRadar(String radId, Date dpaDate, boolean ignoreRadar)
public int updateIgnoreRadarSP(String radId, Date dpaDate, boolean ignoreRadar)
throws VizException {
int status = 1;
@ -277,6 +619,50 @@ public class RadarDataManager {
final String sql = "update rwRadarResult set ignore_radar = '" + ignore
+ "' ";
//System.out.printf("updateIgnoreRadarSP: query = %s %s\n" ,sql, where);
status = DirectDbQuery.executeStatement(sql + where,
HydroConstants.IHFS, QueryLanguage.SQL);
return status;
}
/**
* Update the ignore_radar field in DAARadarResult table in IHFS.
*
* @param radId
* The radar id field
* @param ignoreRadar
* true to ignore radar
* @return number of rows modified
* @throws VizException
*/
public int updateIgnoreRadarDP(String radId, Date daaDate, boolean ignoreRadar)
throws VizException {
int status = 1;
// need date to be to the current hour
Calendar cal = new GregorianCalendar();
cal.setTime(daaDate);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
daaDate = cal.getTime();
final String where = "WHERE radid='" + radId + "' AND obstime='"
+ HydroConstants.DATE_FORMAT.format(daaDate) + "'";
String ignore = null;
if (ignoreRadar) {
ignore = "y";
} else {
ignore = "n";
}
final String sql = "update DAARadarResult set ignore_radar = '" + ignore
+ "' ";
//System.out.printf("updateIgnoreRadarDP: query = %s %s\n" ,sql, where);
status = DirectDbQuery.executeStatement(sql + where,
HydroConstants.IHFS, QueryLanguage.SQL);
@ -400,18 +786,18 @@ public class RadarDataManager {
}
/**
* Get the ignore_radar value in IHFS.
* Get the rad_avail value from RWRadarResult table
*
* @param radId
* The Radar ID
* @param dpaDate
* The data date
* @return true if ignore_radar set to 'y'
* @throws VizException
* @return int 0 = available with > 0 precip
* 1 = not available
* 2 = available with all precip == 0
*/
public int getAvailableRadar(String radId, Date dpaDate)
public int getAvailableRadarSP(String radId, Date dpaDate)
throws VizException {
int avail = 0;
// need date to be to the current hour
Calendar cal = new GregorianCalendar();
@ -424,12 +810,61 @@ public class RadarDataManager {
+ HydroConstants.DATE_FORMAT.format(dpaDate) + "'";
final String query = "select rad_avail from rwRadarResult ";
System.out.printf("getAvailableRadarSP: query = %s %s\n" ,query, where);
List<Object[]> rs = DirectDbQuery.executeQuery(query + where,
HydroConstants.IHFS, QueryLanguage.SQL);
if (rs.size() > 0) {
// if record not found, then rs.size() = 0
int avail = 1;
if (rs.size() > 0)
{
String value = (String) rs.get(0)[0];
avail = 1;
if ("y".equals(value)) {
avail = 0;
} else if ("z".equals(value)) {
avail = 2;
}
}
return avail;
}
//---------------------------------------------
/**
* Get the rad_avail value from the DAARadarResult table
*
* @param radId
* The Radar ID
* @param dpaDate
* The data date
* @return int 0 = available with > 0 precip
* 1 = not available
* 2 = available with all precip == 0
*/
public int getAvailableRadarDP(String radId, Date daaDate)
throws VizException {
// need date to be to the current hour
Calendar cal = new GregorianCalendar();
cal.setTime(daaDate);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
daaDate = cal.getTime();
final String where = "WHERE radid='" + radId + "' AND obstime='"
+ HydroConstants.DATE_FORMAT.format(daaDate) + "'";
final String query = "select rad_avail from DAARadarResult ";
System.out.printf("getAvailableRadarDP: query = %s %s\n" ,query, where);
List<Object[]> rs = DirectDbQuery.executeQuery(query + where,
HydroConstants.IHFS, QueryLanguage.SQL);
// if record not found, then rs.size() = 0
int avail = 1;
if (rs.size() > 0)
{
String value = (String) rs.get(0)[0];
if ("y".equals(value)) {
avail = 0;
} else if ("z".equals(value)) {

View file

@ -111,6 +111,9 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
/** Apps Default DPA Grid Directory token. */
private static final String DPA_GRID_DIR_TOKEN = "dpa_grid_dir";
/** Apps Default DAA Grid Directory token. */
private static final String DAA_GRID_DIR_TOKEN = "daa_grid_dir";
/** Apps Default Radar Coverage Directory token. */
private static final String RADAR_COVERAGE_DIR_TOKEN = "rfcwide_misbin_dir";
@ -147,23 +150,27 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
/** The radar Id */
private String radId = null;
/** Radar bias value */
/** Radar SP bias value */
private String biasValue = null;
/** Raw Radar resource */
private DPAResource rawRadarRsc = null;
/** Raw SP Radar resource */
private DPAResource rawSPRadarRsc = null;
/** Raw DP Radar resource */
private DPAResource rawDPRadarRsc = null;
/** Bias Radar resource */
private DPAResource biasRadarRsc = null;
/** Radar Climo resource */
private DPAResource climoRadarRsc = null;
/** Radar Misbin resource */
private RadarCoverageResource misbinRadarRsc = null;
private Date dpaDate = null;
private Date dpaDate = null; //top-of-hour datetime
private Date daaDate = null; //top-of-hour datetime
private Date dpaProductDateTime = null; //used for the queries in the DPARadar and DPAAdapt tables
private Date daaProductDateTime = null; //used for the query in the DAARadar table
/** Popup displayed flag */
private boolean popupOpen = false;
@ -177,30 +184,28 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
* @param radId
* The radar id
*/
public ReviewHourlyRadarDlg(Shell parentShell, String radId) {
public ReviewHourlyRadarDlg(Shell parentShell, String radId)
{
super(parentShell);
setText("Single Radar Site");
this.radId = radId;
biasValue = getBiasValue(radId);
// try {
// this code is generating the TOH date/time (ex: 14:00)
dpaDate = MPEDisplayManager.getCurrent().getCurrentEditDate();
// Changed to comply with DR 11395
// dpaDate =
// RadarDataManager.getInstance().getLatestObstimeDpaRadar(
// radId, MPEDisplayManager.getCurrent().getCurrentDate());
// }
// catch (VizException e) {
// e.printStackTrace();
// dpaDate = MPEDisplayManager.getCurrent().getCurrentDate();
// }
daaDate = MPEDisplayManager.getCurrent().getCurrentEditDate();
dpaProductDateTime = RadarDataManager.getInstance().getClosestObstimeToTOH(radId, dpaDate, "DPARadar");
daaProductDateTime = RadarDataManager.getInstance().getClosestObstimeToTOH(radId, daaDate, "DAARadar");
}
@Override
protected Layout constructShellLayout() {
protected Layout constructShellLayout()
{
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, true);
mainLayout.marginHeight = 1;
@ -211,7 +216,8 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
}
@Override
protected void initializeComponents(Shell shell) {
protected void initializeComponents(Shell shell)
{
setReturnValue(false);
// Initialize all of the controls and layout
initializeComponents();
@ -220,7 +226,8 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
/**
* Initialize the gui widgets
*/
private void initializeComponents() {
private void initializeComponents()
{
Composite comp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(1, true);
gl.horizontalSpacing = 1;
@ -296,31 +303,67 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
}
});
// Ignore Radar menu item
boolean ignoreRadar = false;
// Ignore Radar SP menu item
boolean ignoreRadarSP = false;
try {
ignoreRadar = radarDataManager.getIgnoreRadar(radId, dpaDate);
ignoreRadarSP = radarDataManager.getIgnoreRadarSP(radId, dpaDate);
} catch (VizException e) {
System.err.println("Error getting Ignore Radar Flag from IHFS");
System.err.println("Error getting Ignore SP Radar Flag from IHFS");
}
MenuItem ignoreRadarMI = new MenuItem(optionsMenu, SWT.CHECK);
ignoreRadarMI.setText("Ignore Radar");
ignoreRadarMI.setSelection(ignoreRadar);
ignoreRadarMI.addSelectionListener(new SelectionAdapter() {
MenuItem ignoreRadarSPMI = new MenuItem(optionsMenu, SWT.CHECK);
ignoreRadarSPMI.setText("Ignore Single Pol Radar Product");
ignoreRadarSPMI.setSelection(ignoreRadarSP);
ignoreRadarSPMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
MenuItem ir = (MenuItem) event.getSource();
boolean ignoreRadar = ir.getSelection();
boolean ignoreRadarSP = ir.getSelection();
try {
int status = RadarDataManager.getInstance()
.updateIgnoreRadar(radId, dpaDate, ignoreRadar);
.updateIgnoreRadarSP(radId, dpaDate, ignoreRadarSP);
if (status == 0) {
System.err.println("Update not successful");
System.err.println("Update of Ignore SP field not successful");
}
} catch (VizException e) {
System.err
.println("Error updating ignore radar flag in IHFS");
System.err.println("Error updating ignore SP radar flag in IHFS");
}
for (IDisplayPane pane : getDisplayPanes()) {
List<DPAResource> rscs = pane.getDescriptor()
.getResourceList()
.getResourcesByTypeAsType(DPAResource.class);
for (DPAResource rsc : rscs) {
rsc.update();
}
}
}
});
// Ignore Radar DP menu item
boolean ignoreRadarDP = false;
try {
ignoreRadarDP = radarDataManager.getIgnoreRadarDP(radId, daaDate);
} catch (VizException e) {
System.err.println("Error getting Ignore DP Radar Flag from IHFS");
}
MenuItem ignoreRadarDPMI = new MenuItem(optionsMenu, SWT.CHECK);
ignoreRadarDPMI.setText("Ignore Dual Pol Radar Product");
ignoreRadarDPMI.setSelection(ignoreRadarDP);
ignoreRadarDPMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
MenuItem ir = (MenuItem) event.getSource();
boolean ignoreRadarDP = ir.getSelection();
try {
int status = RadarDataManager.getInstance()
.updateIgnoreRadarDP(radId, daaDate, ignoreRadarDP);
if (status == 0) {
System.err.println("Update of Ignore DP field not successful");
}
} catch (VizException e) {
System.err.println("Error updating ignore DP radar flag in IHFS");
}
for (IDisplayPane pane : getDisplayPanes()) {
@ -336,11 +379,11 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
// Display Adaptable Param menu item
MenuItem displayAdaptableParamMI = new MenuItem(optionsMenu, SWT.NONE);
displayAdaptableParamMI.setText("Display Adaptable Param");
displayAdaptableParamMI.setText("Display SP Adaptable Param");
displayAdaptableParamMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
DisplayDlg dlg = new DisplayDlg(shell, radId, dpaDate,
DisplayDlg dlg = new DisplayDlg(shell, radId, dpaProductDateTime,
((MenuItem) event.getSource()).getText());
dlg.open();
}
@ -348,7 +391,7 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
// Display Supplemental Data menu item
MenuItem displaySuppDataMI = new MenuItem(optionsMenu, SWT.NONE);
displaySuppDataMI.setText("Display Supplemental Data");
displaySuppDataMI.setText("Display SP Supplemental Data");
displaySuppDataMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
@ -526,16 +569,34 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
// TODO: Replace with resources looking up color maps themselves!!!
List<Colorvalue> colorSet = GetColorValues.get_colorvalues(user_id,
app_name, "RMOSAIC", 3600, "E", pColorSetGroup);
app_name, "PRECIP_ACCUM", 3600, "E", pColorSetGroup);
List<Colorvalue> radCovColorSet = GetColorValues.get_colorvalues(
user_id, app_name, "RADCOV", 3600, "E", pColorSetGroup);
// Get the DPA Data
String dpaFilename = radarManager.getDPAFileName(radId, dpaDate);
String dirname = appsDefaults.getToken(DPA_GRID_DIR_TOKEN);
DPAFile dpaFile = new DPAFile(dirname + "/" + dpaFilename);
if (dpaProductDateTime == null)
{
dpaProductDateTime = dpaDate;
}
String dpaFilename = radarManager.getDPAFileName(radId, dpaProductDateTime);
String dpaDirname = appsDefaults.getToken(DPA_GRID_DIR_TOKEN);
DPAFile dpaFile = new DPAFile(dpaDirname + "/" + dpaFilename);
dpaFile.setBiasValue(Double.parseDouble(biasValue));
// Get the DAA Data
if (daaProductDateTime == null)
{
daaProductDateTime = daaDate;
}
String daaFilename = radarManager.getDAAFileName(radId, daaProductDateTime);
String daaDirname = appsDefaults.getToken(DAA_GRID_DIR_TOKEN);
DPAFile daaFile = new DPAFile(daaDirname + "/" + daaFilename);
daaFile.setBiasValue(1.00); //probably not needed
// Get the Radar Coverage Data
String radCovFilename = "misbin." + radId;
String radCovDirname = appsDefaults
@ -543,17 +604,27 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
RadarCoverageFile radCovFile = new RadarCoverageFile(radCovDirname
+ "/" + radCovFilename);
// Pane 0 (SP radar display)
//
// note the following case :
// ignoreRadar flag for raw SP radar is set to ON and window is popped down
// then window is popped up (without rerunning MPEFieldGen)
// raw SP radar (pane 0) shows "Missing Data"
// if MPEFieldGen is rerun, then pane 0 will display raw SP radar
//
int ngrd = radarManager.getNgrd(radId);
rawRadarRsc = new DPAResource(dpaFile, colorSet, radId,
SingleSiteRadarType.RAW_RADAR, ngrd);
panes[0].getDescriptor().getResourceList().add(rawRadarRsc);
// Load the gage overlay data to the map
rawSPRadarRsc = new DPAResource(dpaFile, colorSet, radId,
SingleSiteRadarType.RAW_SP_RADAR, ngrd);
panes[0].getDescriptor().getResourceList().add(rawSPRadarRsc);
RadarGageOverlayRscData rscData = new RadarGageOverlayRscData(
"Precip Gages", null);
"Precip Gages", null);
RadarGageOverlayRsc gageRsc = rscData.construct(
new LoadProperties(), EditorUtil.getActiveVizContainer()
.getActiveDisplayPane().getDescriptor());
ResourceProperties gageResourceProperties = new ResourceProperties();
gageResourceProperties.setMapLayer(true);
gageResourceProperties.setSystemResource(false);
@ -561,27 +632,30 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
gageResourceProperties.setResource(gageRsc);
panes[0].getDescriptor().getResourceList()
.add(gageRsc, gageResourceProperties);
climoRadarRsc = new DPAResource(dpaFile, colorSet, radId,
SingleSiteRadarType.RADAR_CLIMATOLOGY, ngrd);
// Load the dpa data to the map
panes[1].getDescriptor().getResourceList().add(climoRadarRsc);
// Pane 1 (DP radar display)
rawDPRadarRsc = new DPAResource(daaFile, colorSet, radId,
SingleSiteRadarType.RAW_DP_RADAR, ngrd);
panes[1].getDescriptor().getResourceList().add(rawDPRadarRsc);
panes[1].getDescriptor().getResourceList()
.add(gageRsc, gageResourceProperties);
.add(gageRsc, gageResourceProperties);
// Pane 2 (MFB corrected SP radar display)
biasRadarRsc = new DPAResource(dpaFile, colorSet, radId,
SingleSiteRadarType.MEAN_FIELD_BIAS_CORRECTED_RADAR, ngrd);
SingleSiteRadarType.MEAN_FIELD_BIAS_CORRECTED_SP_RADAR, ngrd);
// Load the dpa data to the map
panes[2].getDescriptor().getResourceList().add(biasRadarRsc);
panes[2].getDescriptor().getResourceList()
.add(gageRsc, gageResourceProperties);
// Pane 3 (radar coverage map display)
misbinRadarRsc = new RadarCoverageResource(radCovFile,
radCovColorSet, radId, ngrd);
// Load the dpa data to the map
panes[3].getDescriptor().getResourceList().add(misbinRadarRsc);
panes[3].getDescriptor().getResourceList()
.add(gageRsc, gageResourceProperties);
@ -703,7 +777,7 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
PixelOrientation.LOWER_LEFT);
/* Get local hrap coordinate */
Rectangle localHrapExtent = rawRadarRsc.getExtent();
Rectangle localHrapExtent = rawSPRadarRsc.getExtent();
int localX = (int) (hp.x - localHrapExtent.x);
int localY = (int) (hp.y - localHrapExtent.y);
@ -727,22 +801,33 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
* value divided by 100 and divided by 25.4 to convert to inches in
* locator popup
*/
double value = rawRadarRsc.getData()[localX][localY] / 100 / 25.4;
double value;
value = rawSPRadarRsc.getData()[localX][localY] / 100 / 25.4;
if (value >= 0) {
buffer.append("Raw Radar: " + String.format("%.3f", value)
buffer.append("Raw SP Radar: " + String.format("%.3f", value)
+ " in");
} else {
buffer.append("Raw Radar: missing");
buffer.append("Raw SP Radar: missing");
}
buffer.append(newLine);
value = biasRadarRsc.getData()[localX][localY] / 100 / 25.4;
value = rawDPRadarRsc.getData()[localX][localY] / 100 / 25.4;
if (value >= 0) {
buffer.append("Unbiased Radar: " + String.format("%.3f", value)
buffer.append("Raw DP Radar: " + String.format("%.3f", value)
+ " in");
} else {
buffer.append("Unbiased Radar: missing");
buffer.append("Raw DP Radar: missing");
}
buffer.append(newLine);
value = biasRadarRsc.getData()[localX][localY] / 100 / 25.4;
if (value >= 0) {
buffer.append("Unbiased SP Radar: " + String.format("%.3f", value)
+ " in");
} else {
buffer.append("Unbiased SP Radar: missing");
}
buffer.append(newLine);
@ -830,7 +915,7 @@ public class ReviewHourlyRadarDlg extends CaveSWTDialog implements
private String getBiasValue(String radId) {
MPERadarData radarData = MPEDataManager
.getInstance()
.readRadarData(
.readSPRadarData(
MPEDisplayManager.getCurrent().getCurrentEditDate())
.get(radId);
return String.format("%-1.2f", radarData.getRwBiasValUsed());

View file

@ -31,6 +31,7 @@ import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
@ -75,6 +76,9 @@ public class DrawPolygonDlg extends CaveSWTDialog {
private static final String MAKE_PERSISTENT = "Make Persistent";
private DisplayFieldData[] displayFieldDataArray;
private String[] displayTypeNameArray;
/**
* Bold Font.
*/
@ -85,6 +89,11 @@ public class DrawPolygonDlg extends CaveSWTDialog {
*/
private Font font = null;
/**
* The field type selection Combo control.
*/
private Combo fieldTypeCombo = null;
/**
* The precip value spinner control.
*/
@ -191,7 +200,7 @@ public class DrawPolygonDlg extends CaveSWTDialog {
GridData gd = new GridData(345, SWT.DEFAULT);
subGroup.setLayoutData(gd);
getSubChecks(subGroup);
createFieldCombo(subGroup);
// Create Substitute button
final Button subBtn = new Button(subGroup, SWT.PUSH);
@ -313,398 +322,80 @@ public class DrawPolygonDlg extends CaveSWTDialog {
* @param groupComp
* The group composite
*/
private void getSubChecks(Group groupComp) {
private void createFieldCombo(Group groupComp) {
// Spacer
Label spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
// Create a container to hold the label and the combo box.
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite prodListComp = new Composite(shell, SWT.NONE);
GridLayout prodListCompLayout = new GridLayout(2, false);
prodListComp.setLayout(prodListCompLayout);
prodListComp.setLayoutData(gd);
Button radarMosaicChk = new Button(groupComp, SWT.RADIO);
GridData gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
radarMosaicChk.setLayoutData(gd);
radarMosaicChk.setText("Radar Mosaic");
radarMosaicChk.setFont(font);
radarMosaicChk.setLayoutData(gd);
// Default to radar mosaic on dialog creation
radarMosaicChk.setSelection(true);
subType = DisplayFieldData.rMosaic;
radarMosaicChk.addSelectionListener(new SelectionAdapter() {
gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
Label fieldTypeLabel = new Label(prodListComp, SWT.CENTER);
fieldTypeLabel.setText(SUBSTITUTE_VALUE_TEXT);
fieldTypeLabel.setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
fieldTypeCombo = new Combo(groupComp, SWT.LEFT | SWT.DROP_DOWN
| SWT.READ_ONLY);
if (displayFieldDataArray == null)
{
displayFieldDataArray = MPEDisplayManager.mpe_qpe_fields;
}
// Label spaceLabel = new Label(groupComp, SWT.NONE);
// spaceLabel.setText("***** ");
int selectedFieldIndex = 0;
//find the index of the selected field
for (selectedFieldIndex = 0; selectedFieldIndex < displayFieldDataArray.length; selectedFieldIndex++)
{
if (displayFieldDataArray[selectedFieldIndex] == subType)
{
break;
}
}
//create and initialize the display field type name array
displayTypeNameArray = new String[displayFieldDataArray.length];
for (int i = 0; i < displayFieldDataArray.length; i++) {
String fieldName = displayFieldDataArray[i].toString();
// System.out.println("DrawPolygon.createFieldCombo(): FieldName = :" + fieldName + ":");
displayTypeNameArray[i] = fieldName;
}
//select the field
fieldTypeCombo.setTextLimit(35);
fieldTypeCombo.setLayoutData(gd);
fieldTypeCombo.setItems(displayTypeNameArray);
fieldTypeCombo.select(selectedFieldIndex);
fieldTypeCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.rMosaic;
}
String selectedFieldString = fieldTypeCombo.getText();
// System.out.println("DrawPolygon.createFieldCombo(): selectedFieldString = " +
// selectedFieldString);
subType = DisplayFieldData.fromDisplayNameString(selectedFieldString);
// if (subType != null)
// {
// System.out.println("DrawPolygon.createFieldCombo(): subType = " +
// subType.toString());
// }
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button avgRadarMosaicChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
avgRadarMosaicChk.setLayoutData(gd);
avgRadarMosaicChk.setText("Average Radar Mosaic");
avgRadarMosaicChk.setFont(font);
avgRadarMosaicChk.setLayoutData(gd);
avgRadarMosaicChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.avgrMosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button maxRadarMosaicChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
maxRadarMosaicChk.setLayoutData(gd);
maxRadarMosaicChk.setText("Max Radar Mosaic");
maxRadarMosaicChk.setFont(font);
maxRadarMosaicChk.setLayoutData(gd);
maxRadarMosaicChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.maxrMosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button fieldBiasRadarMosaicChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
fieldBiasRadarMosaicChk.setLayoutData(gd);
fieldBiasRadarMosaicChk.setText("Field Bias Radar Mosaic");
fieldBiasRadarMosaicChk.setFont(font);
fieldBiasRadarMosaicChk.setLayoutData(gd);
fieldBiasRadarMosaicChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.bMosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button localBiasRadarMosaicChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
localBiasRadarMosaicChk.setLayoutData(gd);
localBiasRadarMosaicChk.setText("Local Bias Radar Mosaic");
localBiasRadarMosaicChk.setFont(font);
localBiasRadarMosaicChk.setLayoutData(gd);
localBiasRadarMosaicChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.lMosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button gageOnlyChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
gageOnlyChk.setLayoutData(gd);
gageOnlyChk.setText("Gage Only Analysis");
gageOnlyChk.setFont(font);
gageOnlyChk.setLayoutData(gd);
gageOnlyChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.gageOnly;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button multiSensorMosaicChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
multiSensorMosaicChk.setLayoutData(gd);
multiSensorMosaicChk.setText("Multisensor Mosaic");
multiSensorMosaicChk.setFont(font);
multiSensorMosaicChk.setLayoutData(gd);
multiSensorMosaicChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.mMosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button localBiasMultiSensorMosaicChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
localBiasMultiSensorMosaicChk.setLayoutData(gd);
localBiasMultiSensorMosaicChk.setText("Local Bias Multisensor Mosaic");
localBiasMultiSensorMosaicChk.setFont(font);
localBiasMultiSensorMosaicChk.setLayoutData(gd);
localBiasMultiSensorMosaicChk
.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.mlMosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button satPrecipChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
satPrecipChk.setLayoutData(gd);
satPrecipChk.setText("Satellite Precip");
satPrecipChk.setFont(font);
satPrecipChk.setLayoutData(gd);
satPrecipChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.satPre;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button localBiasSatPrecipChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
localBiasSatPrecipChk.setLayoutData(gd);
localBiasSatPrecipChk.setText("Local Bias Satellite Precip");
localBiasSatPrecipChk.setFont(font);
localBiasSatPrecipChk.setLayoutData(gd);
localBiasSatPrecipChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.lsatPre;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button satRadarMosaicChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
satRadarMosaicChk.setLayoutData(gd);
satRadarMosaicChk.setText("Satellite Radar Mosaic");
satRadarMosaicChk.setFont(font);
satRadarMosaicChk.setLayoutData(gd);
satRadarMosaicChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.srMosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button satGageMosaicChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
satGageMosaicChk.setLayoutData(gd);
satGageMosaicChk.setText("Satellite Gage Mosaic");
satGageMosaicChk.setFont(font);
satGageMosaicChk.setLayoutData(gd);
satGageMosaicChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.sgMosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button satRadarGageMosaicChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
satRadarGageMosaicChk.setLayoutData(gd);
satRadarGageMosaicChk.setText("Satellite Radar Gage Mosaic");
satRadarGageMosaicChk.setFont(font);
satRadarGageMosaicChk.setLayoutData(gd);
satRadarGageMosaicChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.srgMosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button triangulatedLocalBiasMosaicChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
triangulatedLocalBiasMosaicChk.setLayoutData(gd);
triangulatedLocalBiasMosaicChk
.setText("Triangulated Local Bias Mosaic");
triangulatedLocalBiasMosaicChk.setFont(font);
triangulatedLocalBiasMosaicChk.setLayoutData(gd);
triangulatedLocalBiasMosaicChk
.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.p3lMosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button bestEstQPEChk = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
bestEstQPEChk.setLayoutData(gd);
bestEstQPEChk.setText("Best Estimate QPE");
bestEstQPEChk.setFont(font);
bestEstQPEChk.setLayoutData(gd);
bestEstQPEChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.Xmrg;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button rfcFieldBiasMosaic = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
rfcFieldBiasMosaic.setLayoutData(gd);
rfcFieldBiasMosaic.setText("RFC Field Bias Mosaic");
rfcFieldBiasMosaic.setFont(font);
rfcFieldBiasMosaic.setLayoutData(gd);
rfcFieldBiasMosaic.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.rfcbMosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button rfcMultiSensorMosaic = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
rfcMultiSensorMosaic.setLayoutData(gd);
rfcMultiSensorMosaic.setText("RFC Multisensor Mosaic");
rfcMultiSensorMosaic.setFont(font);
rfcMultiSensorMosaic.setLayoutData(gd);
rfcMultiSensorMosaic.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.rfcmMosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button rawQ2Mosaic = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
rawQ2Mosaic.setLayoutData(gd);
rawQ2Mosaic.setText("Raw Q2 Mosaic");
rawQ2Mosaic.setFont(font);
rawQ2Mosaic.setLayoutData(gd);
rawQ2Mosaic.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.qmosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button localBQ2Mosaic = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
localBQ2Mosaic.setLayoutData(gd);
localBQ2Mosaic.setText("Local Bias Q2 Mosaic");
localBQ2Mosaic.setFont(font);
localBQ2Mosaic.setLayoutData(gd);
localBQ2Mosaic.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.lqmosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button mQ2Mosaic = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
mQ2Mosaic.setLayoutData(gd);
mQ2Mosaic.setText("Multisensor Q2 Mosaic");
mQ2Mosaic.setFont(font);
mQ2Mosaic.setLayoutData(gd);
mQ2Mosaic.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.mlqmosaic;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button local1Mosaic = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
local1Mosaic.setLayoutData(gd);
local1Mosaic.setText("Local Field #1");
local1Mosaic.setFont(font);
local1Mosaic.setLayoutData(gd);
local1Mosaic.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.localField1;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button local2Mosaic = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
local2Mosaic.setLayoutData(gd);
local2Mosaic.setText("Local Field #2");
local2Mosaic.setFont(font);
local2Mosaic.setLayoutData(gd);
local2Mosaic.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.localField2;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button local3Mosaic = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
local3Mosaic.setLayoutData(gd);
local3Mosaic.setText("Local Field #3");
local3Mosaic.setFont(font);
local3Mosaic.setLayoutData(gd);
local3Mosaic.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.localField3;
}
});
spaceLabel = new Label(groupComp, SWT.NONE);
spaceLabel.setText(" ");
Button rfcQpeMosaic = new Button(groupComp, SWT.RADIO);
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
rfcQpeMosaic.setLayoutData(gd);
rfcQpeMosaic.setText("RFC QPE Mosaic");
rfcQpeMosaic.setFont(font);
rfcQpeMosaic.setLayoutData(gd);
rfcQpeMosaic.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
subType = DisplayFieldData.rfcMosaic;
}
});
}
/**
* Process the selection.

View file

@ -0,0 +1,206 @@
package com.raytheon.viz.mpe.ui.dialogs.postanalysis;
import java.awt.Rectangle;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
import com.raytheon.viz.mpe.util.DailyQcUtils;
import com.raytheon.viz.mpe.util.DailyQcUtils.Hrap_Grid;
/**
* Reads Ascii Xmrg files and provides access to the data through 2D array.
* <p>
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* October 2013 DCS 167 C. Gobs Initial Creation
*
* </pre>
*
*
* @author Chip Gobs
*
*/
public class AsciiXmrgReader
{
//Units in the file are hundredths of inches (Paul likes to call it inches* 100)
//AWIPS 2 calls it Inches.divide(100)
// Example 12.02 inches are stored in the file as 1202.
private String filePath = null;
private Rectangle hrapExtent;
Hrap_Grid hrap_grid = null;
private int[][] gridValueArray;
private int[] data; //single dimension array
BufferedReader in = null;
public AsciiXmrgReader(String filePath)
{
this.filePath = filePath;
}
public int read()
{
hrap_grid = DailyQcUtils.getHrap_grid();
String line = null;
int originX, originY, sizeX, sizeY;
int iflag;
int fe = 0;
File tb = new File(filePath);
int arraySize = hrap_grid.maxi * hrap_grid.maxj;
setGridValueArray(new int[hrap_grid.maxi][hrap_grid.maxj]);
setData(new int[arraySize]);
// for (j = (hrap_grid.maxj - hrap_grid.hrap_miny) - 1; j >= 0; j--) {
for (int i = 0; i < (hrap_grid.maxi); i++) {
for (int j = 0; j < (hrap_grid.maxj); j++) {
gridValueArray[i][j] = 0;
}
}
//init single dimension data array
for (int i = 0; i < arraySize; i++)
{
getData()[i] = 0;
}
if (tb.lastModified() == 0 || tb.length() == 0) {
fe = 0;
}
if (fe == -1) {
return -1;
}
try {
in = new BufferedReader(new FileReader(filePath));
if (in == null) {
return -1;
}
// minhrapi = hrap_grid.hrap_minx;
// minhrapj = hrap_grid.hrap_miny;
// maxhrapi = hrap_grid.maxi;
// maxhrapj = hrap_grid.maxj;
line = in.readLine().trim();
Scanner s = new Scanner(line);
originX = (int) s.nextDouble();
originY = (int) s.nextDouble();
sizeX = (int) s.nextDouble();
sizeY = (int) s.nextDouble();
// add a check for the extent in hrap vs the file itself
String header = "AsciiXmrgReader.read(): ";
System.out.printf("%s %d %d %d %d \n", header, originX, originY, sizeX, sizeY);
// hrapExtent = new Rectangle(xOrig, yOrig, maxX, maxY);
setHrapExtent(new Rectangle(originX, originY, sizeX, sizeY));
if (s.hasNextDouble())
{
iflag = (int) s.nextDouble();
}
else
{
iflag = 0;
}
int index = 0;
System.out.println(header + " : ");
for (int i = 0; i < sizeX; i++)
{
if (iflag == 0) {
line = in.readLine().trim();
} else {
line = in.readLine().trim();
}
s = new Scanner(line);
for (int j = 0; j < sizeY; j++)
{
int dataValue = -1;
if (s.hasNextInt() == true)
{
dataValue = s.nextInt();
}
gridValueArray[i][j] = dataValue;
int maxIndex = ((sizeY * sizeX) - 1);
index = maxIndex - ( (j * sizeX) + ( sizeX -i -1) );
getData()[index] = dataValue;
}
}
in.close();
return 1;
} catch (FileNotFoundException e) {
System.out.println("File not found : " + filePath);
return -1;
} catch (IOException e) {
e.printStackTrace();
return -1;
} finally {
try {
if (in != null) {
in.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public int[][] getDataAsGrid() {
return gridValueArray;
}
public void setGridValueArray(int gridValueArray[][]) {
this.gridValueArray = gridValueArray;
}
public int[] getData() {
return data;
}
private void setData(int[] data) {
this.data = data;
}
public Rectangle getHrapExtent() {
return hrapExtent;
}
private void setHrapExtent(Rectangle hrapExtent) {
this.hrapExtent = hrapExtent;
}
}

View file

@ -19,9 +19,11 @@
**/
package com.raytheon.viz.mpe.ui.dialogs.postanalysis;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.GC;
@ -35,6 +37,7 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.NamedColorUseSet;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
@ -60,11 +63,14 @@ public abstract class BasePostAnalysisDlg extends CaveSWTDialog {
* Maps composite.
*/
protected MapsComp mapsComp = null;
protected Label leftMapLbl = null;
protected Label rightMapLbl = null;
/**
* Legend canvas.
*/
protected Canvas legendCanvas = null;
protected ColorLegendMgr colorLegendMgr = null;
/**
* Canvas height.
@ -76,6 +82,28 @@ public abstract class BasePostAnalysisDlg extends CaveSWTDialog {
*/
protected int canvasWidth = 700;
/**
* Data that belongs to the internal maps
*/
private String dataFileName1 = null;
private String dataFileName2 = null;
private float[] dataArray1 = null;
private float[] dataArray2 = null;
private java.awt.Rectangle extent1 = null;
private java.awt.Rectangle extent2 = null;
private NamedColorUseSet namedColorUseSet1 = null;
private NamedColorUseSet namedColorUseSet2 = null;
protected abstract NamedColorUseSet createNamedColorUseSet1();
protected abstract NamedColorUseSet createNamedColorUseSet2();
private PAResourceType resourceType1 = PAResourceType.XMRG;
private PAResourceType resourceType2 = PAResourceType.XMRG;
/**
* Constructor.
*
@ -84,6 +112,7 @@ public abstract class BasePostAnalysisDlg extends CaveSWTDialog {
*/
public BasePostAnalysisDlg(Shell parentShell) {
super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL | CAVE.DO_NOT_BLOCK);
}
@Override
@ -304,10 +333,10 @@ public abstract class BasePostAnalysisDlg extends CaveSWTDialog {
labelComp.setLayout(new GridLayout(2, true));
labelComp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
Label leftMapLbl = new Label(labelComp, SWT.CENTER);
leftMapLbl = new Label(labelComp, SWT.CENTER);
leftMapLbl.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
Label rightMapLbl = new Label(labelComp, SWT.CENTER);
rightMapLbl = new Label(labelComp, SWT.CENTER);
rightMapLbl.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
if (lblNames.length >= 2) {
@ -323,9 +352,11 @@ public abstract class BasePostAnalysisDlg extends CaveSWTDialog {
* Create the map composite.
*/
private void createMapComposite() {
mapsComp = new MapsComp(shell);
System.out.println(" BasePostAnalysisDl:createMapComposite(): ");
mapsComp = new MapsComp(shell, this);
}
/**
* Create the color bar legend canvas.
*/
@ -343,11 +374,21 @@ public abstract class BasePostAnalysisDlg extends CaveSWTDialog {
legendCanvas.setSize(canvasWidth, canvasHeight);
legendCanvas.setLayoutData(gd);
//let the colorLegendMgr handle the actual painting
//The ColorLegendMgr sets up its own PaintListener()
setColorLegendMgr(createColorLegendMgr(legendCanvas));
/*
legendCanvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
drawCanvas(e.gc);
}
});
*/
}
/**
@ -365,11 +406,14 @@ public abstract class BasePostAnalysisDlg extends CaveSWTDialog {
*
* @param gc
*/
private void drawCanvas(GC gc) {
gc.setAntialias(SWT.ON);
gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_BLACK));
private void drawCanvas(GC gc)
{
getColorLegendMgr().paintLegend(gc);
// gc.setAntialias(SWT.ON);
// gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_BLACK));
gc.fillRectangle(0, 0, canvasWidth, canvasHeight);
// gc.fillRectangle(0, 0, canvasWidth, canvasHeight);
}
/**
@ -399,4 +443,132 @@ public abstract class BasePostAnalysisDlg extends CaveSWTDialog {
* @return Number of color legend color bars.
*/
abstract protected int getNumberOfColorLegends();
private ColorLegendMgr createColorLegendMgr(Canvas canvas)
{
NamedColorUseSet namedColorUseSet1 = getNamedColorUseSet1();
NamedColorUseSet namedColorUseSet2 = getNamedColorUseSet2();
Date selectedDateTime = PostAnalysisManager.getSelectedDate();
String dateTimeString = "ending at " + getDateTimeStringFromLongTime(selectedDateTime.getTime());
ColorLegendMgr legendMgr = new ColorLegendMgr(canvas, namedColorUseSet1,
namedColorUseSet2, dateTimeString);
return legendMgr;
}
private static String getStringFromLongTime(long time, String dateFormat)
{
String timeString = null;
//System.out.println("timeString = !" + timeString + "!");
SimpleDateFormat utcSdf2 = new SimpleDateFormat(dateFormat);
utcSdf2.setTimeZone(TimeZone.getTimeZone("UTC"));
timeString = utcSdf2.format(new java.util.Date(time));
return timeString;
}
protected static String getDateTimeStringFromLongTime(long time)
{
String timeString = getStringFromLongTime(time, "yyyy-MM-dd HHz");
return timeString;
}
protected void setDataFileName1(String dataFileName1) {
this.dataFileName1 = dataFileName1;
}
protected String getDataFileName1() {
return dataFileName1;
}
protected void setDataFileName2(String dataFileName2) {
this.dataFileName2 = dataFileName2;
}
protected String getDataFileName2() {
return dataFileName2;
}
protected void setDataArray1(float[] dataArray1) {
this.dataArray1 = dataArray1;
}
protected float[] getDataArray1() {
return dataArray1;
}
protected void setDataArray2(float[] dataArray2) {
this.dataArray2 = dataArray2;
}
protected float[] getDataArray2() {
return dataArray2;
}
protected void setExtent1(java.awt.Rectangle extent1) {
this.extent1 = extent1;
}
protected java.awt.Rectangle getExtent1() {
return extent1;
}
protected void setExtent2(java.awt.Rectangle extent2) {
this.extent2 = extent2;
}
protected java.awt.Rectangle getExtent2() {
return extent2;
}
public NamedColorUseSet getNamedColorUseSet1() {
if (namedColorUseSet1 == null)
{
namedColorUseSet1 = createNamedColorUseSet1();
}
return namedColorUseSet1;
}
public NamedColorUseSet getNamedColorUseSet2() {
if (namedColorUseSet2 == null)
{
namedColorUseSet2 = createNamedColorUseSet2();
}
return namedColorUseSet2;
}
protected void setColorLegendMgr(ColorLegendMgr colorLegendMgr) {
this.colorLegendMgr = colorLegendMgr;
}
public ColorLegendMgr getColorLegendMgr() {
return colorLegendMgr;
}
public PAResourceType getResourceType1() {
return resourceType1;
}
public void setResourceType1(PAResourceType resourceType1) {
this.resourceType1 = resourceType1;
}
public PAResourceType getResourceType2() {
return resourceType2;
}
public void setResourceType2(PAResourceType resourceType2) {
this.resourceType2 = resourceType2;
}
}

View file

@ -19,6 +19,9 @@
**/
package com.raytheon.viz.mpe.ui.dialogs.postanalysis;
import java.io.File;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@ -28,6 +31,9 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.mpe.util.XmrgFile;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.NamedColorUseSet;
/**
* 1hr Best Estimate QPE Fields dialog.
*
@ -47,21 +53,48 @@ import org.eclipse.swt.widgets.Shell;
public class BestEstimate1HrQpeDlg extends BasePostAnalysisDlg {
/**
private static final int HOURS_PER_DAY = 24;
/**
* File combo box.
*/
private Combo fileCbo = null;
private String selectedFileName = null;
private List<String> xmrgFileList = null;
private PostAnalysisManager paMgr = null;
private String qpeDirectory = null;
private String adjustedDirectory = null;
private double[][] biasRatioGrid = null;
private double[][] disaggGrid = null;
/**
* Constructor.
*
* @param parentShell
* Parent shell.
*/
public BestEstimate1HrQpeDlg(Shell parentShell) {
public BestEstimate1HrQpeDlg(Shell parentShell, double[][] biasRatioGrid, double[][] disaggGrid) {
super(parentShell);
setText("1hr Best Estimate QPE Fields");
paMgr = new PostAnalysisManager();
xmrgFileList = paMgr.getListOfAvailableXmrgFiles();
this.biasRatioGrid = biasRatioGrid;
this.disaggGrid = disaggGrid;
qpeDirectory = paMgr.getXmrgFileDirectory().getAbsolutePath();
File paFileDirectory = paMgr.getPostAnalysisFileDirectory();
if (paFileDirectory != null)
{
adjustedDirectory = paFileDirectory.getAbsolutePath();
}
}
/*
@ -81,7 +114,7 @@ public class BestEstimate1HrQpeDlg extends BasePostAnalysisDlg {
saveSeparateQpeMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
saveSeperateAction();
saveSeparateAction();
}
});
@ -103,19 +136,67 @@ public class BestEstimate1HrQpeDlg extends BasePostAnalysisDlg {
String[] names = new String[] { "1hr Best Estimate QPE", "1hr Best Estimate QPE(Grid Bias Applied)" };
return names;
}
private void loadAdjustAndSaveAllQPEFiles(String destinationDirectoryName)
{
for (String fileName: xmrgFileList)
{
loadAdjustAndSave(fileName, destinationDirectoryName);
}
}
private void loadAdjustAndSave(String fileName, String destinationDirectoryName)
{
String header = "BestEstimate1HrQPEDlg.loadAdjustAndSave(): ";
String originalFilePath = qpeDirectory + '/' + fileName;
String destinationFilePath = destinationDirectoryName + '/' + fileName;
double[][] adjustedGrid = paMgr.readGridData(originalFilePath, true, true);
if (adjustedGrid != null)
{
applyGridAdjustments(adjustedGrid, biasRatioGrid, disaggGrid);
float[] dataArray = paMgr.convertToSingleArray(adjustedGrid, false, true);
short[] shortArray= paMgr.convertToShortArray(dataArray, 100.0f);
XmrgFile file = new XmrgFile();
file.setData(shortArray);
file.setHrapExtent(paMgr.getExtent());
file.setHeader(paMgr.getXmrgHeader());
try
{
file.save(destinationFilePath);
System.out.println(header + "Saved xmrg file to " + destinationFilePath);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
/**
* Save separate action.
*/
private void saveSeperateAction() {
private void saveSeparateAction() {
loadAdjustAndSaveAllQPEFiles(adjustedDirectory);
}
/**
* Save overwrite action.
*/
private void saveOverwriteAction() {
private void saveOverwriteAction()
{
loadAdjustAndSaveAllQPEFiles(qpeDirectory);
}
/**
@ -127,9 +208,110 @@ public class BestEstimate1HrQpeDlg extends BasePostAnalysisDlg {
gd.widthHint = 300;
fileCbo = new Combo(shell, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
fileCbo.setLayoutData(gd);
for (String fileName : xmrgFileList)
{
fileCbo.add(fileName);
}
fileCbo.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent event) {
System.out.println("fileCbo.addSelectionListener().widgetSelected() ");
selectedFileName = fileCbo.getText();
loadImage(event.data);
}
} );
//make an initial selection
fileCbo.select(0);
selectedFileName = fileCbo.getText();
loadImage(null);
}
/*
private void loadImage(Object data) {
String header = "BestEstimate1HrQpeDir.loadImage(): ";
System.out.println(header + " method called.");
String filePath1 = qpeDirectory + '/' + selectedFileName;
// String filePath2 = adjustedDirectory + '/' + selectedFileName;
System.out.println(header + " filePath1 = " + filePath1);
// System.out.println(header + " filePath2 = " + filePath2);
//do this temporarily until I have enough good fake data
// filePath1 = "/home/cgobs2/xmrg_data/MMOSAIC2011081901z";
setDataFileName1(filePath1);
// filePath2 = "/home/cgobs2/xmrg_data/MMOSAIC2011081901z"; //do this temporarily until I build the adjusted data
//save the first image as a grid (a 2D array) so that I can then hold the adjusted grid in memory and then adjust it
double[][] adjustedGrid = paMgr.readGridData(filePath1, false, false);
applyGridAdjustments(adjustedGrid, biasRatioGrid, disaggGrid);
float[] dataArray2 = paMgr.convertToSingleArray(adjustedGrid, false, false);
setDataArray2(dataArray2);
setExtent2(paMgr.getExtent());
long newEndTime = paMgr.getTimeFromFileName(selectedFileName);
String newEndTimeString = "ending at " + getDateTimeStringFromLongTime(newEndTime);
//refresh the ColorLegend
colorLegendMgr.setDateTimeStringForLegend(newEndTimeString);
//refresh the maps
mapsComp.refresh();
}
private void applyGridAdjustments(double[][] adjustedGrid,
double[][] biasGrid,
double[][] disaggGrid)
{
try
{
int rowCount = adjustedGrid.length;
int colCount = adjustedGrid[0].length;
for (int row = 0; row < rowCount; row++)
{
for (int col = 0; col < colCount; col++)
{
double biasValue = biasGrid[col][row];
double disaggValue = disaggGrid[col][row] / HOURS_PER_DAY;
if (biasValue > 0.0)
{
adjustedGrid[row][col] *= biasValue;
}
else if (disaggValue > 0.0)
{
adjustedGrid[row][col] = disaggValue;
}
}
}
}
catch (Throwable t)
{
t.printStackTrace();
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.mpe.ui.dialogs.postanalysis.BasePostAnalysisDlg#
@ -139,4 +321,22 @@ public class BestEstimate1HrQpeDlg extends BasePostAnalysisDlg {
protected int getNumberOfColorLegends() {
return 1;
}
@Override
protected NamedColorUseSet createNamedColorUseSet1() {
return PostAnalysisManager.getNamedColorUseSet("PRECIP_ACCUM");
//NamedColorUseSet namedColorUseSet1 = TestDriver.getNamedColorUseSet1Hr();
//return namedColorUseSet1;
}
@Override
protected NamedColorUseSet createNamedColorUseSet2() {
return PostAnalysisManager.getNamedColorUseSet("PRECIP_ACCUM");
//NamedColorUseSet namedColorUseSet2 = TestDriver.getNamedColorUseSet1Hr();
//return namedColorUseSet2;
}
}

View file

@ -0,0 +1,293 @@
package com.raytheon.viz.mpe.ui.dialogs.postanalysis;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.ColorThreshold;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.ColorThresholdArray;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.NamedColorUseSet;
/**
* Handles color legend display in MPE's PostAnalysis
* <p>
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* December 2013 DCS 167 C. Gobs Initial Creation
*
* </pre>
*
*
* @author Chip Gobs
*
*/
public class ColorLegendMgr {
private Canvas legendCanvas = null;
private NamedColorUseSet _namedColorUseSet1 = null;
private NamedColorUseSet _namedColorUseSet2 = null;
private String dateTimeForLegend = null;
private final static Color black = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);
public ColorLegendMgr(Canvas canvas,
NamedColorUseSet namedColorUseSet1,
NamedColorUseSet namedColorUseSet2,
String dateTimeForLegend)
{
legendCanvas = canvas;
this.setDateTimeStringForLegend(dateTimeForLegend);
setNamedColorUseSet1(namedColorUseSet1);
setNamedColorUseSet2(namedColorUseSet2);
if (getNamedColorUseSet2() != null)
{
int height = legendCanvas.getBounds().height * 2;
int width = legendCanvas.getBounds().width;
Rectangle bounds = new Rectangle(0,0, width, height);
legendCanvas.setBounds(bounds);
}
legendCanvas.addPaintListener(new ColorLegendMgrPaintListener());
}
private static Color getColorByName(String colorName)
{
String header = "ColorLegendMgr.getColorByName() ";
Color color = null;
try
{
RGB rgbValue = RGBColors.getRGBColor(colorName);
if (rgbValue == null)
{
System.out.println(header + " RGB value for " + colorName + " is null.");
}
color = new Color(Display.getCurrent(), rgbValue);
/*
if (color == null)
{
color = Display.getCurrent().getSystemColor(SWT.COLOR_RED);
}
*/
}
catch (Exception e)
{
e.printStackTrace();
}
return color;
}
public void paintLegend(GC gc)
{
int canvasWidth = legendCanvas.getSize().x;
int canvasHeight = legendCanvas.getSize().y;
gc.setBackground(black);
gc.fillRectangle(0, 0, canvasWidth, canvasHeight);
paintColorScale(gc, 0, getNamedColorUseSet1(), false, true, false);
// This can be used to draw either 1 or 2 color scales
if (getNamedColorUseSet2() != null)
{
paintColorScale(gc, 75, getNamedColorUseSet2(), false, false, true);
}
}
private void paintColorScale(GC gc, int initialYPos,
NamedColorUseSet namedColorUseSet,
boolean displaySpecialIdenticallyZeroValue,
boolean displayMissingValue,
boolean displayLabelAbove)
{
gc.setAntialias(SWT.ON);
final Color black = legendCanvas.getDisplay().getSystemColor(SWT.COLOR_BLACK);
final Color white = legendCanvas.getDisplay().getSystemColor(SWT.COLOR_WHITE);
int xPos = 25;
int yPos = initialYPos;
gc.setForeground(white);
if (displayLabelAbove)
{
gc.drawString(namedColorUseSet.getColor_use_display_string() , xPos, yPos);
yPos = initialYPos + 13;
}
ColorThresholdArray colorThresholdArrayObject = namedColorUseSet.getThreshold_array();
ColorThreshold[] colorThresholds = colorThresholdArrayObject.getThresholds();
final int rectangleWidth = 40;
final int rectangleHeight = 20;
int stringXOffset = -10;
int extraDigitStringXOffset = 0;
int defaultXOffset = 7;
final int stringYOffset = 4;
xPos = 10;
yPos += rectangleHeight;
String missingColorName = colorThresholdArrayObject.getMissingColorName();
// String defaultColorName = colorThresholdArrayObject.getDefaultColorName();
Color color = null;
if (displayMissingValue)
{
//draw the missing color rectangle
final Color missingColor = getColorByName(missingColorName);
color = missingColor;
gc.setBackground(black);
gc.drawString("MSG", xPos + defaultXOffset, yPos - rectangleHeight + stringYOffset);
gc.setBackground(color);
gc.fillRectangle(xPos, yPos, rectangleWidth, rectangleHeight);
xPos += rectangleWidth;
}
if (displaySpecialIdenticallyZeroValue)
{
//draw the identically 0 color rectangle
color = black;
gc.setBackground(color);
gc.drawString("0.0", xPos + defaultXOffset, yPos - rectangleHeight + stringYOffset);
gc.fillRectangle(xPos, yPos, rectangleWidth, rectangleHeight);
xPos += rectangleWidth;
}
//draw the default color rectangle
final Color defaultColor = black;
gc.setBackground(defaultColor);
gc.fillRectangle(xPos, yPos, rectangleWidth, rectangleHeight);
xPos += rectangleWidth;
//draw each threshold color rectangle and the associated threshold value
for (ColorThreshold threshold: colorThresholds)
{
color = getColorByName(threshold.getColorName());
gc.setBackground(black);
if (threshold.getValue() >= 10.00)
{
extraDigitStringXOffset = -3;
}
else
{
extraDigitStringXOffset = -0;
}
String thresholdValueString = String.format("%5.2f",threshold.getValue());
gc.drawString(thresholdValueString, xPos + stringXOffset + extraDigitStringXOffset, yPos - rectangleHeight + stringYOffset);
gc.setBackground(color);
gc.fillRectangle(xPos, yPos, rectangleWidth, rectangleHeight);
xPos += rectangleWidth;
} //end for
//draw infinity symbol
String infinityString = "\u221D"; //unicode encoding for infinity symbol
gc.setBackground(black);
gc.drawString(infinityString, xPos + stringXOffset-3, yPos - rectangleHeight + stringYOffset);
if (! displayLabelAbove)
{
xPos = 20;
yPos += rectangleHeight + 10;
gc.setForeground(white);
String legendText = namedColorUseSet.getColor_use_display_string() + " " + this.getDateTimeForLegend();
gc.drawString(legendText, xPos, yPos);
}
return;
}
private void setNamedColorUseSet1(NamedColorUseSet _namedColorUseSet1) {
this._namedColorUseSet1 = _namedColorUseSet1;
}
public NamedColorUseSet getNamedColorUseSet1() {
return _namedColorUseSet1;
}
private void setNamedColorUseSet2(NamedColorUseSet _namedColorUseSet2) {
this._namedColorUseSet2 = _namedColorUseSet2;
}
public NamedColorUseSet getNamedColorUseSet2() {
return _namedColorUseSet2;
}
public void finalize()
{
}
public void setDateTimeStringForLegend(String dateTimeForLegend) {
this.dateTimeForLegend = dateTimeForLegend;
}
public String getDateTimeForLegend() {
return dateTimeForLegend;
}
class ColorLegendMgrPaintListener implements PaintListener
{
public void paintControl(PaintEvent e)
{
paintLegend(e.gc);
}
}
}

View file

@ -20,8 +20,13 @@
package com.raytheon.viz.mpe.ui.dialogs.postanalysis;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
@ -30,22 +35,41 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.mpe.util.XmrgFile;
import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IRenderableDisplayChangedListener;
import com.raytheon.uf.viz.core.IRenderableDisplayChangedListener.DisplayChangeType;
import com.raytheon.uf.viz.core.datastructure.LoopProperties;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.procedures.Bundle;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority;
import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory;
import com.raytheon.viz.hydrocommon.util.MPEColors;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.GetColorValues;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.NamedColorUseSet;
import com.raytheon.viz.mpe.ui.DisplayFieldData;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.mpe.ui.MPEPlotType;
import com.raytheon.viz.mpe.ui.rsc.MPEPlotGriddedResourceData;
import com.raytheon.viz.mpe.ui.rsc.PAAsciiXmrgResource;
import com.raytheon.viz.mpe.ui.rsc.PAAsciiXmrgResourceData;
import com.raytheon.viz.mpe.ui.rsc.PAXmrgResource;
import com.raytheon.viz.mpe.ui.rsc.PAXmrgResourceData;
import com.raytheon.viz.mpe.util.ReadQPFGrids;
import com.raytheon.viz.ui.actions.LoadSerializedXml;
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
import com.raytheon.viz.ui.editor.ISelectedPanesChangedListener;
@ -63,6 +87,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 14, 2011 lvenable Initial creation
* Dec 15, 2013 cgobs Wrapup of functionality
*
* </pre>
*
@ -71,7 +96,11 @@ import com.vividsolutions.jts.geom.Coordinate;
*/
public class MapsComp implements IMultiPaneEditor {
////////////////////////////////////
/** The application name */
private final String APPLICATION_NAME = "hmapmpe";
//private final String APPLICATION_NAME = "PostAnalysis";
////////////////////////////////////
/**
* Parent shell.
*/
@ -98,11 +127,19 @@ public class MapsComp implements IMultiPaneEditor {
*/
private LoopProperties loopProps = new LoopProperties();
private double originalZoomLevel = 0.0;
private Rectangle rectBounds;
private double[] centerArray = new double[3];
private BasePostAnalysisDlg dialog = null;
private static final List<NamedColorUseSet> pColorSetGroup = MPEColors.build_mpe_colors();
// ColorLegendMgr colorLegendMgr = null;
//////////////////////////////////////////
// private List<NamedColorUseSet> colorSetGroups;
//////////////////////////////////////////
/**
* Constructor.
@ -110,9 +147,17 @@ public class MapsComp implements IMultiPaneEditor {
* @param parentShell
* Parent shell.
*/
public MapsComp(Shell parentShell) {
public MapsComp(Shell parentShell, BasePostAnalysisDlg baseDialog) {
this.parentShell = parentShell;
dialog = baseDialog;
initializeMapsComp();
// setColorLegendMgr( baseDialog.getColorLegendMgr();
//////////////////////////////////////////
// colorSetGroups = MPEDisplayManager.getCurrent().getColorSetGroup();
//////////////////////////////////////////
}
/**
@ -131,7 +176,13 @@ public class MapsComp implements IMultiPaneEditor {
gd.widthHint = 900;
comp.setLayoutData(gd);
//////////////////////////////////////////
loadData();
//////////////////////////////////////////
createMaps(comp);
}
/**
@ -164,7 +215,7 @@ public class MapsComp implements IMultiPaneEditor {
IDisplayPane[] panes = getDisplayPanes();
IDisplayPane pane = panes[0];
for (ResourcePair rp : pane.getDescriptor().getResourceList()) {
if (rp.getProperties().isMapLayer()) {
rectBounds = rp.getResource().getDescriptor()
@ -181,7 +232,145 @@ public class MapsComp implements IMultiPaneEditor {
parentShell.dispose();
}
}
//////////////////////////////////////////
/**
* Load the data.
*/
private void loadData() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH");
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
// String userId = System.getProperty("user.name");
IDisplayPane[] panes = getDisplayPanes();
try
{
loadDataByPane(panes[0], dialog.getDataFileName1(), dialog.getDataArray1(), dialog.getExtent1(),
dialog.getNamedColorUseSet1(), dialog.getResourceType1());
loadDataByPane(panes[1], dialog.getDataFileName2(), dialog.getDataArray2(), dialog.getExtent2(),
dialog.getNamedColorUseSet2(), dialog.getResourceType2());
}
catch (Throwable t)
{
System.out.println(t.getStackTrace());
}
}
private void loadDataByPane(IDisplayPane pane, String filePath, float[] dataArray,
java.awt.Rectangle extent,
NamedColorUseSet namedColorUseSet,
PAResourceType resourceType)
{
if (resourceType == PAResourceType.XMRG)
{
loadDataByPaneXmrg(pane, filePath, dataArray, extent, namedColorUseSet);
}
else // (resourceType == PAResourceType.ASCII_XMRG)
{
loadDataByPaneAsciiXmrg(pane, filePath, dataArray, extent, namedColorUseSet);
}
}
private void loadDataByPaneXmrg(IDisplayPane pane, String filePath, float[] dataArray, java.awt.Rectangle extent, NamedColorUseSet namedColorUseSet)
{
String userId = System.getProperty("user.name");
IDescriptor descriptor = pane.getDescriptor();
//DisplayFieldData dataType = DisplayFieldData.gageOnly;
// String cv_use = dataType.getCv_use();
String cv_use = namedColorUseSet.getColor_use_db_name();
int cv_duration = namedColorUseSet.getDefault_duration();
String fname = filePath;
PAXmrgResourceData xmrgRscData = null;
ResourcePair rp = new ResourcePair();
if (filePath != null)
{
XmrgFile xmrg = new XmrgFile(fname);
xmrgRscData = new PAXmrgResourceData(xmrg, cv_use);
}
else
{
xmrgRscData = new PAXmrgResourceData(dataArray, extent, cv_use);
}
List<NamedColorUseSet> namedColorUseSetList = pColorSetGroup;
List<Colorvalue> colorSet = GetColorValues.get_colorvalues(userId,
APPLICATION_NAME, cv_use,
cv_duration, "E", namedColorUseSetList);
xmrgRscData.setColorList(colorSet);
rp.setResourceData(xmrgRscData);
descriptor.getResourceList().add(rp);
descriptor.getResourceList().instantiateResources(descriptor, true);
PAXmrgResource resource = (PAXmrgResource) rp.getResource();
resource.getProperties().setMapLayer(true);
}
private void loadDataByPaneAsciiXmrg(IDisplayPane pane, String filePath,
float[] dataArray, java.awt.Rectangle extent,
NamedColorUseSet namedColorUseSet)
{
String userId = System.getProperty("user.name");
IDescriptor descriptor = pane.getDescriptor();
String cv_use = namedColorUseSet.getColor_use_db_name();
int cv_duration = namedColorUseSet.getDefault_duration();
PAAsciiXmrgResourceData gridResourceData = null;
ResourcePair rp = new ResourcePair();
if (filePath != null)
{
gridResourceData = new PAAsciiXmrgResourceData(filePath, cv_use);
}
else
{
gridResourceData = new PAAsciiXmrgResourceData(dataArray, extent, cv_use);
// gridResourceData.
}
//hook up to MPEColors
List<NamedColorUseSet> namedColorUseSetList = pColorSetGroup;
List<Colorvalue> colorSet = GetColorValues.get_colorvalues(userId,
APPLICATION_NAME, cv_use,
cv_duration, "E", namedColorUseSetList);
gridResourceData.setColorList(colorSet);
//get the resource
rp.setResourceData(gridResourceData);
descriptor.getResourceList().add(rp);
descriptor.getResourceList().instantiateResources(descriptor, true);
PAAsciiXmrgResource resource = (PAAsciiXmrgResource) rp.getResource();
//set resource properties
ResourceProperties gageResourceProperties = resource.getProperties();
gageResourceProperties.setMapLayer(true);
}
//////////////////////////////////////////
/**
* Get substitutions for the map center.
*
@ -217,6 +406,7 @@ public class MapsComp implements IMultiPaneEditor {
if (rp.getProperties().isMapLayer()
&& rp.getResource().getName().equals(menuText)) {
rp.getProperties().setVisible(visible);
}
}
}
@ -229,7 +419,7 @@ public class MapsComp implements IMultiPaneEditor {
((VizDisplayPane) pane).getRenderableDisplay()
.recenter(centerArray);
((VizDisplayPane) pane).zoom(.25);
}
}
@ -284,7 +474,9 @@ public class MapsComp implements IMultiPaneEditor {
*/
@Override
public void refresh() {
paneManager.refresh();
loadData();
paneManager.refresh();
}
/*
@ -301,7 +493,7 @@ public class MapsComp implements IMultiPaneEditor {
double[] world = pane.screenToGrid(x, y, 0);
IExtent extent = pane.getRenderableDisplay().getExtent();
// Verify grid space is within the extent, otherwiser return null
if (world == null || extent.contains(world) == false) {
if ((world == null) || (extent.contains(world) == false)) {
return null;
}
// use descriptor to convert pixel world to CRS world space

View file

@ -0,0 +1,66 @@
package com.raytheon.viz.mpe.ui.dialogs.postanalysis;
/**
* Handles calculation of max, min, and average values by keeping a running calculation.
* Can be used in loops. Little setup is required.
* <p>
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* September 2013 DCS 167 C. Gobs Initial Creation
*
* </pre>
*
*
* @author Chip Gobs
*
*/
public class MaxMinAverage
{
private double min = Double.MAX_VALUE;
private double max = Double.MIN_VALUE;
private double average = 0.0;
private long total = 0;
public MaxMinAverage()
{
clear();
}
public void clear()
{
min = Double.MAX_VALUE;
max = Double.MIN_VALUE;
average = 0.0;
}
public void submit(double value)
{
if (value < min)
{
min = value;
}
if (value > max)
{
max = value;
}
total++;
double newPortion = 1/total;
double oldPortion = 1 - newPortion;
average = (average*oldPortion) + value * newPortion;
}
public String toString()
{
return " max = " + max + " min = " + min + " average = " + average;
}
}

View file

@ -22,10 +22,15 @@ package com.raytheon.viz.mpe.ui.dialogs.postanalysis;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.NamedColorUseSet;
import com.raytheon.viz.mpe.util.DailyQcUtils;
import com.raytheon.viz.mpe.util.DailyQcUtils.Hrap_Grid;
/**
* Merged and Grid Bias Fields dialog.
@ -49,15 +54,117 @@ public class MergedGridBiasDlg extends BasePostAnalysisDlg {
/**
* Best Estimate dialog.
*/
java.awt.Rectangle extent = null;
private BestEstimate1HrQpeDlg bestEstimateDlg = null;
private double[][] mergeArray = null;
private double[][] ratioArray = null;
private double[][] disaggArray = null;
private boolean showMergedData = true;
private Combo fieldTypeCBO = null;
private static final String MERGED_FIELD = "Merged Field";
private static final String DISAGG_FIELD = "Disaggregated Field";
public MergedGridBiasDlg(Shell parentShell) {
super(parentShell);
setResourceType1(PAResourceType.XMRG);
setResourceType2(PAResourceType.XMRG);
setText("Merged and Grid Bias Fields");
PostAnalysisManager paMgr = new PostAnalysisManager();
try
{
String filePath = PostAnalysisManager.get24HourGageOnlyFilePath();
//units are hundredths of inches
// double[][] gageOnly24HourGrid = paMgr.createGridArray(filePath, false, true, false);
double[][] gageOnly24HourGrid = paMgr.readAsciiXmrgGridData(filePath, false, true, false);
mergeArray = paMgr.create2DGridArray();
ratioArray = paMgr.create2DGridArray();
disaggArray = paMgr.create2DGridArray();
float rhat = paMgr.getRhat();
//rhat = 0.5f;
float estimatedScale = paMgr.getEstimatedScale();
//paMgr.printDouble2DArray(qpeAccum24Hr[DailyQcUtils.pcpn_day]);
Hrap_Grid hrap_grid = DailyQcUtils.getHrap_grid();
int maxCols = hrap_grid.maxi;
int maxRows = hrap_grid.maxj;
double scaleFactor = 1.0;
//units are Inches
double[][] accum24HourGrids =
PostAnalysisManager.get24HourTotalPrecip(maxRows, maxCols, scaleFactor);
paMgr.mergeData(accum24HourGrids, gageOnly24HourGrid,
mergeArray, ratioArray,
disaggArray, estimatedScale, rhat);
// System.out.println(header + "ratioArray = ");
// paMgr.printDouble2DArray(ratioArray[DailyQcUtils.pcpn_day]);
//set up merged field
float[] dataArray1 = null;
if (showMergedData)
{
dataArray1 = getSingleDataArrayFrom2DArray(mergeArray);
}
else //show disagged Data
{
dataArray1 = getSingleDataArrayFrom2DArray(disaggArray);
}
setExtent1(paMgr.getExtent());
// paMgr.printFloatArray(header + dataArray1);
setDataArray1(dataArray1);
//set up grid bias (ratio) field
float[] dataArray2 = paMgr.convertToSingleArray(ratioArray, false, true);
setExtent2(paMgr.getExtent());
setDataArray2(dataArray2);
//paMgr.printFloatArray(header + dataArray2);
}
catch (Throwable t)
{
t.printStackTrace();
}
}
/*
private float[] getSingleDataArrayFrom2DArray(double[][] gridArray)
{
PostAnalysisManager paMgr = new PostAnalysisManager();
float[] dataArray = paMgr.convertToSingleArray(gridArray, false, true);
// float[] dataArray = paMgr.convertToSingleArray(gridArray, false, false);
return dataArray;
}
/*
* Create the Display 1hr QPE Fields menu item.
*/
@Override
@ -87,7 +194,11 @@ public class MergedGridBiasDlg extends BasePostAnalysisDlg {
private void display1HrQpeAction() {
if (bestEstimateDlg == null || bestEstimateDlg.isDisposed() == true) {
Shell platformShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
bestEstimateDlg = new BestEstimate1HrQpeDlg(platformShell);
double[][] dailyRatioArray = ratioArray;
double[][] dailyDisaggArray = disaggArray;
bestEstimateDlg = new BestEstimate1HrQpeDlg(platformShell, dailyRatioArray, dailyDisaggArray);
bestEstimateDlg.open();
}
}
@ -97,8 +208,64 @@ public class MergedGridBiasDlg extends BasePostAnalysisDlg {
*/
@Override
protected void addBottomControls() {
// Not used
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
gd.widthHint = 300;
fieldTypeCBO = new Combo(shell, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
fieldTypeCBO.setLayoutData(gd);
fieldTypeCBO.add("Merged Field");
fieldTypeCBO.add("Disaggregated Field");
fieldTypeCBO.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent event) {
String fieldType = fieldTypeCBO.getText();
if (fieldType.equals(MERGED_FIELD))
{
//System.out.println("addBottomControls().widgetSelected() - MERGED FIELD CHOSEN");
showMergedData = true;
leftMapLbl.setText(MERGED_FIELD);
setDataArray1(getSingleDataArrayFrom2DArray(mergeArray));
}
else
{
//System.out.println("addBottomControls().widgetSelected() - DISAGGED FIELD CHOSEN");
//System.out.println("fieldType = " + fieldType);
showMergedData = false;
leftMapLbl.setText(DISAGG_FIELD);
if (disaggArray != null)
{
setDataArray1(getSingleDataArrayFrom2DArray(disaggArray));
}
else
{
//System.out.println("disaggArray is null!!!!");
setDataArray1(null);
}
}
loadImage(event.data);
}
} );
//make an initial selection
fieldTypeCBO.select(0);
}
private void loadImage(Object data) {
//refresh the maps
mapsComp.refresh();
}
/*
* (non-Javadoc)
@ -110,4 +277,22 @@ public class MergedGridBiasDlg extends BasePostAnalysisDlg {
protected int getNumberOfColorLegends() {
return 2;
}
@Override
protected NamedColorUseSet createNamedColorUseSet1()
{
return PostAnalysisManager.getNamedColorUseSet("PRECIP_ACCUM");
}
@Override
protected NamedColorUseSet createNamedColorUseSet2() {
return PostAnalysisManager.getNamedColorUseSet("PRECIP_RATIO");
//NamedColorUseSet namedColorUseSet2 = TestDriver.getNamedColorUseSetForBias();
//return namedColorUseSet2;
}
}

View file

@ -0,0 +1,23 @@
package com.raytheon.viz.mpe.ui.dialogs.postanalysis;
/**
* Enum to help manage difference resource types in MPE's PostAnalysis.
* <p>
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* September 2013 DCS 167 C. Gobs Initial Creation
*
* </pre>
*
*
* @author Chip Gobs
*
*/
public enum PAResourceType
{
XMRG,
ASCII_XMRG
}

View file

@ -0,0 +1,182 @@
package com.raytheon.viz.mpe.ui.dialogs.postanalysis;
import java.awt.Rectangle;
import java.io.IOException;
import java.util.Date;
import com.raytheon.uf.common.mpe.util.XmrgFile;
import com.raytheon.viz.mpe.ui.DisplayFieldData;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
//----------------------------------------------------------------------------
/**
* Class to handle precip totalling algorithms in MPE's PostAnalysis
* <p>
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* December 2013 DCS 167 C. Gobs Initial Creation
*
* </pre>
*
*
* @author Chip Gobs
*
*/
public class PrecipTotaller
{
public final static long MILLIS_PER_HOUR = 60 * 60 * 1000;
public final static long MILLIS_PER_DAY = 24 * MILLIS_PER_HOUR;
//----------------------------------------------------------------------------
public double[][] get24HourBestEstimateGrid(int maxRows, int maxCols,
Date endTime, double missingValue, double scaleFactor)
{
Date startTime = new Date(endTime.getTime() - MILLIS_PER_DAY);
double[][] totalPrecipGrid = getTotalPrecipGrid(maxRows, maxCols,
DisplayFieldData.Xmrg,
startTime, endTime, missingValue,
scaleFactor);
return totalPrecipGrid;
}
//----------------------------------------------------------------------------
public double[][] getTotalPrecipGrid(int maxRows, int maxCols,
DisplayFieldData displayFieldData,
Date startDateTime, Date endDateTime,
double missingValue,
double scaleFactor)
{
//reads the appropriate MPE grid type and totals up
//hourly precip over the specified length of time
//startTime is exclusive
//endTime is inclusive, so if you want a total from 12Z to 12Z,
// the routine does not read the first 12Z file, but starts at 13z and then
// reads all up to and including the final 12Z file
// returns an HRAP grid with precip values in INCHES
String header = "PrecipTotaller.getTotalPrecipGrid(): ";
long startTime = startDateTime.getTime();
long endTime = endDateTime.getTime();
double[][] totalPrecipGrid = new double[maxRows][maxCols];
//init the grid
for (int row = 0; row < maxRows; row++)
{
for (int col = 0; col < maxCols; col++)
{
totalPrecipGrid[row][col] = 0.0;
}
}
// total up each hour
for (long time = startTime + MILLIS_PER_HOUR; time <= endTime; time += MILLIS_PER_HOUR)
{
XmrgFile xmrgFile = MPEDisplayManager.getXmrgFile(displayFieldData, new Date(time));
System.out.println(header + " Reading file " + xmrgFile.getFile().getName());
double[][] hourlyGrid = getHourlyGrid(xmrgFile);
if (hourlyGrid != null)
{
addGridToTotalGrid(maxRows, maxCols, totalPrecipGrid, hourlyGrid, scaleFactor);
}
}
return totalPrecipGrid;
}
//----------------------------------------------------------------------------
private void addGridToTotalGrid(int maxRows, int maxCols, double[][] totalPrecipGrid,
double[][] hourlyGrid, double scaleFactor)
{
double hourlyValue = 0.0;
for (int row = 0; row < maxRows; row++)
{
for (int col = 0; col < maxCols; col++)
{
hourlyValue = hourlyGrid[row][col];
if (hourlyValue >= 0.0)
{
totalPrecipGrid[row][col] += hourlyValue * scaleFactor;
}
}
}
} //end addGridToTotalGrid()
//----------------------------------------------------------------------------
private double[][] getHourlyGrid(XmrgFile xmrgFile )
{
double[][] grid = null;
try
{
if ( xmrgFile.getFile().length() > 0)
{
xmrgFile.load();
Rectangle hrapExtent = xmrgFile.getHrapExtent();
short[][] hourlyShortData = xmrgFile.getData(hrapExtent);
int maxCols = hrapExtent.width;
int maxRows = hrapExtent.height;
grid = new double[maxRows][maxCols];
double value = 0.0;
for (int row = 0; row < maxRows; row++)
{
for (int col = 0; col < maxCols; col++)
{
short shortValue = hourlyShortData[row][col];
if (shortValue >= 0)
{
//convert from hundredths of MM to inches
value = ( ((double) shortValue) / ( 25.4 * 100.0) );
}
else //keep special MISSING value
{
value = shortValue;
}
grid[row][col] = value;
} //end for col
} //end for row
}//end if length > 0
} //end try
catch (IOException e)
{
e.printStackTrace();
}
return grid;
}
//----------------------------------------------------------------------------
} //end class PrecipTotaller

View file

@ -19,6 +19,10 @@
**/
package com.raytheon.viz.mpe.ui.dialogs.postanalysis;
import java.awt.Rectangle;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@ -27,6 +31,16 @@ import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
import com.raytheon.viz.hydrocommon.HydroDisplayManager;
import com.raytheon.viz.hydrocommon.util.MPEColors;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.GetColorValues;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.NamedColorUseSet;
import com.raytheon.viz.mpe.util.DailyQcUtils;
import com.raytheon.viz.mpe.util.DailyQcUtils.Hrap_Grid;
/**
* Summed Hourly MPE Field & Gage Only Field dialog.
*
@ -37,27 +51,99 @@ import org.eclipse.ui.PlatformUI;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 12, 2011 lvenable Initial creation
*
* December 2013 cgobs Completion
* </pre>
*
* @author lvenable
* @version 1.0
*/
public class SummedHourlyMpeDlg extends BasePostAnalysisDlg {
public class SummedHourlyMpeDlg extends BasePostAnalysisDlg
{
private static final int SECONDS_PER_HOUR = 3600;
private static final int SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR;
/** Bundle file location */
//private static final String BUNDLE_LOC = "bundles/MPE/postAnalysisBundle.xml";
/**
* Merge Data dialog.
*/
MergedGridBiasDlg mergeDataDlg = null;
public SummedHourlyMpeDlg(Shell parentShell) {
super(parentShell);
setText("Summed Hourly MPE Field & Gage Only Field");
}
setText("24 HR Summed Hourly MPE Field & 24-HR Gage Only Field");
setResourceType1(PAResourceType.XMRG);
setResourceType2(PAResourceType.ASCII_XMRG);
// 24 accumulated 1-hour precip grids
Hrap_Grid grid = DailyQcUtils.getHrap_grid();
int wfoMinX = grid.hrap_minx;
int wfoMinY = grid.hrap_miny;
int width = grid.maxi;
int height = grid.maxj;
/*
//System.out.println(header + " wfoMinX = " + wfoMinX + " wfoMinY = " + wfoMinY +
// " width = " + width + " height = " + height);
java.awt.Rectangle extent = new Rectangle(wfoMinX, wfoMinY, width, height);
setExtent1(extent);
float scaleFactor = 25.4f * 100.0f;
double[][] totalPrecipGrid = PostAnalysisManager.get24HourTotalPrecip(height, width, scaleFactor);
//floatArray units are hundredths of MM
float[] floatArray = convertToFloatArray(totalPrecipGrid, 1.0f);
setDataArray1(floatArray);
//24 hour gage only
String dataFilePath2 = PostAnalysisManager.get24HourGageOnlyFilePath();
setDataFileName2(dataFilePath2);
return;
}
private float[] convertToFloatArray(double[][] totalPrecipGrid, float unitConversionFactor)
{
String header = "SummedHourlyMpeDlg.convertToFloatArray(qpeAccum24hr): ";
Hrap_Grid hrap_grid = DailyQcUtils.getHrap_grid();
int maxCols = hrap_grid.maxi;
int maxRows = hrap_grid.maxj;
int precipDay = DailyQcUtils.pcpn_day;
System.out.println(header + "DailyQcUtils.pcpn_day = " + DailyQcUtils.pcpn_day);
System.out.println(header + "precipDay = " + precipDay);
float[] valueArray = new float[maxRows*maxCols];
int index = 0;
for (int row = 0; row < maxRows; row++) {
for (int col = 0; col < maxCols; col++) {
float value = (float) totalPrecipGrid[row][col];
valueArray[index] = value * unitConversionFactor;
index++;
}
}
return valueArray;
}
/*
* Create the Merge Data menu item.
*/
@Override
@ -80,7 +166,7 @@ public class SummedHourlyMpeDlg extends BasePostAnalysisDlg {
*/
@Override
protected String[] getMapLabelNames() {
String[] names = new String[] { "Summed Hourly MPE Field", "Gage Only Field" };
String[] names = new String[] { "Sum of 24 1-HR MPE Fields", "24 HR Gage Only Field" };
return names;
}
@ -99,8 +185,9 @@ public class SummedHourlyMpeDlg extends BasePostAnalysisDlg {
* Not used
*/
@Override
protected void addBottomControls() {
// Not used
protected void addBottomControls()
{
}
/*
@ -110,7 +197,85 @@ public class SummedHourlyMpeDlg extends BasePostAnalysisDlg {
* getNumberOfColorLegends()
*/
@Override
protected int getNumberOfColorLegends() {
return 1;
}
protected NamedColorUseSet createNamedColorUseSet1()
{
return PostAnalysisManager.getNamedColorUseSet("PRECIP_ACCUM");
}
protected NamedColorUseSet createNamedColorUseSet1Old()
{
String user_id = System.getProperty("user.name");
int duration = SECONDS_PER_DAY; //24 hours
List<Colorvalue> colorList = GetColorValues.get_colorvalues(user_id,
HydroDisplayManager.MPE_APPLICATION_NAME,"PRECIP_ACCUM", duration,
"E", MPEColors.build_mpe_colors());
int listSize = colorList.size() -2;
double[] thresholdValues = new double[listSize];
String[] colorNameArray = new String[listSize];
int index = 0;
double thresholdValue = 0.0;
String colorNameValue = null;
String missingColorName = "GREY50";
String lowValueColorName = "BLACK";
for (Colorvalue colorValue : colorList)
{
thresholdValue = colorValue.getId().getThresholdValue();
colorNameValue = colorValue.getColorname().getColorName();
// System.out.printf("%s thresholdValue = %f colorNameValue = :%s: \n", header,
// thresholdValue, colorNameValue);
if (thresholdValue == -9999.0 )
{
missingColorName = colorNameValue;
}
else if (thresholdValue == -8888.0)
{
lowValueColorName = colorNameValue;
}
else //regular value
{
// -8888.0
colorNameArray[index] = colorNameValue;
thresholdValues[index] = thresholdValue;
index++;
if (index >= listSize)
{
break;
}
}
}
NamedColorUseSet namedColorUseSet1 =
new NamedColorUseSet("PRECIP_ACCUM", "PRECIP_ACCUM", thresholdValues,
colorNameArray, missingColorName, lowValueColorName, duration);
return namedColorUseSet1;
}
@Override
protected NamedColorUseSet createNamedColorUseSet2()
{
NamedColorUseSet namedColorUseSet2 = createNamedColorUseSet1();
return namedColorUseSet2;
}
}

View file

@ -0,0 +1,131 @@
package com.raytheon.viz.mpe.ui.dialogs.postanalysis;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.NamedColorUseSet;
public class TestDriver
{
public static void main(String[] argArray)
{
Display display = new Display();
Shell shell = new Shell(display);
Label label = new Label(shell, SWT.CENTER);
label.setText("Hello, World");
// label.setBounds(shell.getClientArea());
int width = 800;
int height = 100;
Rectangle bounds = new Rectangle(0,0, width, height);
Canvas canvas = new Canvas(shell, SWT.TOP);
canvas.setBounds(bounds);
canvas.setBackground(canvas.getDisplay().getSystemColor(SWT.COLOR_BLACK));
NamedColorUseSet namedColorUseSet1 = getNamedColorUseSet();
NamedColorUseSet namedColorUseSet2 = getNamedColorUseSetForBias();
ColorLegendMgr legendMgr = new ColorLegendMgr(canvas, namedColorUseSet1,
namedColorUseSet2, "2001-01-01 12Z");
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
display.sleep();
}
}
display.dispose();
}
public static NamedColorUseSet getNamedColorUseSet()
{
double[] thresholdValueArray = {.000000001, 0.01, 0.1, 0.2, 0.4, 0.6,
0.75, 1.0, 1.5, 5.0, 7.5};
String[] colorNameArray = {"Pink", "DarkBlue", "Blue", "Cyan",
"DarkGreen", "Green",
"Yellow", "Orange", "Red", "Magenta", "White"};
String missingColorName = "Gray";
String defaultColorName = "DarkGray";
int duration = 3600 * 24;
NamedColorUseSet namedColorUseSet =
new NamedColorUseSet("PRECIP_ACCUM", "24 Hour Precip Accumulation in inches",
thresholdValueArray, colorNameArray,
missingColorName, defaultColorName, duration);
return namedColorUseSet;
}
public static NamedColorUseSet getNamedColorUseSet1Hr()
{
double[] thresholdValueArray = {0.0, .000000001, 0.01, 0.1, 0.2, 0.4,
0.6, 0.75, 1.0, 1.5, 5.0, 7.5};
String[] colorNameArray = {"Magenta", "Pink", "DarkBlue", "Blue",
"Cyan", "DarkGreen", "Green",
"Yellow", "Orange", "Red", "Magenta", "White"};
String missingColorName = "Gray";
String defaultColorName = "DarkGray";
int duration = 3600;
NamedColorUseSet namedColorUseSet =
new NamedColorUseSet("PRECIP_ACCUM", "1 Hour Precip Accumulation in inches",
thresholdValueArray, colorNameArray,
missingColorName, defaultColorName, duration);
return namedColorUseSet;
}
public static NamedColorUseSet getNamedColorUseSetForBias()
{
/*
public NamedColorUseSet(final String color_use_db_name,
final String color_use_display_string,
final double threshold_values[], final String color_names[],
final String missing_color_name, final String default_color_name,
int default_duration)
*/
//double[] thresholdValueArray = {-7.5, -5.0, -1.5, -1.0, -0.75, -0.6, -0.4, -0.2, -0.1, -0.01,
// 0.0, .25, 0.5, 0.9, 1.1, 2.0, 3.0};
double[] thresholdValueArray = {0.0, 0.05, 0.1, .2, .4, 0.8, 1.2, 2.0, 3.0, 4.0, 5.0, 8.0, 16.0, 32.0, 100.0};
String[] colorNameArray = {"DarkGray", "Gray", "Light Gray", "DarkBlue", "Blue", "DarkCyan", "Cyan", "DarkGreen", "Green",
"Yellow", "Orange", "Red", "Dark Red", "Magenta", "White" };
// String[] colorNameArray = {"DarkBlue", "Blue", "Cyan", "DarkGreen", "Green", "Yellow", "Orange", "Red", "Magenta", "White"};
// String[] colorNameArray = {"White", "Magenta", "Red", "Orange", "Yellow", "Green", "DarkGreen", "Cyan", "Blue", "DarkBlue",
// "Black", "DarkCyan", "DarkMagenta", "Yellow", "DarkGoldenrod", "Red", "DarkRed"};
// "Black", "Yellow", "Yellow", "Yellow", "Yellow", "Yellow", "Yellow"};
String missingColorName = "DarkGray";
String defaultColorName = "Gray";
int duration = 3600;
NamedColorUseSet namedColorUseSet =
new NamedColorUseSet("PRECIP_BIAS", "Grid Bias Legend",
thresholdValueArray, colorNameArray,
missingColorName, defaultColorName, duration);
return namedColorUseSet;
}
}

View file

@ -95,11 +95,14 @@ public class DPAResource extends
private static final String RADAR_IGNORED = "Radar Data Ignored";
private static final String ALL_ZERO = "Radar Data All Zero";
/** Radar types */
public static enum SingleSiteRadarType {
RAW_RADAR("Raw Radar"), RADAR_CLIMATOLOGY("Radar Climatology"), MEAN_FIELD_BIAS_CORRECTED_RADAR(
"Mean Field Bias Corrected Radar"), RADAR_COVERAGE_MAP(
"Radar Coverage Map");
RAW_SP_RADAR("Raw SP Radar"),
RAW_DP_RADAR("Raw DP Radar"),
MEAN_FIELD_BIAS_CORRECTED_SP_RADAR("Mean Field Bias Corrected SP Radar"),
RADAR_COVERAGE_MAP("Radar Coverage Map");
private String text;
@ -108,9 +111,8 @@ public class DPAResource extends
}
}
/** The DPA file */
private DPAFile dpaFile;
/** The HRAP subgrid */
private HRAPSubGrid subGrid;
@ -148,9 +150,15 @@ public class DPAResource extends
private DrawableString mainString;
private DrawableString ignoredStr;
private DrawableString allZeroStr;
private int available = 0;
private SingleSiteRadarType radarType = SingleSiteRadarType.RAW_RADAR;
//private SingleSiteRadarType radarType = SingleSiteRadarType.RAW_SP_RADAR;
private SingleSiteRadarType radarType;
private boolean ignored = false;
private Date lastDate = null;
@ -182,7 +190,7 @@ public class DPAResource extends
getCapability(ColorableCapability.class).setColor(
RGBColors.getRGBColor("Yellow"));
}
/*
* (non-Javadoc)
*
@ -213,12 +221,14 @@ public class DPAResource extends
@Override
public String getName() {
if (dpaFile == null) {
return "No Data Available";
return "No Radar Data Available";
}
return dpaFile.getFile().getAbsolutePath();
}
//-------------------------------------------------------------------
/*
* (non-Javadoc)
*
@ -230,7 +240,7 @@ public class DPAResource extends
boolean missingData = false;
ColorMap colorMap = new ColorMap(colorSet.size());
// colorMap.setName(dataType.getCv_use());
colorMap.setName("RMOSAIC");
colorMap.setName("PRECIP_ACCUM");
DataMappingPreferences dmPref = new DataMappingPreferences();
int index = 0;
for (Colorvalue cv : colorSet) {
@ -274,122 +284,146 @@ public class DPAResource extends
parameters.setDataMin(0);
UnitConverter cvt = parameters.getDataToImageConverter();
try {
dpaFile.load();
missingData = false;
if (radarType == SingleSiteRadarType.RAW_RADAR) {
data = dpaFile.getStage1i();
} else if (radarType == SingleSiteRadarType.MEAN_FIELD_BIAS_CORRECTED_RADAR) {
data = dpaFile.getStage1u();
} else {
data = dpaFile.getZeroData();
}
} catch (Exception e) {
System.out.println("Exception caught loading DPA data " + e);
missingData = true;
try
{
buf = FloatBuffer.allocate(17161);
Date dtg = MPEDisplayManager.getCurrent().getCurrentEditDate();
// available = radar availability flag read from
// RWRadarResult or DAARadarResult table
// = 0 -- field available (some values > 0.0)
// = 1 -- field not available
// = 2 -- field available (all values = 0.0)
available = 0;
if (radarType == SingleSiteRadarType.RAW_DP_RADAR)
{
available = RadarDataManager.getInstance()
.getAvailableRadarDP(radId, dtg);
}
else
{
available = RadarDataManager.getInstance()
.getAvailableRadarSP(radId, dtg);
// check for special case of ignored radar
// this behavior is different than A1
ignored = RadarDataManager.getInstance()
.getIgnoreRadarSP(radId, dtg);
if(ignored) available = 0;
}
if (available == 0)
{
dpaFile.load();
if (radarType == SingleSiteRadarType.RAW_SP_RADAR)
{
System.out.println("DPAResource: Reading SP Radar Data ");
data = dpaFile.getStage1i();
}
else if (radarType == SingleSiteRadarType.RAW_DP_RADAR)
{
System.out.println("DPAResource: Reading DP Radar Data ");
data = dpaFile.getStage1i();
}
else if (radarType == SingleSiteRadarType.MEAN_FIELD_BIAS_CORRECTED_SP_RADAR)
{
System.out.println("DPAResource: Reading MFB Corrected SP Radar Data ");
data = dpaFile.getStage1u();
}
else
{
data = dpaFile.getZeroData();
}
for (int i = 0; i < 131; i++) {
for (int j = 0; j < 131; j++) {
float f = -9999;
if (data[i][j] != -9999) {
f = (float) Math.floor(cvt.convert(data[i][j]));
}
int dx = i - 66;
int dy = j - 66;
double dist = Math.sqrt(dx * dx + dy * dy);
// If grid cell outside radius then set missing
if (dist > ngrd) {
f = -9999;
}
buf.put(f);
}
}
buf.rewind();
missingData = false;
}
else if (available == 2)
{
for (int i = 0; i < 131; i++) {
for (int j = 0; j < 131; j++) {
buf.put(0.0f);
}
}
buf.rewind();
missingData = false;
}
else
{
for (int i = 0; i < 131; i++) {
for (int j = 0; j < 131; j++) {
buf.put(-1f);
}
}
buf.rewind();
missingData = true;
}
/* Retrieve the Latitude/Longitude of the radars */
Coordinate latLon;
List<MPERadarLoc> radarList = MPEDataManager.getInstance()
.getRadars();
for (MPERadarLoc radarLoc : radarList) {
if (radarLoc.getId().equalsIgnoreCase(radId)) {
latLon = radarLoc.getLatLon();
if (latLon == null) {
continue;
}
if ((latLon.x == 0.) || (latLon.y == 0.)) {
continue;
}
/* calculate HRAP coordinates from lat,lon */
Coordinate hp = new Coordinate(0, 0);
hp = HRAP.getInstance().latLonToGridCoordinate(latLon,
PixelOrientation.UPPER_LEFT);
int minx = (int) hp.x - 65;
int miny = (int) hp.y - 65;
extent = new Rectangle(minx, miny, 131, 131);
break;
}
}
if ((extent.x == 0) && (extent.y == 0)) {
Rectangle coord = HRAPCoordinates.getHRAPCoordinates();
if ((extent.width == coord.width)
&& (extent.height == coord.height)) {
extent = coord;
} else {
dpaFile = null;
return;
}
}
subGrid = new HRAPSubGrid(extent);
gridGeometry = MapUtil.getGridGeometry(subGrid);
project(gridGeometry.getCoordinateReferenceSystem());
}
try {
if (data == null) {
missingData = true;
} else {
buf = FloatBuffer.allocate(data.length * data.length);
Date dtg = RadarDataManager
.getInstance()
.getLatestObstimeDpaRadar(radId,
MPEDisplayManager.getCurrent().getCurrentEditDate());
// if available == 0
// available = radar availability flag array read from
// RWRadarResult
// table
// = 0 -- field available (some values > 0.0)
// = 1 -- field not available
// = 2 -- field available (all values = 0.0)
int available = RadarDataManager.getInstance()
.getAvailableRadar(radId, dtg);
if (available == 0) {
// for (int i = 131 - 1; i >= 0; i--) {
for (int i = 0; i < 131; i++) {
for (int j = 0; j < 131; j++) {
float f = -9999;
if (data[i][j] != -9999) {
f = (float) Math.floor(cvt.convert(data[i][j]));
}
int dx = i - 66;
int dy = j - 66;
double dist = Math.sqrt(dx * dx + dy * dy);
// If grid cell outside radius then set missing
if (dist > ngrd) {
f = -9999;
}
buf.put(f);
}
}
buf.rewind();
missingData = false;
} else if (available == 2) {
for (int i = 0; i < 131; i++) {
for (int j = 0; j < 131; j++) {
buf.put(0.0f);
}
}
buf.rewind();
} else {
for (int i = 0; i < 131; i++) {
for (int j = 0; j < 131; j++) {
buf.put(-1f);
}
}
buf.rewind();
missingData = true;
}
/* Retrieve the Latitude/Longitude of the station. */
Coordinate latLon;
List<MPERadarLoc> radarList = MPEDataManager.getInstance()
.getRadars();
for (MPERadarLoc radarLoc : radarList) {
if (radarLoc.getId().equalsIgnoreCase(radId)) {
latLon = radarLoc.getLatLon();
if (latLon == null) {
continue;
}
if ((latLon.x == 0.) || (latLon.y == 0.)) {
continue;
}
/* calculate HRAP coordinates from lat,lon */
Coordinate hp = new Coordinate(0, 0);
hp = HRAP.getInstance().latLonToGridCoordinate(latLon,
PixelOrientation.UPPER_LEFT);
int minx = (int) hp.x - 65;
int miny = (int) hp.y - 65;
extent = new Rectangle(minx, miny, 131, 131);
break;
}
}
if ((extent.x == 0) && (extent.y == 0)) {
Rectangle coord = HRAPCoordinates.getHRAPCoordinates();
if ((extent.width == coord.width)
&& (extent.height == coord.height)) {
extent = coord;
} else {
dpaFile = null;
return;
}
}
subGrid = new HRAPSubGrid(extent);
gridGeometry = MapUtil.getGridGeometry(subGrid);
project(gridGeometry.getCoordinateReferenceSystem());
}
} catch (Exception e) {
catch (Exception e)
{
dpaFile = null;
e.printStackTrace();
}
@ -398,21 +432,27 @@ public class DPAResource extends
ColorableCapability.class).getColor());
ignoredStr = new DrawableString(RADAR_IGNORED,
RGBColors.getRGBColor("Red"));
allZeroStr = new DrawableString(ALL_ZERO,
RGBColors.getRGBColor("Green"));
if (missingData
&& (radarType == SingleSiteRadarType.MEAN_FIELD_BIAS_CORRECTED_RADAR || radarType == SingleSiteRadarType.RAW_RADAR)) {
&& (radarType == SingleSiteRadarType.MEAN_FIELD_BIAS_CORRECTED_SP_RADAR
|| radarType == SingleSiteRadarType.RAW_SP_RADAR
|| radarType == SingleSiteRadarType.RAW_DP_RADAR))
{
missingString = new DrawableString(MISSING_DATA, getCapability(
ColorableCapability.class).getColor());
}
ignoredStr.font = mainString.font = target.initializeFont("Dialog", 12,
null);
ignoredStr.font = allZeroStr.font = mainString.font = target.initializeFont("Dialog", 12, null);
if (missingString != null) {
missingString.font = mainString.font;
}
}
//---------------------------------------------------------------
/*
* (non-Javadoc)
*
@ -463,9 +503,19 @@ public class DPAResource extends
Date date = MPEDisplayManager.getCurrent().getCurrentEditDate();
if (date.equals(lastDate) == false) {
// Check for ignored Radar
ignored = RadarDataManager.getInstance()
.getIgnoreRadar(radId, date);
lastDate = date;
if (radarType.equals(SingleSiteRadarType.RAW_SP_RADAR) ||
radarType.equals(SingleSiteRadarType.MEAN_FIELD_BIAS_CORRECTED_SP_RADAR))
{
ignored = RadarDataManager.getInstance()
.getIgnoreRadarSP(radId, date);
lastDate = date;
}
else if (radarType.equals(SingleSiteRadarType.RAW_DP_RADAR))
{
ignored = RadarDataManager.getInstance()
.getIgnoreRadarDP(radId, date);
lastDate = date;
}
}
if (missingString != null) {
@ -475,11 +525,24 @@ public class DPAResource extends
}
if (ignored
&& (radarType == SingleSiteRadarType.MEAN_FIELD_BIAS_CORRECTED_RADAR || radarType == SingleSiteRadarType.RAW_RADAR)) {
&& (radarType == SingleSiteRadarType.MEAN_FIELD_BIAS_CORRECTED_SP_RADAR || radarType == SingleSiteRadarType.RAW_SP_RADAR)) {
ignoredStr.setCoordinates(screenExtent.getMinX() + 50,
screenExtent.getMaxY() - 25, 0.0);
target.drawStrings(ignoredStr);
}
else if (ignored && (radarType == SingleSiteRadarType.RAW_DP_RADAR))
{
ignoredStr.setCoordinates(screenExtent.getMinX() + 50,
screenExtent.getMaxY() - 25, 0.0);
target.drawStrings(ignoredStr);
}
if (available == 2 && (radarType == SingleSiteRadarType.RAW_DP_RADAR || radarType == SingleSiteRadarType.RAW_SP_RADAR))
{
allZeroStr.setCoordinates(screenExtent.getMinX() + 600,
screenExtent.getMaxY() - 25, 0.0);
target.drawStrings(allZeroStr);
}
}
@Override

View file

@ -55,6 +55,7 @@ import com.raytheon.viz.core.contours.rsc.displays.GriddedContourDisplay;
import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay2;
import com.raytheon.viz.mpe.MPEDateFormatter;
import com.raytheon.viz.mpe.ui.Activator;
import com.raytheon.viz.mpe.ui.ComparisonFields;
import com.raytheon.viz.mpe.ui.DisplayFieldData;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.mpe.ui.dialogs.polygon.IPolygonEditsChangedListener;
@ -94,6 +95,8 @@ public class MPEFieldResource extends
implements IPolygonEditsChangedListener {
private static final short MISSING_VALUE = -899;
private static final int BIG_VALUE = 1000 ;
private static final int RATIO_CONVERSION_FACTOR = 100;
private ContourPreferences contourPreferences;
@ -327,52 +330,242 @@ public class MPEFieldResource extends
timeToLoad.setTime(currTime.getRefTime());
timeToLoad.add(Calendar.HOUR, -i);
XmrgFile file = MPEDisplayManager.getXmrgFile(displayField,
timeToLoad.getTime());
try {
file.load();
} catch (IOException e) {
Activator.statusHandler.handle(
Priority.INFO,
"Error loading XMRG file for "
+ displayField
+ " at time "
+ MPEDateFormatter
.format_MMM_dd_yyyy_HH(timeToLoad
.getTime()), e);
continue;
if (displayField==DisplayFieldData.satPre) {
//SATPRE MPE file time stamp is the start time of the hour
//i.e. a 12z -13z product has a time stamp of 12z.
timeToLoad.add(Calendar.HOUR, -1);
}
if (displayField.isAComparisonField() )
{
ComparisonFields comparisonFields = displayField.getComparisonFields();
DisplayFieldData field1 = comparisonFields.getField1();
DisplayFieldData field2 = comparisonFields.getField2();
XmrgFile file1 = MPEDisplayManager.getXmrgFile(field1,
timeToLoad.getTime());
XmrgFile file2 = MPEDisplayManager.getXmrgFile(field2,
timeToLoad.getTime());
boolean isDifference = false;
boolean isRatio = false;
if (displayField.equals(DisplayFieldData.precipDifferenceField))
{
isDifference = true;
Rectangle fileExtent = file.getHrapExtent();
short[] fileData = file.getData();
for (int y = 0; y < displayExtent.height; ++y) {
for (int x = 0; x < displayExtent.width; ++x) {
int px = x + displayExtent.x;
int py = y + displayExtent.y;
if (px >= fileExtent.x
&& px < (fileExtent.x + fileExtent.width)
&& py >= fileExtent.y
&& py < (fileExtent.y + fileExtent.height)) {
int frameIdx = y * displayExtent.width + x;
int fx = px - fileExtent.x;
int fy = py - fileExtent.y;
int fileIdx = fy * fileExtent.width + fx;
short fi = fileData[fileIdx];
short fc = frameData[frameIdx];
if (fc < 0 && fi >= 0) {
frameData[frameIdx] = fi;
} else if (fc >= 0 && fi > 0) {
frameData[frameIdx] += fi;
}
}
}
}
else if (displayField.equals(DisplayFieldData.precipRatioField))
{
isRatio = true;
}
try {
file1.load();
file2.load();
} catch (IOException e) {
Activator.statusHandler.handle(
Priority.INFO,
"Error loading XMRG file for "
+ field1 + " or " + field2
+ " at time "
+ MPEDateFormatter
.format_MMM_dd_yyyy_HH(timeToLoad
.getTime()), e);
continue;
}
Rectangle fileExtent = file1.getHrapExtent();
short[] file1Data = file1.getData();
short[] file2Data = file2.getData();
for (int y = 0; y < displayExtent.height; ++y) {
for (int x = 0; x < displayExtent.width; ++x) {
int px = x + displayExtent.x;
int py = y + displayExtent.y;
if (px >= fileExtent.x
&& px < (fileExtent.x + fileExtent.width)
&& py >= fileExtent.y
&& py < (fileExtent.y + fileExtent.height))
{
int frameIdx = y * displayExtent.width + x;
int fx = px - fileExtent.x;
int fy = py - fileExtent.y;
int fileIdx = fy * fileExtent.width + fx;
short value1 = file1Data[fileIdx];
short value2 = file2Data[fileIdx];
short fi = 0;
if (isDifference)
{
short diffValue = calculateDifference(value1, value2);
fi = diffValue;
}
else if (isRatio)
{
double ratio = calculateRatio(value1, value2);
if (ratio != MISSING_VALUE)
{
fi = (short) ( ratio * RATIO_CONVERSION_FACTOR );
}
else
{
fi = MISSING_VALUE;
}
}
//short fc = frameData[frameIdx];
//fc is initial value of frameData[frameIdx],
//it is used to help accumulate precip in a multi-hour accum situation
frameData[frameIdx] = fi;
} //end if (px >=)
} //end for x
} //end for y
}
}
else //is a non-comparison field
{
XmrgFile file = MPEDisplayManager.getXmrgFile(displayField,
timeToLoad.getTime());
try {
long fileLength = file.getFile().length();
//System.out.printf("FileName = %s, length = %d\n", file.getFile().getPath(), fileLength);
if (fileLength > 0)
{
file.load();
}
else //can't read the file since it is empty
{
continue;
}
} catch (IOException e) {
Activator.statusHandler.handle(
Priority.INFO,
"Error loading XMRG file for "
+ displayField
+ " at time "
+ MPEDateFormatter
.format_MMM_dd_yyyy_HH(timeToLoad
.getTime()), e);
continue;
}
Rectangle fileExtent = file.getHrapExtent();
short[] fileData = file.getData();
for (int y = 0; y < displayExtent.height; ++y) {
for (int x = 0; x < displayExtent.width; ++x) {
int px = x + displayExtent.x;
int py = y + displayExtent.y;
if (px >= fileExtent.x
&& px < (fileExtent.x + fileExtent.width)
&& py >= fileExtent.y
&& py < (fileExtent.y + fileExtent.height)) {
int frameIdx = y * displayExtent.width + x;
int fx = px - fileExtent.x;
int fy = py - fileExtent.y;
int fileIdx = fy * fileExtent.width + fx;
short fi = fileData[fileIdx];
short fc = frameData[frameIdx];
if (fc < 0 && fi >= 0)
{
//orig precip is missing, and this hour's value is valid (> = 0)
// so set the value to the current hour's value
frameData[frameIdx] = fi;
}
else if (fc >= 0 && fi > 0)
{
//some previous hour's precip has been recorded and this hour's value is valid (> = 0)
//so accumulate
frameData[frameIdx] += fi;
}
} //end if (px >=)
} //end for x
} //end for y
} //end else is a non-comparison field
} //end for i
return new MPEFieldFrame(currTime.getRefTime(), frameData,
PolygonEditManager.getPolygonEdits(resourceData.getFieldData(),
currTime.getRefTime()));
}
private short calculateDifference(short value1, short value2)
{
short result = 0;
if (( value1 >= 0) && (value2 >= 0) )
{
result = (short) (value1 - value2 );
}
else
{
result = MISSING_VALUE;
}
return result;
}
private double calculateRatio(short numerator, short denominator)
{
double result = 0;
if (denominator > 0)
{
if (numerator >= 0)
{
result = numerator / denominator;
}
else
{
result = MISSING_VALUE;
}
}
else if (denominator == 0)
{
if (numerator == 0)
{
result = 1.0; //if no rain, they are in agreeement, so show this
}
else if (numerator > 0)
{
result = BIG_VALUE;
}
else // numerator is missing
{
result = MISSING_VALUE;
}
}
else
{
result = MISSING_VALUE;
}
return result;
}
/*
* (non-Javadoc)
@ -418,9 +611,11 @@ public class MPEFieldResource extends
short[] imageData = new short[length];
switch (cvuse) {
case Locbias:
case LocbiasDP:
case Height:
case Index:
case Locspan:
case LocspanDP:
case mintempPrism:
case maxtempPrism:
for (int i = 0; i < length; ++i) {
@ -443,6 +638,21 @@ public class MPEFieldResource extends
}
}
break;
case precipDifferenceField:
case precipRatioField:
for (int i = 0; i < length; ++i) {
short value = data[i];
if (value == MISSING_VALUE) {
imageData[i] = 0;
}
else
{
imageData[i] = (short) dataToImage.convert(value);
}
}
break;
default :
for (int i = 0; i < length; ++i) {

View file

@ -271,10 +271,17 @@ public class MPEFieldResourceData extends AbstractMPEGriddedResourceData {
case Index:
case Locspan:
case Locbias:
case LocspanDP:
case LocbiasDP:
return Unit.ONE;
case mintempPrism:
case maxtempPrism:
return NonSI.FAHRENHEIT;
case precipRatioField:
return Unit.ONE; //unit-less
default:
return NonSI.INCH;
}
@ -283,18 +290,23 @@ public class MPEFieldResourceData extends AbstractMPEGriddedResourceData {
public static Unit<?> getDataUnitsForField(DisplayFieldData fieldData) {
switch (fieldData) {
case Locbias:
return Unit.ONE.divide(100);
case LocbiasDP:
return Unit.ONE.divide(100);
case Height:
return SI.METER;
case Index:
case Locspan:
return Unit.ONE;
case LocspanDP:
return Unit.ONE;
case Prism:
return SI.MILLIMETER;
case mintempPrism:
case maxtempPrism:
return NonSI.FAHRENHEIT.divide(10);
case precipRatioField:
return Unit.ONE.divide(100); //unit-less
default :
return SI.MILLIMETER.divide(100);
}

View file

@ -73,6 +73,7 @@ import com.raytheon.viz.mpe.MPEInterrogationConstants;
import com.raytheon.viz.mpe.core.MPEDataManager;
import com.raytheon.viz.mpe.ui.DisplayFieldData;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.mpe.ui.MPEDisplayManager.AvailableRadarGridType;
import com.raytheon.viz.mpe.ui.MPEFontFactory;
import com.raytheon.viz.mpe.ui.actions.DrawDQCStations;
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
@ -286,10 +287,14 @@ public class MPELegendResource extends
null);
int offset = 0;
RGB textColor = new RGB(255, 255, 255);
RGB productTypeTextColor = new RGB(0, 0, 0);
DrawableString strings = new DrawableString("", textColor);
strings.font = font;
if (displayMgr.getDisplayFieldType().equals(
DisplayFieldData.Index)) {
// Radar Coverage Map's type is called "Index"
if (displayMgr.getDisplayFieldType().equals(DisplayFieldData.Index))
{
offset = (int) (rsc.getCapability(ColorMapCapability.class)
.getColorMapParameters().getLabels().get(1)
.getLocation()
@ -297,15 +302,24 @@ public class MPELegendResource extends
}
int i = 0;
for (LabelEntry entry : rsc
.getCapability(ColorMapCapability.class)
.getColorMapParameters().getLabels()) {
List<LabelEntry> labelEntryList = rsc.getCapability(ColorMapCapability.class)
.getColorMapParameters().getLabels();
for (LabelEntry entry :labelEntryList)
{
if (entry.getText().length() > 10) {
if (entry.getText().length() > 10)
{
break;
} else {
}
else
{
double cbarSize = (width / cm.getSize());
double xLoc = xMin + offset + (cbarSize * i);
// strings.setText(entry.getText(), textColor);
strings.setText(entry.getText(), textColor);
strings.horizontalAlignment = HorizontalAlignment.CENTER;
strings.verticallAlignment = VerticalAlignment.TOP;
@ -315,12 +329,63 @@ public class MPELegendResource extends
i++;
}
//draw color bars
y1 += textSpace;
cmap.extent = new PixelExtent(xMin, xMin + width, y1, y1
+ cmapHeight);
target.drawColorRamp(cmap);
y1 += cmapHeight;
if (displayMgr.getDisplayFieldType().equals(DisplayFieldData.Index))
{
//draw radar product type indicator (S,D, M) for Single Pol, Dual Pol, or Missing
//this is drawn on top of the color bars
AvailableRadarGridType availableRadarGridType = AvailableRadarGridType.MISSING;
String typeString = null;
int offsetRadarList = 2;
for (int index = offsetRadarList; index < labelEntryList.size(); index++)
{
LabelEntry entry = labelEntryList.get(index);
String radarId = entry.getText();
if (radarId != "")
{
availableRadarGridType = displayMgr.getAvailableRadarType(radarId);
if (availableRadarGridType.equals(AvailableRadarGridType.SINGLE_AND_DUAL_POL))
{
typeString = "SD";
}
else if (availableRadarGridType.equals(AvailableRadarGridType.DUAL_POL))
{
typeString = "D";
}
else if (availableRadarGridType.equals(AvailableRadarGridType.SINGLE_POL))
{
typeString = "S";
}
else //missing
{
typeString = "M";
}
//System.out.println("radarid = " + radarId + " type = " + typeString);
double cbarSize = (width / cm.getSize());
int offsetForTypeString = offset + (int)(2*cbarSize);
double xLoc = xMin + offsetForTypeString + (cbarSize * (index - 2));
strings.setText(typeString, productTypeTextColor);
strings.horizontalAlignment = HorizontalAlignment.CENTER;
strings.verticallAlignment = VerticalAlignment.TOP;
strings.setCoordinates(xLoc, y1);
target.drawStrings(strings);
}
}
}
y1 += cmapHeight;
int accum = 0;
if (rsc instanceof MPEFieldResource) {
// IMPEResource.getAccumulationInterval()?
@ -329,11 +394,11 @@ public class MPELegendResource extends
}
String dateStr = legendFormat.format(paintProps.getFramesInfo()
.getTimeForResource(rsc).getRefTime())
+ "z";
.getTimeForResource(rsc).getRefTime()) + "Z";
if (accum > 0) {
String qpeString = String.format(
"%d hr Accumulated %s For %s Ending %sz (in)",
"%d hr Accumulated %s For %s Ending %s (in)",
accum, rsc.getName(), rfc, dateStr);
double xLoc = xMin + padding;
@ -838,7 +903,7 @@ public class MPELegendResource extends
DataTime date = frameInfo.getTimeForResource(rsc);
String time = " No Data Available";
if (date != null) {
time = " - " + date.getLegendString() + "z";
time = " - " + date.getLegendString();
}
legend.label += time;
}

View file

@ -0,0 +1,569 @@
/**
* 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.viz.mpe.ui.rsc;
import java.awt.Point;
import java.awt.Rectangle;
import java.nio.FloatBuffer;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.measure.converter.UnitConverter;
import javax.measure.unit.NonSI;
import javax.measure.unit.Unit;
import org.eclipse.swt.graphics.RGB;
import org.geotools.coverage.grid.GridGeometry2D;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.datum.PixelInCell;
import com.raytheon.uf.common.colormap.Color;
import com.raytheon.uf.common.colormap.ColorMap;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry;
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
import com.raytheon.uf.common.geospatial.ISpatialQuery;
import com.raytheon.uf.common.geospatial.ISpatialQuery.SearchMode;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
import com.raytheon.uf.common.geospatial.SpatialQueryResult;
import com.raytheon.uf.common.hydro.spatial.HRAP;
import com.raytheon.uf.common.hydro.spatial.HRAPCoordinates;
import com.raytheon.uf.common.hydro.spatial.HRAPSubGrid;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
import com.raytheon.viz.core.contours.rsc.displays.GriddedContourDisplay;
import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay;
import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay.GriddedImagePaintProperties;
import com.raytheon.viz.mpe.ui.DisplayFieldData;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.mpe.ui.dialogs.postanalysis.AsciiXmrgReader;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 16, 2011 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class PAAsciiXmrgResource extends
AbstractVizResource<PAAsciiXmrgResourceData, MapDescriptor> {
private static final GeometryFactory gf = new GeometryFactory();
private static final String PRECIP_BIAS = "PRECIP_BIAS";
private String filePath;
private AsciiXmrgReader asciiXmrgReader = null;
private HRAPSubGrid subGrid;
private GriddedImageDisplay gridDisplay;
private ColorMapParameters parameters;
private final float brightness = 1.0f;
private final float contrast = 1.0f;
private boolean isInterpolated;
private GriddedContourDisplay contourDisplay;
private GridGeometry2D gridGeometry;
private FloatBuffer buf;
private FloatBuffer cbuf;
private List<Colorvalue> colorSet;
private DisplayFieldData dataType;
/** Array of ascii xmrg data values */
private int[] data;
private float[] floatData;
private UnitConverter cvt;
private String cvUse;
private boolean isGridded = true;
private Rectangle extent;
/** The date of the data */
private Date dataDate;
public PAAsciiXmrgResource(PAAsciiXmrgResourceData resourceData, String cvUse,
String filePath, List<Colorvalue> colorSet) {
super(resourceData, new LoadProperties());
this.colorSet = colorSet;
this.cvUse = cvUse;
this.filePath = filePath;
this.resourceData = resourceData;
this.isGridded = true;
asciiXmrgReader = new AsciiXmrgReader(filePath);
loadData();
}
public PAAsciiXmrgResource(PAAsciiXmrgResourceData resourceData, String cvUse,
float[] floatData, List<Colorvalue> colorSet, Rectangle extent) {
super(resourceData, new LoadProperties());
this.colorSet = colorSet;
this.cvUse = cvUse;
this.resourceData = resourceData;
this.floatData = floatData;
this.extent = extent;
this.dataDate = MPEDisplayManager.getCurrent().getCurrentDisplayedDate();
this.isGridded = false;
loadData();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#disposeInternal()
*/
@Override
protected void disposeInternal() {
if (gridDisplay != null) {
gridDisplay.dispose();
gridDisplay = null;
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#paintInternal(com.raytheon
* .uf.viz.core.IGraphicsTarget,
* com.raytheon.uf.viz.core.drawables.PaintProperties)
*/
@Override
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
if (buf == null) {
return;
}
if (gridDisplay == null) {
gridDisplay = new GriddedImageDisplay(buf, descriptor, gridGeometry);
gridDisplay.setColorMapParameters(getCapability(
ColorMapCapability.class).getColorMapParameters());
}
GriddedImagePaintProperties giProps = new GriddedImagePaintProperties(
paintProps, brightness, contrast, isInterpolated);
gridDisplay.paint(target, giProps);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#initInternal(com.raytheon
* .uf.viz.core.IGraphicsTarget)
*/
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#project(org.opengis.
* referencing.crs.CoordinateReferenceSystem)
*/
@Override
public void project(CoordinateReferenceSystem crs) throws VizException {
// Delete the gridDisplay so it can be regenerated in the correct
// projection
if (gridDisplay != null) {
gridDisplay.dispose();
gridDisplay = null;
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#inspect(com.raytheon
* .uf.common.geospatial.ReferencedCoordinate)
*/
@Override
public String inspect(ReferencedCoordinate coord) throws VizException {
Map<String, Object> Values = interrogate(coord);
if (Values == null) {
return "NO DATA";
} else {
return Values.get("Value").toString();
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#interrogate(com.raytheon
* .uf.common.geospatial.ReferencedCoordinate)
*/
@Override
public Map<String, Object> interrogate(ReferencedCoordinate coord)
throws VizException {
// This returns the sampling text
if (isGridded) {
if (filePath == null) {
return null;
}
} else {
if (this.floatData == null) {
return null;
}
}
Map<String, Object> values = new HashMap<String, Object>();
try {
Coordinate gridCell = coord.asGridCell(HRAP.getInstance()
.getGridGeometry(), PixelInCell.CELL_CENTER);
Point p = new Point((int) gridCell.x, (int) gridCell.y);
values.put("X", Integer.toString(p.x));
values.put("Y", Integer.toString(p.y));
values.put("Value", "");
values.put("County", "Not Defined");
values.put("Basin", "Not Defined");
Rectangle extent = subGrid.getExtent();
if (extent.contains(p)) {
int x = p.x - extent.x;
int y = extent.height - 1 - (p.y - extent.y);
double value;
if (filePath != null) {
AsciiXmrgReader reader = new AsciiXmrgReader(filePath);
int result = reader.read();
int[] readerData = reader.getData();
this.extent = reader.getHrapExtent();
int intValue = readerData[y * subGrid.getNx() + x];
value = parameters.getDataToDisplayConverter().convert(intValue);
} else {
float f = floatData[y * subGrid.getNx() + x];
value = f;
}
DecimalFormat df = new DecimalFormat(
parameters.getFormatString());
values.put("Value", df.format(value));
}
ISpatialQuery query = SpatialQueryFactory.create();
com.vividsolutions.jts.geom.Point point = gf.createPoint(coord
.asLatLon());
SpatialQueryResult[] results = query.query("county",
new String[] { "countyname" }, point, null, false,
SearchMode.WITHIN);
String county = null;
if ((results != null) && (results.length > 0)) {
county = (String) results[0].attributes.get("countyname");
}
if ((county == null) || (county.length() < 0)) {
values.put("County", county);
}
results = query.query("basins", new String[] { "name" }, point,
null, false, SearchMode.WITHIN);
String basin = null;
if ((results != null) && (results.length > 0)) {
basin = (String) results[0].attributes.get("name");
}
if ((basin == null) || (basin.length() < 0)) {
values.put("Basin", basin);
}
} catch (Exception e) {
throw new VizException("Error performing interrogation", e);
}
return values;
}
/**
* Update the Xmrg Display.
*
* @param reload
* Reread the data from the file if true
*/
public void updateXmrg(boolean reload) {
if (asciiXmrgReader == null) {
return;
}
try {
if (reload || (data == null)) {
cvt = parameters.getDataToImageConverter();
data = asciiXmrgReader.getData();
}
buf = FloatBuffer.allocate(data.length);
for (int intValue : data) {
float f = (float) Math.floor(cvt.convert(intValue));
buf.put(f);
}
buf.rewind();
Rectangle extent = asciiXmrgReader.getHrapExtent();
if ((extent.x == 0) && (extent.y == 0)) {
Rectangle coord = HRAPCoordinates.getHRAPCoordinates();
if ((extent.width == coord.width)
&& (extent.height == coord.height)) {
extent = coord;
} else {
asciiXmrgReader = null;
return;
}
}
subGrid = new HRAPSubGrid(extent);
gridGeometry = MapUtil.getGridGeometry(subGrid);
project(gridGeometry.getCoordinateReferenceSystem());
issueRefresh();
} catch (Exception e) {
e.printStackTrace();
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#getName()
*/
@Override
public String getName() {
// This is the name that shows up in the legend
return "Post Analysis Ascii XMRG Data";
}
private void initColorMapParams() {
ColorMap colorMap = new ColorMap(colorSet.size());
DataMappingPreferences dmPref = new DataMappingPreferences();
int i = 0;
for (Colorvalue cv : colorSet) {
RGB rgb = RGBColors.getRGBColor(cv.getColorname().getColorName());
colorMap.setColor(i, new Color(rgb.red / 255f, rgb.green / 255f,
rgb.blue / 255f));
DataMappingEntry entry = new DataMappingEntry();
entry.setPixelValue((double) i);
entry.setDisplayValue(cv.getId().getThresholdValue());
dmPref.addEntry(entry);
i++;
}
DataMappingEntry entry = new DataMappingEntry();
entry.setPixelValue((double) (i - 1));
entry.setDisplayValue(Double.MAX_VALUE);
dmPref.addEntry(entry);
dmPref.getEntries().get(0).setLabel("");
dmPref.getEntries().get(1).setLabel("");
ColorMapCapability cmc = getCapability(ColorMapCapability.class);
parameters = cmc.getColorMapParameters();
if (parameters == null) {
parameters = new ColorMapParameters();
cmc.setColorMapParameters(parameters);
}
parameters.setColorMap(colorMap);
parameters.setDataMapping(dmPref);
Unit<?> displayUnit = NonSI.INCH;
Unit<?> dataUnit = NonSI.INCH.divide(100);
parameters.setFormatString("0.00");
parameters.setDisplayUnit(displayUnit);
parameters.setImageUnit(dmPref.getImageUnit(displayUnit));
parameters.setDataUnit(dataUnit);
//Chip Change that was removed, at least temporarily
//This change allow the displayUnit to be set differently for the bias map,
//the problem is that the map ALSO displays precip
// if (cvUse.equals(PRECIP_BIAS))
// {
// dataUnit = displayUnit;
// parameters.setDataUnit(dataUnit);
// }
// else
// {
// parameters.setDataUnit(dataUnit);
// }
parameters.setColorMapMax(parameters.getColorMap().getSize() - 1);
parameters.setColorMapMin(0);
parameters.setDataMax(parameters.getColorMap().getSize() - 1);
parameters.setDataMin(0);
cvt = parameters.getDataToImageConverter();
}
private void loadData()
{
initColorMapParams();
setData(asciiXmrgReader.getData());
try {
// Load the xmrg data
if (asciiXmrgReader != null) {
asciiXmrgReader.read();
data = asciiXmrgReader.getData();
buf = FloatBuffer.allocate(data.length);
float f = 0.0f;
String temps = "TEMP";
int tempsval = cvUse.indexOf(temps);
for (int intvalue : data) {
if (intvalue < 0) {
if ((intvalue == -9999) || (intvalue == -999) || (intvalue == -99)
|| ((intvalue == -9) && (tempsval == -1))) {
f = 0;
} else if ((intvalue == -8888) || (intvalue == -899)) {
f = 1;
} else {
f = (float) cvt.convert(intvalue);
}
} else {
if ((intvalue < 30) && (intvalue > 24)) {
intvalue = 26;
}
f = (float) cvt.convert(intvalue);
}
buf.put(f);
}
buf.rewind();
this.extent = asciiXmrgReader.getHrapExtent();
} else {
// Load and array of floats
buf = FloatBuffer.allocate(floatData.length);
for (float f : floatData) {
if (f < 0) {
f = -9999;
buf.put(0.0f);
} else {
buf.put((float) Math.floor(cvt.convert(f)));
}
}
}
if ((extent.x == 0) && (extent.y == 0)) {
Rectangle coord = HRAPCoordinates.getHRAPCoordinates();
if ((extent.width == coord.width)
&& (extent.height == coord.height)) {
extent = coord;
} else {
asciiXmrgReader = null;
return;
}
}
subGrid = new HRAPSubGrid(extent);
gridGeometry = MapUtil.getGridGeometry(subGrid);
project(gridGeometry.getCoordinateReferenceSystem());
} catch (Exception e) {
asciiXmrgReader = null;
e.printStackTrace();
}
}
/**
* @return the data
*/
public int[] getData() {
return data;
}
/**
* @param data
* the data to set
*/
public void setData(int[] data) {
this.data = data;
}
}

View file

@ -0,0 +1,231 @@
/**
* 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.viz.mpe.ui.rsc;
import java.awt.Rectangle;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
import com.raytheon.uf.common.mpe.util.XmrgFile;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.viz.hydrocommon.HydroDisplayManager;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.GetColorValues;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 16, 2011 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "xmrgResourceData")
@XmlType(name = "xmrgResourceData", namespace = "com.raytheon.viz.mpe.ui.dialogs.postanalysis.PAAsciiXmrgResourceData")
public class PAAsciiXmrgResourceData extends AbstractResourceData {
@XmlElement
//private XmrgFile xmrgfile;
private String filePath;
private float[] data;
private Rectangle extent;
@XmlElement
private String cvUse = "FFG";
@XmlElement
private int accumInterval = 0;
private List<Colorvalue> colorList;
public PAAsciiXmrgResourceData() {
//no-arg default constructor
}
public PAAsciiXmrgResourceData(String filePath, String cvUse) {
this.filePath = filePath;
this.cvUse = cvUse;
}
public PAAsciiXmrgResourceData(float[] data, Rectangle extent, String cvUse) {
this.data = data;
this.extent = extent;
this.cvUse = cvUse;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#construct(com.raytheon
* .uf.viz.core.rsc.LoadProperties,
* com.raytheon.uf.viz.core.drawables.IDescriptor)
*/
@Override
public AbstractVizResource<?, ?> construct(LoadProperties loadProperties,
IDescriptor descriptor) throws VizException {
String cvu = null;
if (cvUse.equalsIgnoreCase("MULTIHOUR")
|| cvUse.equalsIgnoreCase("xmrg")) {
cvu = "XMRG";
} else {
cvu = cvUse;
}
if (colorList == null) {
String user_id = System.getProperty("user.name");
int duration = 1;
colorList = GetColorValues.get_colorvalues(user_id,
HydroDisplayManager.MPE_APPLICATION_NAME, cvu, duration,
"E", HydroDisplayManager.getInstance()
.getNamedColorUseSetList());
}
if (filePath != null) {
return new PAAsciiXmrgResource(this, cvUse, filePath, colorList);
} else {
return new PAAsciiXmrgResource(this, cvUse, data, colorList, extent);
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#update(java.lang.Object
* )
*/
@Override
public void update(Object updateData) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#equals(java.lang.Object
* )
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (getClass() != obj.getClass()) {
return false;
}
return true;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
MPEDisplayManager dm = MPEDisplayManager.getCurrent();
final int prime = 31;
int result = 1;
result = prime * result + ((dm == null) ? 0 : dm.hashCode());
return result;
}
/**
* @param data
* the data to set
*/
public void setData(float[] data) {
this.data = data;
}
/**
* @return the data
*/
public float[] getData() {
return data;
}
/**
* @param extent
* the extent to set
*/
public void setExtent(Rectangle extent) {
this.extent = extent;
}
/**
* @return the extent
*/
public Rectangle getExtent() {
return extent;
}
public String getCvUse() {
return cvUse;
}
public void setCvUse(String cvUse) {
this.cvUse = cvUse;
}
public int getAccumInterval() {
return accumInterval;
}
public void setAccumInterval(int accumInterval) {
this.accumInterval = accumInterval;
}
public List<Colorvalue> getColorList() {
return colorList;
}
public void setColorList(List<Colorvalue> colorList) {
this.colorList = colorList;
}
}

View file

@ -0,0 +1,567 @@
/**
* 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.viz.mpe.ui.rsc;
import java.awt.Point;
import java.awt.Rectangle;
import java.nio.FloatBuffer;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.measure.converter.UnitConverter;
import javax.measure.unit.NonSI;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import org.eclipse.swt.graphics.RGB;
import org.geotools.coverage.grid.GridGeometry2D;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.datum.PixelInCell;
import com.raytheon.uf.common.colormap.Color;
import com.raytheon.uf.common.colormap.ColorMap;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry;
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
import com.raytheon.uf.common.geospatial.ISpatialQuery;
import com.raytheon.uf.common.geospatial.ISpatialQuery.SearchMode;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
import com.raytheon.uf.common.geospatial.SpatialQueryResult;
import com.raytheon.uf.common.hydro.spatial.HRAP;
import com.raytheon.uf.common.hydro.spatial.HRAPCoordinates;
import com.raytheon.uf.common.hydro.spatial.HRAPSubGrid;
import com.raytheon.uf.common.mpe.util.XmrgFile;
import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
import com.raytheon.viz.core.contours.rsc.displays.GriddedContourDisplay;
import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay;
import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay.GriddedImagePaintProperties;
import com.raytheon.viz.mpe.ui.DisplayFieldData;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 16, 2011 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class PAXmrgResource extends
AbstractVizResource<PAXmrgResourceData, MapDescriptor> {
private static final GeometryFactory gf = new GeometryFactory();
private static final String PRECIP_BIAS = "PRECIP_BIAS";
private static final String PRECIP_RATIO = "PRECIP_RATIO";
private XmrgFile xmrg;
private HRAPSubGrid subGrid;
private GriddedImageDisplay gridDisplay;
private ColorMapParameters parameters;
private final float brightness = 1.0f;
private final float contrast = 1.0f;
private boolean isInterpolated;
private GriddedContourDisplay contourDisplay;
private GridGeometry2D gridGeometry;
private FloatBuffer buf;
private FloatBuffer cbuf;
private List<Colorvalue> colorSet;
private DisplayFieldData dataType;
/** Array of xmrg data values */
private short[] data;
private float[] floatData;
private UnitConverter cvt;
private String cvUse;
private boolean isGridded = true;
private Rectangle extent;
/** The date of the data */
private Date dataDate;
public PAXmrgResource(PAXmrgResourceData resourceData, String cvUse,
XmrgFile xmrg, List<Colorvalue> colorSet) {
super(resourceData, new LoadProperties());
this.colorSet = colorSet;
this.cvUse = cvUse;
this.xmrg = xmrg;
this.resourceData = resourceData;
this.isGridded = true;
loadData();
}
public PAXmrgResource(PAXmrgResourceData resourceData, String cvUse,
float[] floatData, List<Colorvalue> colorSet, Rectangle extent) {
super(resourceData, new LoadProperties());
this.colorSet = colorSet;
this.cvUse = cvUse;
this.resourceData = resourceData;
this.floatData = floatData;
this.extent = extent;
this.dataDate = MPEDisplayManager.getCurrent().getCurrentDisplayedDate();
this.isGridded = false;
loadData();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#disposeInternal()
*/
@Override
protected void disposeInternal() {
if (gridDisplay != null) {
gridDisplay.dispose();
gridDisplay = null;
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#paintInternal(com.raytheon
* .uf.viz.core.IGraphicsTarget,
* com.raytheon.uf.viz.core.drawables.PaintProperties)
*/
@Override
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
if (buf == null) {
return;
}
if (gridDisplay == null) {
gridDisplay = new GriddedImageDisplay(buf, descriptor, gridGeometry);
gridDisplay.setColorMapParameters(getCapability(
ColorMapCapability.class).getColorMapParameters());
}
GriddedImagePaintProperties giProps = new GriddedImagePaintProperties(
paintProps, brightness, contrast, isInterpolated);
gridDisplay.paint(target, giProps);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#initInternal(com.raytheon
* .uf.viz.core.IGraphicsTarget)
*/
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#project(org.opengis.
* referencing.crs.CoordinateReferenceSystem)
*/
@Override
public void project(CoordinateReferenceSystem crs) throws VizException {
// Delete the gridDisplay so it can be regenerated in the correct
// projection
if (gridDisplay != null) {
gridDisplay.dispose();
gridDisplay = null;
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#inspect(com.raytheon
* .uf.common.geospatial.ReferencedCoordinate)
*/
@Override
public String inspect(ReferencedCoordinate coord) throws VizException {
Map<String, Object> Values = interrogate(coord);
if (Values == null) {
return "NO DATA";
} else {
return Values.get("Value").toString();
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#interrogate(com.raytheon
* .uf.common.geospatial.ReferencedCoordinate)
*/
@Override
public Map<String, Object> interrogate(ReferencedCoordinate coord)
throws VizException {
// This returns the sampling text
if (isGridded) {
if (xmrg == null) {
return null;
}
} else {
if (this.floatData == null) {
return null;
}
}
Map<String, Object> values = new HashMap<String, Object>();
try {
Coordinate gridCell = coord.asGridCell(HRAP.getInstance()
.getGridGeometry(), PixelInCell.CELL_CENTER);
Point p = new Point((int) gridCell.x, (int) gridCell.y);
values.put("X", Integer.toString(p.x));
values.put("Y", Integer.toString(p.y));
values.put("Value", "");
values.put("County", "Not Defined");
values.put("Basin", "Not Defined");
Rectangle extent = subGrid.getExtent();
if (extent.contains(p)) {
int x = p.x - extent.x;
int y = extent.height - 1 - (p.y - extent.y);
double value;
if (xmrg != null) {
short s = xmrg.getData()[y * subGrid.getNx() + x];
value = parameters.getDataToDisplayConverter().convert(s);
} else {
float f = floatData[y * subGrid.getNx() + x];
value = f;
}
DecimalFormat df = new DecimalFormat(
parameters.getFormatString());
values.put("Value", df.format(value));
}
ISpatialQuery query = SpatialQueryFactory.create();
com.vividsolutions.jts.geom.Point point = gf.createPoint(coord
.asLatLon());
SpatialQueryResult[] results = query.query("county",
new String[] { "countyname" }, point, null, false,
SearchMode.WITHIN);
String county = null;
if ((results != null) && (results.length > 0)) {
county = (String) results[0].attributes.get("countyname");
}
if ((county == null) || (county.length() < 0)) {
values.put("County", county);
}
results = query.query("basins", new String[] { "name" }, point,
null, false, SearchMode.WITHIN);
String basin = null;
if ((results != null) && (results.length > 0)) {
basin = (String) results[0].attributes.get("name");
}
if ((basin == null) || (basin.length() < 0)) {
values.put("Basin", basin);
}
} catch (Exception e) {
throw new VizException("Error performing interrogation", e);
}
return values;
}
/**
* Update the Xmrg Display.
*
* @param reload
* Reread the data from the file if true
*/
public void updateXmrg(boolean reload) {
if (xmrg == null) {
return;
}
try {
if (reload || (data == null)) {
cvt = parameters.getDataToImageConverter();
data = xmrg.getData();
}
buf = FloatBuffer.allocate(data.length);
for (short s : data) {
float f = (float) Math.floor(cvt.convert(s));
buf.put(f);
}
buf.rewind();
Rectangle extent = xmrg.getHrapExtent();
if ((extent.x == 0) && (extent.y == 0)) {
Rectangle coord = HRAPCoordinates.getHRAPCoordinates();
if ((extent.width == coord.width)
&& (extent.height == coord.height)) {
extent = coord;
} else {
xmrg = null;
return;
}
}
subGrid = new HRAPSubGrid(extent);
gridGeometry = MapUtil.getGridGeometry(subGrid);
project(gridGeometry.getCoordinateReferenceSystem());
issueRefresh();
} catch (Exception e) {
e.printStackTrace();
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#getName()
*/
@Override
public String getName() {
// This is the name that shows up in the legend
return "Post Analysis XMRG Data";
}
private void initColorMapParams() {
ColorMap colorMap = new ColorMap(colorSet.size());
DataMappingPreferences dmPref = new DataMappingPreferences();
int i = 0;
for (Colorvalue cv : colorSet) {
RGB rgb = RGBColors.getRGBColor(cv.getColorname().getColorName());
colorMap.setColor(i, new Color(rgb.red / 255f, rgb.green / 255f,
rgb.blue / 255f));
DataMappingEntry entry = new DataMappingEntry();
entry.setPixelValue((double) i);
entry.setDisplayValue(cv.getId().getThresholdValue());
dmPref.addEntry(entry);
i++;
}
DataMappingEntry entry = new DataMappingEntry();
entry.setPixelValue((double) (i - 1));
entry.setDisplayValue(Double.MAX_VALUE);
dmPref.addEntry(entry);
dmPref.getEntries().get(0).setLabel("");
dmPref.getEntries().get(1).setLabel("");
ColorMapCapability cmc = getCapability(ColorMapCapability.class);
parameters = cmc.getColorMapParameters();
if (parameters == null) {
parameters = new ColorMapParameters();
cmc.setColorMapParameters(parameters);
}
parameters.setColorMap(colorMap);
parameters.setDataMapping(dmPref);
Unit<?> displayUnit = NonSI.INCH;
Unit<?> dataUnit = SI.MILLIMETER.divide(100);
parameters.setFormatString("0.00");
parameters.setDisplayUnit(displayUnit);
parameters.setImageUnit(dmPref.getImageUnit(displayUnit));
//Chip Change that was removed, at least temporarily
//This change allow the displayUnit to be set differently for the bias map,
//the problem is that the map ALSO displays precip
// parameters.setDataUnit(dataUnit);
if (cvUse.equals(PRECIP_RATIO ))
{
dataUnit = displayUnit;
parameters.setDataUnit(dataUnit);
}
else
{
parameters.setDataUnit(dataUnit);
}
parameters.setColorMapMax(parameters.getColorMap().getSize() - 1);
parameters.setColorMapMin(0);
parameters.setDataMax(parameters.getColorMap().getSize() - 1);
parameters.setDataMin(0);
cvt = parameters.getDataToImageConverter();
}
/**
* Load the data from the xmrg file into memory
*/
private void loadData() {
initColorMapParams();
AppsDefaults appsDefaults = AppsDefaults.getInstance();
String header = "PAXmrgResource.loadData(): ";
try {
// Load the xmrg data
if (xmrg != null) {
xmrg.load();
this.dataDate = xmrg.getHeader().getValidDate();
data = xmrg.getData();
buf = FloatBuffer.allocate(data.length);
float f = 0.0f;
String temps = "TEMP";
int tempsval = cvUse.indexOf(temps);
for (short s : data) {
if (s < 0) {
if ((s == -9999) || (s == -999) || (s == -99)
|| ((s == -9) && (tempsval == -1))) {
f = 0;
} else if ((s == -8888) || (s == -899)) {
f = 1;
} else {
f = (float) cvt.convert(s);
}
} else {
if ((s < 30) && (s > 24)) {
s = 26;
}
f = (float) cvt.convert(s);
}
buf.put(f);
}
buf.rewind();
this.extent = xmrg.getHrapExtent();
} else {
// Load and array of floats
buf = FloatBuffer.allocate(floatData.length);
for (float f : floatData) {
if (f < 0) {
f = -9999;
buf.put(0.0f);
} else {
buf.put((float) Math.floor(cvt.convert(f)));
}
}
}
if ((extent.x == 0) && (extent.y == 0)) {
Rectangle coord = HRAPCoordinates.getHRAPCoordinates();
if ((extent.width == coord.width)
&& (extent.height == coord.height)) {
extent = coord;
} else {
xmrg = null;
return;
}
}
subGrid = new HRAPSubGrid(extent);
gridGeometry = MapUtil.getGridGeometry(subGrid);
project(gridGeometry.getCoordinateReferenceSystem());
} catch (Exception e) {
xmrg = null;
System.err.println("XMRG file not found");
}
}
/**
* @return the xmrg
*/
public XmrgFile getXmrgFile() {
return xmrg;
}
/**
* @return the data
*/
public short[] getData() {
return data;
}
/**
* @param data
* the data to set
*/
public void setData(short[] data) {
this.data = data;
}
}

View file

@ -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.viz.mpe.ui.rsc;
import java.awt.Rectangle;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
import com.raytheon.uf.common.mpe.util.XmrgFile;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.viz.hydrocommon.HydroDisplayManager;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.GetColorValues;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 16, 2011 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "xmrgResourceData")
@XmlType(name = "xmrgResourceData", namespace = "com.raytheon.viz.mpe.ui.dialogs.postanalysis.PAXmrgResourceData")
public class PAXmrgResourceData extends AbstractResourceData {
@XmlElement
private XmrgFile xmrgfile;
private float[] data;
private Rectangle extent;
@XmlElement
private String cvUse = "FFG";
@XmlElement
private int accumInterval = 0;
private List<Colorvalue> colorList;
//no-arg default constructor
public PAXmrgResourceData() {
}
public PAXmrgResourceData(XmrgFile xmrgfile, String cvUse) {
this.xmrgfile = xmrgfile;
this.cvUse = cvUse;
}
public PAXmrgResourceData(float[] data, Rectangle extent, String cvUse) {
this.data = data;
this.extent = extent;
this.cvUse = cvUse;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#construct(com.raytheon
* .uf.viz.core.rsc.LoadProperties,
* com.raytheon.uf.viz.core.drawables.IDescriptor)
*/
@Override
public AbstractVizResource<?, ?> construct(LoadProperties loadProperties,
IDescriptor descriptor) throws VizException {
String cvu = null;
if (cvUse.equalsIgnoreCase("MULTIHOUR")
|| cvUse.equalsIgnoreCase("xmrg")) {
cvu = "XMRG";
} else {
cvu = cvUse;
}
if (colorList == null) {
String user_id = System.getProperty("user.name");
int duration = 1;
colorList = GetColorValues.get_colorvalues(user_id,
HydroDisplayManager.MPE_APPLICATION_NAME, cvu, duration,
"E", HydroDisplayManager.getInstance()
.getNamedColorUseSetList());
}
if (xmrgfile == null) {
return new PAXmrgResource(this, cvUse, data, colorList, extent);
} else {
return new PAXmrgResource(this, cvUse, xmrgfile, colorList);
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#update(java.lang.Object
* )
*/
@Override
public void update(Object updateData) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#equals(java.lang.Object
* )
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (getClass() != obj.getClass()) {
return false;
}
return true;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
MPEDisplayManager dm = MPEDisplayManager.getCurrent();
final int prime = 31;
int result = 1;
result = prime * result + ((dm == null) ? 0 : dm.hashCode());
return result;
}
/**
* @param data
* the data to set
*/
public void setData(float[] data) {
this.data = data;
}
/**
* @return the data
*/
public float[] getData() {
return data;
}
/**
* @param extent
* the extent to set
*/
public void setExtent(Rectangle extent) {
this.extent = extent;
}
/**
* @return the extent
*/
public Rectangle getExtent() {
return extent;
}
public String getCvUse() {
return cvUse;
}
public void setCvUse(String cvUse) {
this.cvUse = cvUse;
}
public int getAccumInterval() {
return accumInterval;
}
public void setAccumInterval(int accumInterval) {
this.accumInterval = accumInterval;
}
public List<Colorvalue> getColorList() {
return colorList;
}
public void setColorList(List<Colorvalue> colorList) {
this.colorList = colorList;
}
}

View file

@ -282,8 +282,8 @@ public class RadarCoverageResource extends
for (int i = 0; i < 131; i++) {
for (int j = 0; j < 131; j++) {
float f = -9999;
if (data[i][j] != -9999) {
f = (float) Math.floor(cvt.convert(data[i][j]));
if (data[130-i][j] != -9999) {
f = (float) Math.floor(cvt.convert(data[130-i][j]));
}
int dx = i - 66;
@ -403,7 +403,8 @@ public class RadarCoverageResource extends
string.verticallAlignment = VerticalAlignment.TOP;
target.drawStrings(string);
if (missingData) {
if (missingData)
{
string.setText(MISSING_DATA, textColor);
string.setCoordinates(screenExtent.getMinX() + 350,
screenExtent.getMinY() + 550);

View file

@ -78,6 +78,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* updating RawPP records
* Nov 24, 2008 1748 snaples Added getters to MPEGageData
* Jun 18, 2013 16053 snaples Removed methods set and getRadarEditFlag
* Dec 15 2013 DCS 167 cgobs DualPol capabilities
* </pre>
*
* @author randerso
@ -149,7 +150,9 @@ public class MPEDataManager {
private short[] unbiasedRadarData;
private double rwBiasValUsed;
// private double daaBiasValUsed;
private double memSpanUsed;
private String editBias;
@ -201,10 +204,22 @@ public class MPEDataManager {
return rwBiasValUsed;
}
/*
public double getDAABiasValUsed() {
return daaBiasValUsed;
}
*/
public void setRwBiasValUsed(double rwBiasValUsed) {
this.rwBiasValUsed = rwBiasValUsed;
}
/*
public void setDAABiasValUsed(double daaBiasValUsed) {
this.daaBiasValUsed = daaBiasValUsed;
}
*/
/**
* @return the memSpanUsed
*/
@ -769,7 +784,7 @@ public class MPEDataManager {
}
}
public Map<String, MPERadarData> readRadarData(Date date) {
public Map<String, MPERadarData> OrigReadRadarData(Date date) {
getRadars();
StringBuffer sqlQuery = new StringBuffer();
sqlQuery.append("select radid,num_gages,rad_avail, rw_bias_val_used,mem_span_used, edit_bias, ignore_radar from rwradarresult where obstime='"
@ -847,6 +862,98 @@ public class MPEDataManager {
return radarResultList;
}
public Map<String, MPERadarData> readSPRadarData(Date date)
{
//reads DPA radar data
return readRadarData(date, "rwradarresult");
}
public Map<String, MPERadarData> readDPRadarData(Date date)
{
//reads DAA radar data
return readRadarData(date, "daaradarresult");
}
public Map<String, MPERadarData> readRadarData(Date date, String tableName) {
getRadars();
StringBuffer sqlQuery = new StringBuffer();
sqlQuery.append("select radid,num_gages, rad_avail, rw_bias_val_used, mem_span_used, edit_bias, ignore_radar from " +
tableName + " where obstime='" + sdf.format(date) + "' and radid in(");
for (int i = 0; i < radarList.size(); i++) {
sqlQuery.append("'");
sqlQuery.append(radarList.get(i).getId());
sqlQuery.append("'");
if (i != radarList.size() - 1) {
sqlQuery.append(",");
}
}
sqlQuery.append(") order by radid asc");
Map<String, MPERadarData> radarResultList = new HashMap<String, MPERadarData>(
radarList.size());
try {
List<Object[]> results = DirectDbQuery
.executeQuery(sqlQuery.toString(), HydroConstants.IHFS,
QueryLanguage.SQL);
Iterator<Object[]> iter = results.iterator();
Object[] item = iter.hasNext() ? iter.next() : null;
for (MPERadarLoc radarLoc : radarList) {
MPERadarData radarData = new MPERadarData();
int compareResult = item == null ? -1 : radarLoc.getId()
.compareTo((String) item[0]);
if (compareResult < 0) {
radarData.setProductDate(date);
} else if (compareResult == 0) {
radarData.setNumGages((Integer) item[1]);
RadarAvailability radAvail = RadarAvailability.MISSING;
if ("y".equals(item[2])) {
radAvail = RadarAvailability.AVAILABLE;
} else if ("z".equals(item[2])) {
radAvail = RadarAvailability.ZERO;
}
radarData.setRadAvail(radAvail);
radarData.setRwBiasValUsed((Double) item[3]);
radarData.setMemSpanUsed((Double) item[4]);
radarData.setEditBias((String) item[5]);
radarData.setIgnoreRadar(!"n".equals(item[6]));
if (radAvail.equals(RadarAvailability.AVAILABLE)
|| radAvail.equals(RadarAvailability.ZERO)) {
radarData.setProductDate(readProductDateTime(
radarLoc.getId(), date));
}
item = iter.hasNext() ? iter.next() : null;
} else {
statusHandler.handle(
Priority.PROBLEM,
"Record not found in " + tableName + " table for "
+ radarLoc.getId() + " for time "
+ sdf.format(date) + "Z");
// VizApp.logAndAlert(IStatus.WARNING, null, "Warning",
// "Record not found in RWRadarResult table for "
// + radarLoc.getId() + " for time "
// + sdf.format(date) + "Z", Activator
// .getDefault(), Activator.PLUGIN_ID);
}
radarResultList.put(radarLoc.getId(), radarData);
}
} catch (VizException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return radarResultList;
}
public Date readProductDateTime(String radarId, Date date) {
Date productDate = null;

View file

@ -252,11 +252,17 @@ public class GenerateAccumGrids {
yyyyMMddHH.format(ts));
}
System.out.println("GenerateAccumGrids.Read1hrQPEGrid(): qpe_filename: " + qpe_filename);
XmrgFile xmrg = new XmrgFile(qpe_filename);
try {
xmrg.load();
Rectangle extent = xmrg.getHrapExtent();
DailyQcUtils.QPEgrid1hr = xmrg.getData(extent);
long fileLength = xmrg.getFile().length();
if (fileLength > 0)
{
xmrg.load();
Rectangle extent = xmrg.getHrapExtent();
DailyQcUtils.QPEgrid1hr = xmrg.getData(extent);
}
} catch (FileNotFoundException e) {
System.out.println("xmrg file not found: " + qpe_filename);

View file

@ -64,6 +64,8 @@ public class ReadQPFGrids {
public int read_qpf_grids(int num, String dbuf) {
System.out.println("ReadQPFGrids.read_qpf_grids(): num = " + num);
int i, j;
hrap_grid = DailyQcUtils.getHrap_grid();
String kbuf = "";

View file

@ -0,0 +1,582 @@
package ohd.hseb.mpe.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import ohd.hseb.grid.XmrgGrid;
import ohd.hseb.util.AppsDefaults;
/**
*
* @author lawrence
*
* Represents an MPE Product.
*
*/
public class MPEProductDescriptor implements Comparable<MPEProductDescriptor>
{
public static final String MPE_RMOSAIC = "RMOSAIC";
public static final String MPE_AVGRMOSAIC = "AVGRMOSAIC";
public static final String MPE_MAXRMOSAIC = "MAXRMOSAIC";
public static final String MPE_BMOSAIC = "BMOSAIC";
public static final String MPE_LMOSAIC = "LMOSAIC";
public static final String MPE_GAGEONLY = "GAGEONLY";
public static final String MPE_MMOSAIC = "MMOSAIC";
public static final String MPE_MLMOSAIC = "MLMOSAIC";
public static final String MPE_SATPRE = "SATPRE";
public static final String MPE_LSATPRE = "LSATPRE";
public static final String MPE_SRMOSAIC = "SRMOSAIC";
public static final String MPE_SGMOSAIC = "SGMOSAIC";
public static final String MPE_SRGMOSAIC = "SRGMOSAIC";
public static final String MPE_P3LMOSAIC = "P3LMOSAIC";
public static final String MPE_BESTQPE = "xmrg";
public static final String MPE_RFCBMOSAIC = "RFCBMOSAIC";
public static final String MPE_RFCMMOSAIC = "RFCMMOSAIC";
public static final String MPE_RFCMOSAIC = "RFCMOSAIC";
//Q2 products
public static final String MPE_QMOSAIC = "QMOSAIC";
public static final String MPE_LQMOSAIC = "LQMOSAIC";
public static final String MPE_MLQMOSAIC = "MLQMOSAIC";
//Dual-Pol products
public static final String MPE_RDMOSAIC = "RDMOSAIC";
public static final String MPE_AVGRDMOSAIC = "AVGRDMOSAIC";
public static final String MPE_MAXRDMOSAIC = "MAXRDMOSAIC";
public static final String MPE_BDMOSAIC = "BDMOSAIC";
public static final String MPE_LDMOSAIC = "LDMOSAIC";
public static final String MPE_MDMOSAIC = "MDMOSAIC";
public static final String MPE_MLDMOSAIC = "MLDMOSAIC";
public static final String MPE_SRDMOSAIC = "SRDMOSAIC";
public static final String MPE_SRDGMOSAIC = "SRDGMOSAIC";
//begin dual pol
public static final MPEProductDescriptor MPE_RDMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"DP Radar Mosaic", MPE_RDMOSAIC, "DP Radar Mosaic", "mpe_rdmosaic_dir",
null, null);
public static final MPEProductDescriptor MPE_AVGRDMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"DP Avg Radar Mosaic", MPE_AVGRDMOSAIC, "DP Avg Radar Mosaic", "mpe_avgrdmosaic_dir",
null, null);
public static final MPEProductDescriptor MPE_MAXRDMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"DP Max Radar Mosaic", MPE_MAXRDMOSAIC, "DP Max Radar Mosaic", "mpe_maxrdmosaic_dir",
null, null);
public static final MPEProductDescriptor MPE_BDMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"DP Field Bias Radar Mosaic", MPE_BDMOSAIC, "DP Field Bias Radar Mosaic", "mpe_bdmosaic_dir",
null, null);
public static final MPEProductDescriptor MPE_LDMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"DP Local Bias Radar Mosaic", MPE_LDMOSAIC, "DP Local Bias Radar Mosaic", "mpe_ldmosaic_dir",
null, null);
public static final MPEProductDescriptor MPE_MDMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"DP Field Bias Multisensor Radar Mosaic", MPE_MDMOSAIC, "DP Field Bias Multisensor Radar Mosaic", "mpe_mdmosaic_dir",
null, null);
public static final MPEProductDescriptor MPE_MLDMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"DP Local Bias Multisensor Radar Mosaic", MPE_MLDMOSAIC, "DP Local Bias Multisensor Radar Mosaic", "mpe_mldmosaic_dir",
null, null);
public static final MPEProductDescriptor MPE_SRDMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"DP Satellite Radar Mosaic", MPE_SRDMOSAIC, "DP Satellite Radar Mosaic", "mpe_srdmosaic_dir",
null, null);
public static final MPEProductDescriptor MPE_SRDGMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"DP Satellite Radar Gage Mosaic", MPE_SRDGMOSAIC, "DP Satellite Radar Gage Mosaic", "mpe_srdgmosaic_dir",
null, null);
//end dual pol
public static final MPEProductDescriptor MPE_RMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Radar Mosaic", MPE_RMOSAIC, "Radar Mosaic", "mpe_rmosaic_dir",
null, null);
public static final MPEProductDescriptor MPE_AVGRMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Average Radar Mosaic", MPE_AVGRMOSAIC, "Average Radar Mosaic",
"mpe_avgrmosaic_dir", null, null);
public static final MPEProductDescriptor MPE_MAXRMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Maximum Radar Mosaic", MPE_MAXRMOSAIC, "Maximum Radar Mosaic",
"mpe_maxrmosaic_dir", null, null);
public static final MPEProductDescriptor MPE_BMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Field Bias Mosaic", MPE_BMOSAIC, "Field Bias Mosaic",
"mpe_bmosaic_dir", new String[] { MPE_RMOSAIC }, null);
public static final MPEProductDescriptor MPE_LMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Local Bias Mosaic", MPE_LMOSAIC, "Local Bias Mosaic",
"mpe_lmosaic_dir", new String[] { MPE_RMOSAIC }, null);
public static final MPEProductDescriptor MPE_GAGEONLY_DESCRIPTOR = new MPEProductDescriptor(
"Gage Only Analysis", MPE_GAGEONLY, "Gage Only Analysis",
"mpe_gageonly_dir", new String[] { MPE_RMOSAIC }, null);
public static final MPEProductDescriptor MPE_MMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Multi-sensor Mosaic", MPE_MMOSAIC, "Multi-sensor Mosaic",
"mpe_mmosaic_dir", new String[] { MPE_RMOSAIC,
"MMOSAIC" }, null);
public static final MPEProductDescriptor MPE_MLMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Local Bias Multi-sensor Mosaic", MPE_MLMOSAIC, "Local Bias Multi-sensor Mosaic",
"mpe_mlmosaic_dir", new String[] { MPE_RMOSAIC, MPE_LMOSAIC }, null);
public static final MPEProductDescriptor MPE_SATPRE_DESCRIPTOR = new MPEProductDescriptor(
"Satellite Precipitation Field", MPE_SATPRE, "Satellite Precipitation Field",
"mpe_satpre_dir", null, null);
public static final MPEProductDescriptor MPE_LSATPRE_DESCRIPTOR = new MPEProductDescriptor(
"Local Bias Satellite Precipitation Field",
MPE_LSATPRE,
"Local Bias Satellite Precipitation Field", "mpe_lsatpre_dir",
new String[] { MPE_RMOSAIC,
MPE_LMOSAIC }, null);
public static final MPEProductDescriptor MPE_SRMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Satellite Radar Mosaic", MPE_SRMOSAIC, "Satellite Radar Mosaic",
"mpe_srmosaic_dir", new String[] { MPE_LSATPRE,
MPE_LMOSAIC }, null);
public static final MPEProductDescriptor MPE_SGMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Satellite Gage Mosaic", MPE_SGMOSAIC, "Satellite Gage Mosaic",
"mpe_sgmosaic_dir", new String[] {MPE_LSATPRE }, null);
public static final MPEProductDescriptor MPE_SRGMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Satellite Radar Gage Mosaic", MPE_SRGMOSAIC, "Satellite Radar Gage Mosaic",
"mpe_srgmosaic_dir", new String[] { MPE_LSATPRE, MPE_LMOSAIC }, null);
public static final MPEProductDescriptor MPE_P3LMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Triangulated Radar Mosaic", MPE_P3LMOSAIC, "Triangulated Radar Mosaic",
"mpe_p3lmosaic_dir", new String[] { MPE_RMOSAIC }, null);
public static final MPEProductDescriptor MPE_BESTQPE_DESCRIPTOR = new MPEProductDescriptor(
"Best Estimate QPE", MPE_BESTQPE, "Best Estimate QPE", "mpe_qpe_dir", null, null);
public static final MPEProductDescriptor MPE_RFCBMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"RFC Mean Field Bias Mosaic", MPE_RFCBMOSAIC, "RFC Mean Field Bias Mosaic",
"mpe_rfcbmosaic_dir", new String[] { MPE_RMOSAIC }, null);
public static final MPEProductDescriptor MPE_RFCMMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"RFC Multi-sensor Mosaic", MPE_RFCMMOSAIC, "RFC Multi-sensor Mosaic",
"mpe_rfcmmosaic_dir", new String[] { MPE_RMOSAIC, MPE_RFCBMOSAIC }, null);
public static final MPEProductDescriptor MPE_RFCMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"RFC Best QPE Mosaic", MPE_RFCMOSAIC, "RFC Best QPE Mosaic",
"mpe_rfcmosaic_dir", null, null);
//new Q2 products
public static final MPEProductDescriptor MPE_QMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Q2 Mosaic", MPE_QMOSAIC, "Q2 Mosaic",
"mpe_qmosaic_dir", null, null);
public static final MPEProductDescriptor MPE_LQMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Q2 Local Bias Mosaic", MPE_LQMOSAIC, "Q2 Local Bias Mosaic",
"mpe_lqmosaic_dir", new String[] { MPE_QMOSAIC }, null);
public static final MPEProductDescriptor MPE_MLQMOSAIC_DESCRIPTOR = new MPEProductDescriptor(
"Q2 Multi-sensor Mosaic", MPE_MLQMOSAIC, "Q2 Multi-sensor Mosaic",
"mpe_mlqmosaic_dir", new String[] { MPE_QMOSAIC, MPE_LQMOSAIC }, null);
private static List<MPEProductDescriptor> _listOfAllPossibleMPEProductDescriptors = new ArrayList<MPEProductDescriptor>();;
private static Map<String, MPEProductDescriptor> _mapOfAllPossibleMPEProductDescriptors = new HashMap <String, MPEProductDescriptor>();
private static List<MPEProductDescriptor> _listOfAvailableMPEProductDescriptors = new ArrayList<MPEProductDescriptor>();
static
{
// _listOfAllPossibleMPEProductDescriptors = new ArrayList<MPEProductDescriptor>();
// This was commented out by Chip Gobs on 10/1/08
// The code was reduced in size by using the private constructor to do this work.
addDescriptorToListAndHashMap(MPE_RMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_AVGRMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_MAXRMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_BMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_LMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_GAGEONLY_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_MMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_MLMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_SATPRE_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_LSATPRE_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_SRMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_SGMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_SRGMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_P3LMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_BESTQPE_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_RFCBMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_RFCMMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_RFCMOSAIC_DESCRIPTOR);
// Q2 products
addDescriptorToListAndHashMap(MPE_QMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_LQMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_MLQMOSAIC_DESCRIPTOR);
//Dual Pol products
addDescriptorToListAndHashMap(MPE_RDMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_AVGRDMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_MAXRDMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_BDMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_LDMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_MDMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_MLDMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_SRDMOSAIC_DESCRIPTOR);
addDescriptorToListAndHashMap(MPE_SRDGMOSAIC_DESCRIPTOR);
/* Populate lists of available MPE Products, those are being
* created by MPEFieldGen.
*/
determineAvailableMPEProducts();
// The list of available MPE products is initially ordered by the how they are
// specified in the mpe_generate_list token. Reorder the products to match
// how they appear on the PrecipFields menu.
orderAvailableMPEProductsToMatchPrecipFieldsMenu();
}
private String _productName;
private String _productFilenamePrefix;
private String _productDescription;
private String _productPathToken;
private String[] _dependencies;
private XmrgGrid _mpeProductDataGrid;
private MPEProductDescriptor(String productName, String productFilenamePrefix, String productDescription,
String productPathToken, String[] dependencies, XmrgGrid mpeProductDataGrid)
{
setProductName(productName);
setProductFilenamePrefix(productFilenamePrefix);
setProductDescription(productDescription);
setProductPathToken(productPathToken);
setDependencies(dependencies);
setMpeProductDataGrid(mpeProductDataGrid);
// addDescriptorToListAndHashMap(this);
}
private static void addDescriptorToListAndHashMap(MPEProductDescriptor descriptor)
{
_listOfAllPossibleMPEProductDescriptors.add(descriptor);
_mapOfAllPossibleMPEProductDescriptors.put(descriptor.getProductFilenamePrefix(), descriptor);
}
public static List<MPEProductDescriptor> getListOfAllPossibleMPEProductDescriptors()
{
return _listOfAllPossibleMPEProductDescriptors;
}
public static List<MPEProductDescriptor> getListOfAllAvailableMPEProductDescriptors()
{
return _listOfAvailableMPEProductDescriptors;
}
private static Map<String, MPEProductDescriptor> getMapOfAllPossibleMPEProductDescriptors()
{
return _mapOfAllPossibleMPEProductDescriptors;
}
private static void determineAvailableMPEProducts ()
{
getAvailableMpeProductsFromMPEGenerateList();
addMPEQPEFieldTypeIfNeeded();
addRFCMosaicIfNeeded();
addBaseRadarMosaicIfNeeded();
}
private static void orderAvailableMPEProductsToMatchPrecipFieldsMenu ()
{
// Iterate over the list of all possible MPE Products. It is
// assumed that this list is in the same order as the items
// on the MPE Editor PrecipFields menu.
MPEProductDescriptor product;
List<MPEProductDescriptor> _tempListOfAvailableMPEProductDescriptors;
_tempListOfAvailableMPEProductDescriptors = new ArrayList <MPEProductDescriptor>();
Iterator <MPEProductDescriptor> MPEproduct = _listOfAllPossibleMPEProductDescriptors.iterator();
while ( MPEproduct.hasNext() )
{
product = MPEproduct.next();
if ( _listOfAvailableMPEProductDescriptors.contains(product))
{
_tempListOfAvailableMPEProductDescriptors.add(product);
}
}
_listOfAvailableMPEProductDescriptors = _tempListOfAvailableMPEProductDescriptors;
}
private static void getAvailableMpeProductsFromMPEGenerateList()
{
String header = "MPEProductDescriptor.getAvailableMpeProductsFromMPEGenerateList(): ";
final String MPE_GENERATE_LIST_TOKEN = "mpe_generate_list";
final String DEFAULT_GENERATE_LIST = MPE_BMOSAIC + "," + MPE_GAGEONLY + "," +
MPE_LMOSAIC + "," + MPE_LSATPRE + "," +
MPE_MLMOSAIC + "," + MPE_MMOSAIC + "," +
MPE_RMOSAIC + "," + MPE_SATPRE;
AppsDefaults appsDefaults = new AppsDefaults();
MPEProductDescriptor mpeProductDescriptor;
String generateList;
String token;
StringTokenizer generateListTokens;
generateList = appsDefaults.getToken(MPE_GENERATE_LIST_TOKEN,
DEFAULT_GENERATE_LIST);
generateListTokens = new StringTokenizer(generateList, ",");
while (generateListTokens.hasMoreElements())
{
token = generateListTokens.nextToken();
mpeProductDescriptor = getMapOfAllPossibleMPEProductDescriptors().get(token);
if (mpeProductDescriptor != null )
{
addMPEProductToGenerateListIfNeeded(mpeProductDescriptor);
System.out.println(header + "mpeProduct = " + mpeProductDescriptor.getProductFilenamePrefix());
}
else
{
System.out.println(header + "Unrecognized mpe_generate_list value "
+ token + ".");
}
}
// Force the addition of the XMRG field. The XMRG field is always
// generated.
mpeProductDescriptor = getMapOfAllPossibleMPEProductDescriptors().get(MPE_BESTQPE);
addMPEProductToGenerateListIfNeeded(mpeProductDescriptor);
}
private static void addMPEQPEFieldTypeIfNeeded()
{
final String MPE_QPE_FIELDTYPE_TOKEN = "mpe_qpe_fieldtype";
final String DEFAULT_QPE_FIELD_TYPE = MPE_MMOSAIC;
AppsDefaults appsDefaults = new AppsDefaults();
String bestQPE = appsDefaults.getToken(MPE_QPE_FIELDTYPE_TOKEN,
DEFAULT_QPE_FIELD_TYPE);
System.out.println ("The value of token " + MPE_QPE_FIELDTYPE_TOKEN + " is " + bestQPE );
MPEProductDescriptor mpeProduct = getMapOfAllPossibleMPEProductDescriptors().get(bestQPE);
if (mpeProduct == null)
{
System.out.println("Invalid mpe_qpe_fieldtype variable: " + bestQPE);
System.out.println("Using default mpe_qpe_fieldtype value: "
+ DEFAULT_QPE_FIELD_TYPE);
mpeProduct = getMapOfAllPossibleMPEProductDescriptors().get(DEFAULT_QPE_FIELD_TYPE);
}
addMPEProductToGenerateListIfNeeded(mpeProduct);
}
private static void addRFCMosaicIfNeeded()
{
final String GENERATE_AREAL_QPE_TOKEN = "mpe_generate_areal_qpe";
final String DEFAULT_GENERATE_AREAL_QPE = "OFF";
// The RFC Mosaic is handled in a special way.
AppsDefaults appsDefaults = new AppsDefaults();
MPEProductDescriptor mpeProduct;
String generateArealQPE = appsDefaults.getToken(
GENERATE_AREAL_QPE_TOKEN, DEFAULT_GENERATE_AREAL_QPE);
System.out.println ( "The value of token " + GENERATE_AREAL_QPE_TOKEN + " is " + generateArealQPE);
if (generateArealQPE.compareToIgnoreCase("ON") == 0)
{
mpeProduct = getMapOfAllPossibleMPEProductDescriptors().get(MPE_RFCMOSAIC);
if ( mpeProduct!= null)
{
if ( !getListOfAllAvailableMPEProductDescriptors().contains(mpeProduct))
{
getListOfAvailableMPEProductDescriptors().add(mpeProduct);
checkProductDependencies(mpeProduct);
}
}
}
}
private static void addBaseRadarMosaicIfNeeded()
{
final String MPE_BASE_RADAR_MOSAIC_TOKEN = "mpe_base_radar_mosaic";
final String DEFAULT_BASE_RADAR_MOSAIC = "RMOSAIC";
// The RFC Mosaic is handled in a special way.
AppsDefaults appsDefaults = new AppsDefaults();
MPEProductDescriptor mpeProduct;
String mpeBaseRadarMosaic = appsDefaults.getToken(MPE_BASE_RADAR_MOSAIC_TOKEN, DEFAULT_BASE_RADAR_MOSAIC);
System.out.println ( "The value of token " + MPE_BASE_RADAR_MOSAIC_TOKEN + " is " + mpeBaseRadarMosaic);
mpeProduct = getMapOfAllPossibleMPEProductDescriptors().get(mpeBaseRadarMosaic);
if ( mpeProduct!= null)
{
if ( !getListOfAllAvailableMPEProductDescriptors().contains(mpeProduct))
{
getListOfAvailableMPEProductDescriptors().add(mpeProduct);
checkProductDependencies(mpeProduct);
}
}
}
private static void checkProductDependencies(MPEProductDescriptor product)
{
String dependency;
MPEProductDescriptor dependentMPEProductDescriptor;
if (product.getDependencies() != null)
{
for (int i = 0; i < product.getDependencies().length; ++i)
{
dependency = product.getDependencies()[i];
dependentMPEProductDescriptor = getMapOfAllPossibleMPEProductDescriptors().get(
dependency);
if (dependentMPEProductDescriptor != null)
{
if (!getListOfAvailableMPEProductDescriptors().contains(
dependentMPEProductDescriptor))
{
getListOfAvailableMPEProductDescriptors().add(dependentMPEProductDescriptor);
checkProductDependencies(dependentMPEProductDescriptor);
}
}
else
{
System.out.println("For product "
+ product.getProductName()
+ " unrecognized dependency " + dependency);
}
}
}
}
static private void addMPEProductToGenerateListIfNeeded( MPEProductDescriptor productDescriptor)
{
if (productDescriptor != null)
{
if (!getListOfAvailableMPEProductDescriptors().contains(
productDescriptor))
{
getListOfAvailableMPEProductDescriptors().add(productDescriptor);
checkProductDependencies(productDescriptor);
}
}
}
public void setProductName(String productName)
{
_productName = productName;
}
public String getProductName()
{
return _productName;
}
public void setProductDescription(String productDescription)
{
_productDescription = productDescription;
}
public String getProductDescription()
{
return _productDescription;
}
public void setProductPathToken(String productPathToken)
{
_productPathToken = productPathToken;
}
public String getProductPathToken()
{
return _productPathToken;
}
public void setDependencies(String[] dependencies)
{
_dependencies = dependencies;
}
public String[] getDependencies()
{
return _dependencies;
}
public int compareTo(MPEProductDescriptor o)
{
String thisProductName = getProductName();
String thatProductName = o.getProductName();
// TODO Auto-generated method stub
return thisProductName.compareTo(thatProductName);
}
public void setMpeProductDataGrid(XmrgGrid mpeProductDataGrid)
{
this._mpeProductDataGrid = mpeProductDataGrid;
}
public XmrgGrid getMpeProductDataGrid()
{
return _mpeProductDataGrid;
}
public static void setListOfAvailableMPEProductDescriptors(
List<MPEProductDescriptor> listOfAvailableMPEProductDescriptors)
{
MPEProductDescriptor._listOfAvailableMPEProductDescriptors = listOfAvailableMPEProductDescriptors;
}
public static List<MPEProductDescriptor> getListOfAvailableMPEProductDescriptors()
{
return _listOfAvailableMPEProductDescriptors;
}
public void setProductFilenamePrefix(String productFilenamePrefix)
{
_productFilenamePrefix = productFilenamePrefix;
}
public String getProductFilenamePrefix()
{
return _productFilenamePrefix;
}
}

View file

@ -0,0 +1,113 @@
#! /bin/ksh
## create new directories for dual-pol products and logs in redmine ticket3454 in A2 14.3.1
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/daa_decoded ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/daa_decoded
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/daa_decoded
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/daa_archive ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/daa_archive
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/daa_archive
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/rdmosaic ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/rdmosaic
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/rdmosaic
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/bdmosaic ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/bdmosaic
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/bdmosaic
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/ldmosaic ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/ldmosaic
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/ldmosaic
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/mdmosaic ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/mdmosaic
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/mdmosaic
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/mldmosaic ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/mldmosaic
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/mldmosaic
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/avgrdmosaic ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/avgrdmosaic
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/avgrdmosaic
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/maxrdmosaic ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/maxrdmosaic
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/maxrdmosaic
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/locspandp ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/locspandp
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/locspandp
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/locbiasdp ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/locbiasdp
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/locbiasdp
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/state_var_dp ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/state_var_dp
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/state_var_dp
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/srdmosaic ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/srdmosaic
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/srdmosaic
fi
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/srdgmosaic ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/srdgmosaic
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/srdgmosaic
fi
# create directory defined by the token dsa_grid_dir
# this directory contains the decoded DSA products
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/dsa_decoded ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/dsa_decoded
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/dsa_decoded
fi
# create directory defined by the token dpr_grid_dir
# this directory contains the decoded DPR products.
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/dpr_decoded ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/dpr_decoded
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/dpr_decoded
fi
# create directory for Post Analysis
# this directory contains 1 hr QPE files generated by the Save/separate option
if [[ ! -d /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/post_analysis ]]
then
mkdir /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/post_analysis
chmod 777 /awips2/edex/data/share/hydroapps/precip_proc/local/data/mpe/post_analysis
fi

View file

@ -0,0 +1,218 @@
-- Script to create new tables in the IHFS db for dual-pol work
create table DAARadar
(
radid varchar(3) not null,
obstime TIMESTAMP not null,
minoff smallint,
maxvalh FLOAT4,
maxvald FLOAT4,
s1_bias_value FLOAT4,
producttime TIMESTAMP,
null_product_flag smallint,
coverage_dur integer,
grid_filename varchar(20)
)
;
ALTER TABLE DAARadar
ADD CONSTRAINT daaradar_pk
PRIMARY KEY (radid, obstime);
ALTER TABLE DAARadar
ADD CONSTRAINT daaradar_radloc_fk
FOREIGN KEY (radid)
REFERENCES RadarLoc (radid)
MATCH FULL;
revoke all on DAARadar from public;
grant select, insert, update, delete on DAARadar to public;
-- Add Table
create table DAABiasDyn
(
radid varchar(3) not null,
office_id varchar(5) not null,
obstime TIMESTAMP not null,
memspan_ind smallint not null,
numpairs FLOAT8,
sumgag FLOAT4,
sumrad FLOAT4,
bias FLOAT4
);
ALTER TABLE DAABiasDyn
ADD CONSTRAINT daabiasdynparams_pk
PRIMARY KEY (radid, office_id, obstime, memspan_ind);
revoke all on DAABiasDyn from public;
grant select, insert, update, delete on DAABiasDyn to public;
--
create table DAARadarResult
(
radid varchar(3) not null,
obstime TIMESTAMP not null,
num_gages smallint,
rad_avail varchar(1),
rw_bias_val_used FLOAT8,
mem_span_used FLOAT8,
edit_bias varchar(1),
ignore_radar varchar(1)
);
ALTER TABLE DAARadarResult
ADD CONSTRAINT daaradarresult_pk
PRIMARY KEY (radid, obstime);
revoke all on DAARadarResult from public;
grant select, insert, update, delete on DAARadarResult to public;
-- Add Table HPERadarResult
create table HPERadarResult
(
hpe_productname varchar(30) not null,
producttime TIMESTAMP not null,
num_radar_avail smallint,
bias_source varchar(20),
radar_data_source varchar(1)
)
;
ALTER TABLE HPERadarResult
ADD CONSTRAINT hperadarresult_pk
PRIMARY KEY (hpe_productname, producttime);
revoke all on HPERadarResult from public;
grant select, insert, update, delete on HPERadarResult to public;
-- Add DSARadar, DPRRadar tables, etc
create table DSARadar
(
radid varchar(3) not null,
obstime TIMESTAMP not null,
volcovpat smallint,
opermode smallint,
maxval FLOAT4,
scale FLOAT4,
setoff FLOAT4,
begin_time TIMESTAMP,
end_time TIMESTAMP,
j_beg_date smallint,
j_beg_time smallint,
j_end_date smallint,
j_end_time smallint,
mean_field_bias smallint,
nullproductflag smallint,
grid_filename varchar(20) -- file name of location of grid data
)
;
ALTER TABLE DSARadar
ADD CONSTRAINT DSAradar_pk
PRIMARY KEY (radid, obstime);
ALTER TABLE DSARadar
ADD CONSTRAINT DSAradar_radloc_fk
FOREIGN KEY (radid)
REFERENCES RadarLoc (radid)
MATCH FULL;
revoke all on DSARadar from public;
grant select, insert, update, delete on DSARadar to public;
-- Add Table DSAAdapt
create table DSAAdapt
(
radid varchar(3) not null,
obstime timestamp not null,
num_of_adap smallint,
default_ml_depth FLOAT4,
ml_overide_flag varchar(8),
kdp_mult FLOAT4,
kdp_power FLOAT4,
z_r_mult FLOAT4,
z_r_power FLOAT4,
zdr_z_mult FLOAT4,
zdr_z_power FLOAT4,
zdr_zdr_power FLOAT4,
min_corr_precip FLOAT4,
min_corr_kdp FLOAT4,
refl_max FLOAT4,
kdp_max_beam_blk FLOAT4,
max_usability_blk FLOAT4,
kdp_min_usage_rate FLOAT4,
ws_mult FLOAT4,
gr_mult FLOAT4,
rh_mult FLOAT4,
ds_mult FLOAT4,
ic_mult FLOAT4,
grid_is_full FLOAT4,
paif_rate FLOAT4,
paif_area FLOAT4,
rain_time_thresh FLOAT4,
num_zones FLOAT4,
max_precip_rate FLOAT4,
restart_time FLOAT4,
max_interp_time FLOAT4,
max_hourly_acc FLOAT4,
time_bias FLOAT4,
num_grpairs FLOAT4,
reset_bias FLOAT4,
longst_lag FLOAT4
)
;
ALTER TABLE DSAAdapt
ADD CONSTRAINT dsaadapt_pk
PRIMARY KEY (radid, obstime);
ALTER TABLE DSAAdapt
ADD CONSTRAINT dsaadapt_rad_fk
FOREIGN KEY (radid)
REFERENCES RadarLoc (radid)
MATCH FULL;
revoke all on DSAAdapt from public;
grant select, insert, update, delete on DSAAdapt to public;
-- Add Table DPRRadar
create table DPRRadar
(
radid varchar(3) not null,
obstime TIMESTAMP not null,
volcovpat smallint,
opermode smallint,
maxval FLOAT4,
scale FLOAT4,
setoff FLOAT4,
j_end_date integer,
j_end_time integer,
mean_field_bias smallint,
precipdetectedflag smallint,
grid_filename varchar(20) -- file name of location of grid data
)
;
ALTER TABLE DPRRadar
ADD CONSTRAINT DPRradar_pk
PRIMARY KEY (radid, obstime);
ALTER TABLE DPRRadar
ADD CONSTRAINT DPRradar_radloc_fk
FOREIGN KEY (radid)
REFERENCES RadarLoc (radid)
MATCH FULL;
revoke all on DPRRadar from public;
grant select, insert, update, delete on DPRRadar to public;

View file

@ -0,0 +1,10 @@
-- Insert records into PurgedynData table
INSERT INTO PurgeDynData VALUES('DAARadar', 'obstime', 240, 240);
INSERT INTO PurgeDynData VALUES('DAABiasDyn', 'obstime', 240, 240);
INSERT INTO PurgeDynData VALUES('DAARadarResult', 'obstime', 240, 240);
INSERT INTO PurgeDynData VALUES('DSARadar', 'obstime', 24, 24);
INSERT INTO PurgeDynData VALUES('DSAAdapt', 'obstime', 24, 24);
INSERT INTO PurgeDynData VALUES('DPRRadar', 'obstime', 24, 24);
INSERT INTO PurgeDynData VALUES('hperadarresult', 'producttime', 24, 24);

View file

@ -11,6 +11,7 @@ dir.04=ncep
dir.05=RadarServer
dir.06=edu
dir.07=ost
dir.08=ohd
# the directory that contains the localization projects
# in a distributed development environment.

View file

@ -106,6 +106,7 @@
<exclude>fog-ingest.xml</exclude>
<exclude>vil-ingest.xml</exclude>
<exclude>preciprate-ingest.xml</exclude>
<exclude>hydrodualpol-ingest.xml</exclude>
<exclude>qpf-ingest.xml</exclude>
<exclude>fssobs-ingest.xml</exclude>
<exclude>cpgsrv-spring.xml</exclude>
@ -239,6 +240,7 @@
<include>fssobs-ingest.xml</include>
<include>fssobs-common.xml</include>
<include>ldadmesonet-common.xml</include>
<include>hydrodualpol-ingest.xml</include>
<include>manualIngest-common.xml</include>
<include>dataaccess-common.xml</include>
<exclude>nctext-common.xml</exclude>

View file

@ -0,0 +1,98 @@
<?xml version="1.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.
-->
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping default-lazy="true">
<!--
Created by the Middlegen Hibernate plugin 2.1
http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->
<class
name="com.raytheon.edex.db.objects.ihfs.DAARadarResult"
table="daaradarresult"
>
<composite-id>
<key-property
name="radid"
column="radid"
type="java.lang.String"
length="3"
/>
<key-property
name="obstime"
column="obstime"
type="java.sql.Timestamp"
length="29"
/>
</composite-id>
<property
name="numGages"
type="java.lang.Short"
column="num_gages"
length="5"
/>
<property
name="radAvail"
type="java.lang.String"
column="rad_avail"
length="1"
/>
<property
name="rwBiasValUsed"
type="java.lang.Double"
column="rw_bias_val_used"
length="17"
/>
<property
name="memSpanUsed"
type="java.lang.Double"
column="mem_span_used"
length="17"
/>
<property
name="editBias"
type="java.lang.String"
column="edit_bias"
length="1"
/>
<property
name="ignoreRadar"
type="java.lang.String"
column="ignore_radar"
length="1"
/>
<!-- Associations -->
</class>
</hibernate-mapping>
<!--
-->

View file

@ -0,0 +1,79 @@
<?xml version="1.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.
-->
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping default-lazy="true">
<!--
Created by the Middlegen Hibernate plugin 2.1
http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->
<class
name="com.raytheon.edex.db.objects.ihfs.Hperadarresult"
table="hperadarresult"
>
<composite-id>
<key-property
name="hpeProductname"
column="hpe_productname"
type="java.lang.String"
length="30"
/>
<key-property
name="producttime"
column="producttime"
type="java.sql.Timestamp"
length="29"
/>
</composite-id>
<property
name="numRadarAvail"
type="java.lang.Short"
column="num_radar_avail"
length="5"
/>
<property
name="biasSource"
type="java.lang.String"
column="bias_source"
length="20"
/>
<property
name="radarDataSource"
type="java.lang.String"
column="radar_data_source"
length="1"
/>
<!-- Associations -->
</class>
</hibernate-mapping>
<!--
-->

View file

@ -44,6 +44,12 @@ com.raytheon.uf.common.dataplugin.shef.tables.Curpc
com.raytheon.uf.common.dataplugin.shef.tables.CurpcId
com.raytheon.uf.common.dataplugin.shef.tables.Curpp
com.raytheon.uf.common.dataplugin.shef.tables.CurppId
com.raytheon.uf.common.dataplugin.shef.tables.DAABiasDyn
com.raytheon.uf.common.dataplugin.shef.tables.DAABiasDynId
com.raytheon.uf.common.dataplugin.shef.tables.DAARadar
com.raytheon.uf.common.dataplugin.shef.tables.DAARadarId
com.raytheon.uf.common.dataplugin.shef.tables.DAARadarResult
com.raytheon.uf.common.dataplugin.shef.tables.DAARadarResultId
com.raytheon.uf.common.dataplugin.shef.tables.Dailypp
com.raytheon.uf.common.dataplugin.shef.tables.DailyppId
com.raytheon.uf.common.dataplugin.shef.tables.Damtypes
@ -65,6 +71,12 @@ com.raytheon.uf.common.dataplugin.shef.tables.Dpaadapt
com.raytheon.uf.common.dataplugin.shef.tables.DpaadaptId
com.raytheon.uf.common.dataplugin.shef.tables.Dparadar
com.raytheon.uf.common.dataplugin.shef.tables.DparadarId
com.raytheon.uf.common.dataplugin.shef.tables.DPRRadar
com.raytheon.uf.common.dataplugin.shef.tables.DPRRadarId
com.raytheon.uf.common.dataplugin.shef.tables.DSAAdapt
com.raytheon.uf.common.dataplugin.shef.tables.DSAAdaptId
com.raytheon.uf.common.dataplugin.shef.tables.DSARadar
com.raytheon.uf.common.dataplugin.shef.tables.DSARadarId
com.raytheon.uf.common.dataplugin.shef.tables.Dspadapt
com.raytheon.uf.common.dataplugin.shef.tables.DspadaptId
com.raytheon.uf.common.dataplugin.shef.tables.Dspradar
@ -335,4 +347,4 @@ com.raytheon.uf.common.dataplugin.shef.tables.Zoneinfo
com.raytheon.uf.common.dataplugin.shef.tables.ZoneinfoId
com.raytheon.uf.common.dataplugin.shef.tables.Zonenum
com.raytheon.uf.common.dataplugin.shef.tables.ZonenumId
com.raytheon.edex.transform.shef.MetarToShefFilter
com.raytheon.edex.transform.shef.MetarToShefFilter

View file

@ -8,6 +8,7 @@ Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
javax.measure,
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174"
Export-Package: com.raytheon.uf.common.dataplugin.shef.tables,
com.raytheon.uf.common.dataplugin.shef.util

View file

@ -0,0 +1,135 @@
package com.raytheon.uf.common.dataplugin.shef.tables;
import java.io.Serializable;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
*
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/22/2014 Redmine #3454 (A2 14.3.1) new dualpol-related table DAABiasDyn
*
* </pre>
*
* @author OHD
* @version 1.1
*/
@Entity
@Table(name = "daabiasdyn")
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DAABiasDyn extends PersistableDataObject implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
@XmlElement
@DynamicSerializeElement
private DAABiasDynId id;
@XmlElement
@DynamicSerializeElement
private Double numpairs;
@XmlElement
@DynamicSerializeElement
private Float sumgag;
@XmlElement
@DynamicSerializeElement
private Float sumrad;
@XmlElement
@DynamicSerializeElement
private Float bias;
public DAABiasDyn() {
}
public DAABiasDyn(DAABiasDynId id) {
this.id = id;
}
public DAABiasDyn(DAABiasDynId id, Double numpairs, Float sumgag,
Float sumrad, Float bias) {
this.id = id;
this.numpairs = numpairs;
this.sumgag = sumgag;
this.sumrad = sumrad;
this.bias = bias;
}
@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name = "radid", column = @Column(name = "radid", nullable = false, length = 3)),
@AttributeOverride(name = "officeId", column = @Column(name = "office_id", nullable = false, length = 5)),
@AttributeOverride(name = "obstime", column = @Column(name = "obstime", nullable = false, length = 29)),
@AttributeOverride(name = "memspanInd", column = @Column(name = "memspan_ind", nullable = false)) })
public DAABiasDynId getId() {
return this.id;
}
public void setId(DAABiasDynId id) {
this.id = id;
}
@Column(name = "numpairs", precision = 17, scale = 17)
public Double getNumpairs() {
return this.numpairs;
}
public void setNumpairs(Double numpairs) {
this.numpairs = numpairs;
}
@Column(name = "sumgag", precision = 8, scale = 8)
public Float getSumgag() {
return this.sumgag;
}
public void setSumgag(Float sumgag) {
this.sumgag = sumgag;
}
@Column(name = "sumrad", precision = 8, scale = 8)
public Float getSumrad() {
return this.sumrad;
}
public void setSumrad(Float sumrad) {
this.sumrad = sumrad;
}
@Column(name = "bias", precision = 8, scale = 8)
public Float getBias() {
return this.bias;
}
public void setBias(Float bias) {
this.bias = bias;
}
}

View file

@ -0,0 +1,143 @@
package com.raytheon.uf.common.dataplugin.shef.tables;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
*
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/22/2014 Redmine #3454 (A2 14.3.1) new dualpol-related table ID
*
* </pre>
*
* @author OHD
* @version 1.1
*/
@Embeddable
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DAABiasDynId extends PersistableDataObject implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
@XmlElement
@DynamicSerializeElement
private String radid;
@XmlElement
@DynamicSerializeElement
private String officeId;
@XmlElement
@DynamicSerializeElement
private Date obstime;
@XmlElement
@DynamicSerializeElement
private short memspanInd;
public DAABiasDynId() {
}
public DAABiasDynId(String radid, String officeId, Date obstime,
short memspanInd) {
this.radid = radid;
this.officeId = officeId;
this.obstime = obstime;
this.memspanInd = memspanInd;
}
@Column(name = "radid", nullable = false, length = 3)
public String getRadid() {
return this.radid;
}
public void setRadid(String radid) {
this.radid = radid;
}
@Column(name = "office_id", nullable = false, length = 5)
public String getOfficeId() {
return this.officeId;
}
public void setOfficeId(String officeId) {
this.officeId = officeId;
}
@Column(name = "obstime", nullable = false, length = 29)
public Date getObstime() {
return this.obstime;
}
public void setObstime(Date obstime) {
this.obstime = obstime;
}
@Column(name = "memspan_ind", nullable = false)
public short getMemspanInd() {
return this.memspanInd;
}
public void setMemspanInd(short memspanInd) {
this.memspanInd = memspanInd;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof DAABiasDynId))
return false;
RwbiasdynId castOther = (RwbiasdynId) other;
return ((this.getRadid() == castOther.getRadid()) || (this.getRadid() != null
&& castOther.getRadid() != null && this.getRadid().equals(
castOther.getRadid())))
&& ((this.getOfficeId() == castOther.getOfficeId()) || (this
.getOfficeId() != null
&& castOther.getOfficeId() != null && this
.getOfficeId().equals(castOther.getOfficeId())))
&& ((this.getObstime() == castOther.getObstime()) || (this
.getObstime() != null
&& castOther.getObstime() != null && this.getObstime()
.equals(castOther.getObstime())))
&& (this.getMemspanInd() == castOther.getMemspanInd());
}
public int hashCode() {
int result = 17;
result = 37 * result
+ (getRadid() == null ? 0 : this.getRadid().hashCode());
result = 37 * result
+ (getOfficeId() == null ? 0 : this.getOfficeId().hashCode());
result = 37 * result
+ (getObstime() == null ? 0 : this.getObstime().hashCode());
result = 37 * result + this.getMemspanInd();
return result;
}
}

View file

@ -0,0 +1,229 @@
package com.raytheon.uf.common.dataplugin.shef.tables;
import javax.persistence.AttributeOverride;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
*
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/22/2014 Redmine #3454 (A2 14.3.1) new dualpol-related table DAARadar
*
* </pre>
*
* @author OHD
* @version 1.1
*/
@Entity
@Table(name = "daaradar")
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DAARadar extends PersistableDataObject implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
@XmlElement
@DynamicSerializeElement
private DAARadarId id;
@XmlElement
@DynamicSerializeElement
private Short minOff;
@XmlElement
@DynamicSerializeElement
private Float maxValh;
@XmlElement
@DynamicSerializeElement
private Float maxVald;
@XmlElement
@DynamicSerializeElement
private Float s1BiasValue;
@XmlElement
@DynamicSerializeElement
private Date productTime;
@XmlElement
@DynamicSerializeElement
private Short nullProductFlag;
@XmlElement
@DynamicSerializeElement
private Integer coverageDur;
@XmlElement
@DynamicSerializeElement
private String gridFilename;
public DAARadar() {
}
public DAARadar(DAARadarId id) {
this.id = id;
}
public DAARadar(DAARadarId id,
Short minOff, Float maxValh,
Float maxVald, Float s1BiasValue,
Date productTime, Short nullProductFlag,
Integer coverageDur, String gridFilename)
{
this.id = id;
this.minOff = minOff;
this.maxValh = maxValh;
this.maxVald = maxVald;
this.s1BiasValue = s1BiasValue;
this.productTime = productTime;
this.nullProductFlag = nullProductFlag;
this.coverageDur = coverageDur;
this.gridFilename = gridFilename;
}
/*
public DAARadar(String id, String obsTime,
Short minOff, Float maxValh,
Float maxVald, Float s1BiasValue,
String productTime, Short nullProductFlag,
Integer coverageDur, String gridFilename)
{
//this.id = id;
// this.obsTime = obsTime;
this.minOff = minOff;
this.maxValh = maxValh;
this.maxVald = maxVald;
this.s1BiasValue = s1BiasValue;
this.productTime = productTime;
this.nullProductFlag = nullProductFlag;
this.coverageDur = coverageDur;
this.gridFilename = gridFilename;
}
*/
@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name = "radid", column = @Column(name = "radid", nullable = false, length = 3)),
@AttributeOverride(name = "obstime", column = @Column(name = "obstime", nullable = false, length = 29)) })
public DAARadarId getId() {
return this.id;
}
public void setId(DAARadarId id) {
this.id = id;
}
@Column(name = "minoff")
public Short getminOff() {
return this.minOff;
}
public void setminOff(Short minOff) {
this.minOff = minOff;
}
@Column(name = "maxvalh")
public Float getmaxValh() {
return this.maxValh;
}
public void setmaxValh(Float maxValh) {
this.maxValh = maxValh;
}
@Column(name = "maxvald")
public Float getmaxVald() {
return this.maxVald;
}
public void setmaxVald(Float maxVald) {
this.maxVald = maxVald;
}
@Column(name = "s1_bias_value")
public Float gets1BiasValue() {
return this.s1BiasValue;
}
public void sets1BiasValue(Float s1BiasValue) {
this.s1BiasValue = s1BiasValue;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "producttime")
public Date getproductTime() {
return this.productTime;
}
public void setproductTime(Date productTime) {
this.productTime = productTime;
}
@Column(name = "null_product_flag")
public Short getnullProductFlag() {
return this.nullProductFlag;
}
public void setnullProductFlag(Short nullProductFlag) {
this.nullProductFlag = nullProductFlag;
}
@Column(name = "coverage_dur")
public Integer getcoverageDur() {
return this.coverageDur;
}
public void setcoverageDur(Integer coverageDur) {
this.coverageDur = coverageDur;
}
@Column(name = "grid_filename")
public String getgridFilename() {
return this.gridFilename;
}
public void setgridFilename(String gridFilename) {
this.gridFilename = gridFilename;
}
public String toString()
{
StringBuffer buffer = new StringBuffer();
buffer.append(id.getRadid() + " " + id.getObstime() + " " + getminOff() + " " +
getmaxValh() + " " + getmaxVald() + " " + gets1BiasValue() +
" " + getproductTime() + " " + getnullProductFlag() +
" " + getcoverageDur() + " " + getgridFilename() ) ;
return buffer.toString();
}
}

View file

@ -0,0 +1,125 @@
/**
* 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.uf.common.dataplugin.shef.tables;
// default package
// Generated Oct 17, 2008 2:22:17 PM by Hibernate Tools 3.2.2.GA
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
*
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/22/2014 Redmine #3454 (A2 14.3.1) new dualpol-related table ID
*
*
* </pre>
*
* @author OHD
* @version 1.1
*/
@Embeddable
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DAARadarId extends PersistableDataObject implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
@XmlElement
@DynamicSerializeElement
private String radid;
@XmlElement
@DynamicSerializeElement
private Date obstime;
public DAARadarId() {
}
public DAARadarId(String radid, Date obstime) {
this.radid = radid;
this.obstime = obstime;
}
@Column(name = "radid", nullable = false, length = 3)
public String getRadid() {
return this.radid;
}
public void setRadid(String radid) {
this.radid = radid;
}
@Column(name = "obstime", nullable = false, length = 29)
public Date getObstime() {
return this.obstime;
}
public void setObstime(Date obstime) {
this.obstime = obstime;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof DAARadarId))
return false;
DAARadarId castOther = (DAARadarId) other;
return ((this.getRadid() == castOther.getRadid()) || (this.getRadid() != null
&& castOther.getRadid() != null && this.getRadid().equals(
castOther.getRadid())))
&& ((this.getObstime() == castOther.getObstime()) || (this
.getObstime() != null
&& castOther.getObstime() != null && this.getObstime()
.equals(castOther.getObstime())));
}
public int hashCode() {
int result = 17;
result = 37 * result
+ (getRadid() == null ? 0 : this.getRadid().hashCode());
result = 37 * result
+ (getObstime() == null ? 0 : this.getObstime().hashCode());
return result;
}
}

View file

@ -0,0 +1,160 @@
package com.raytheon.uf.common.dataplugin.shef.tables;
import java.io.Serializable;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
*
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/22/2014 Redmine #3454 (A2 14.3.1) new dualpol-related table DAARadarResult
*
* </pre>
*
* @author OHD
* @version 1.1
*/
@Entity
@Table(name = "daaradarresult")
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DAARadarResult extends PersistableDataObject implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
@XmlElement
@DynamicSerializeElement
private DAARadarResultId id;
@XmlElement
@DynamicSerializeElement
private Short numGages;
@XmlElement
@DynamicSerializeElement
private String radAvail;
@XmlElement
@DynamicSerializeElement
private Double rwBiasValUsed;
@XmlElement
@DynamicSerializeElement
private Double memSpanUsed;
@XmlElement
@DynamicSerializeElement
private String editBias;
@XmlElement
@DynamicSerializeElement
private String ignoreRadar;
public DAARadarResult() {
}
public DAARadarResult(DAARadarResultId id) {
this.id = id;
}
public DAARadarResult(DAARadarResultId id, Short numGages, String radAvail,
Double rwBiasValUsed, Double memSpanUsed, String editBias,
String ignoreRadar) {
this.id = id;
this.numGages = numGages;
this.radAvail = radAvail;
this.rwBiasValUsed = rwBiasValUsed;
this.memSpanUsed = memSpanUsed;
this.editBias = editBias;
this.ignoreRadar = ignoreRadar;
}
@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name = "radid", column = @Column(name = "radid", nullable = false, length = 3)),
@AttributeOverride(name = "obstime", column = @Column(name = "obstime", nullable = false, length = 29)) })
public DAARadarResultId getId() {
return this.id;
}
public void setId(DAARadarResultId id) {
this.id = id;
}
@Column(name = "num_gages")
public Short getNumGages() {
return this.numGages;
}
public void setNumGages(Short numGages) {
this.numGages = numGages;
}
@Column(name = "rad_avail", length = 1)
public String getRadAvail() {
return this.radAvail;
}
public void setRadAvail(String radAvail) {
this.radAvail = radAvail;
}
@Column(name = "rw_bias_val_used", precision = 17, scale = 17)
public Double getRwBiasValUsed() {
return this.rwBiasValUsed;
}
public void setRwBiasValUsed(Double rwBiasValUsed) {
this.rwBiasValUsed = rwBiasValUsed;
}
@Column(name = "mem_span_used", precision = 17, scale = 17)
public Double getMemSpanUsed() {
return this.memSpanUsed;
}
public void setMemSpanUsed(Double memSpanUsed) {
this.memSpanUsed = memSpanUsed;
}
@Column(name = "edit_bias", length = 1)
public String getEditBias() {
return this.editBias;
}
public void setEditBias(String editBias) {
this.editBias = editBias;
}
@Column(name = "ignore_radar", length = 1)
public String getIgnoreRadar() {
return this.ignoreRadar;
}
public void setIgnoreRadar(String ignoreRadar) {
this.ignoreRadar = ignoreRadar;
}
}

View file

@ -0,0 +1,106 @@
package com.raytheon.uf.common.dataplugin.shef.tables;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
*
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/22/2014 Redmine #3454 (A2 14.3.1) new dualpol-related table ID
*
* </pre>
*
* @author OHD
* @version 1.1
*/
@Embeddable
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DAARadarResultId extends PersistableDataObject implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
@XmlElement
@DynamicSerializeElement
private String radid;
@XmlElement
@DynamicSerializeElement
private Date obstime;
public DAARadarResultId() {
}
public DAARadarResultId(String radid, Date obstime) {
this.radid = radid;
this.obstime = obstime;
}
@Column(name = "radid", nullable = false, length = 3)
public String getRadid() {
return this.radid;
}
public void setRadid(String radid) {
this.radid = radid;
}
@Column(name = "obstime", nullable = false, length = 29)
public Date getObstime() {
return this.obstime;
}
public void setObstime(Date obstime) {
this.obstime = obstime;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof DAARadarResultId))
return false;
DAARadarResultId castOther = (DAARadarResultId) other;
return ((this.getRadid() == castOther.getRadid()) || (this.getRadid() != null
&& castOther.getRadid() != null && this.getRadid().equals(
castOther.getRadid())))
&& ((this.getObstime() == castOther.getObstime()) || (this
.getObstime() != null
&& castOther.getObstime() != null && this.getObstime()
.equals(castOther.getObstime())));
}
public int hashCode() {
int result = 17;
result = 37 * result
+ (getRadid() == null ? 0 : this.getRadid().hashCode());
result = 37 * result
+ (getObstime() == null ? 0 : this.getObstime().hashCode());
return result;
}
}

View file

@ -0,0 +1,224 @@
package com.raytheon.uf.common.dataplugin.shef.tables;
import java.io.Serializable;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
*
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/22/2014 Redmine #3454 (A2 14.3.1) new dualpol-related table DPRRadar
*
* </pre>
*
* @author OHD
* @version 1.1
*/
@Entity
@Table(name = "dprradar")
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DPRRadar extends PersistableDataObject implements Serializable, ISerializableObject
{
private static final long serialVersionUID = 1L;
@XmlElement
@DynamicSerializeElement
private DPRRadarId id;
@XmlElement
@DynamicSerializeElement
private Short volcovpat;
@XmlElement
@DynamicSerializeElement
private Short opermode;
@XmlElement
@DynamicSerializeElement
private Float maxval;
@XmlElement
@DynamicSerializeElement
private Float scale;
@XmlElement
@DynamicSerializeElement
private Float setoff;
@XmlElement
@DynamicSerializeElement
private Integer jEndDate;
@XmlElement
@DynamicSerializeElement
private Integer jEndTime;
@XmlElement
@DynamicSerializeElement
private Short meanFieldBias;
@XmlElement
@DynamicSerializeElement
private Short precipDetectedFlag;
@XmlElement
@DynamicSerializeElement
private String gridFilename;
public DPRRadar() {
}
public DPRRadar(DPRRadarId id)
{
this.id = id;
}
public DPRRadar(DPRRadarId id,
Short volcovpat, Short opermode,
Float maxval, Float scale, Float setoff,
Integer jEndDate, Integer jEndTime,
Short meanFieldBias, Short precipDetectedFlag,
String gridFilename)
{
this.id = id;
this.volcovpat = volcovpat;
this.opermode = opermode;
this.maxval = maxval;
this.scale = scale;
this.setoff = setoff;
this.jEndDate = jEndDate;
this.jEndTime = jEndTime;
this.meanFieldBias = meanFieldBias;
this.precipDetectedFlag = precipDetectedFlag;
this.gridFilename = gridFilename;
}
@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name = "radid", column = @Column(name = "radid", nullable = false, length = 3)),
@AttributeOverride(name = "obstime", column = @Column(name = "obstime", nullable = false, length = 29)) })
public DPRRadarId getId() {
return this.id;
}
public void setId(DPRRadarId id) {
this.id = id;
}
@Column(name = "volcovpat")
public Short getVolcovpat() {
return this.volcovpat;
}
public void setVolcovpat(Short volcovpat) {
this.volcovpat = volcovpat;
}
@Column(name = "opermode")
public Short getOpermode() {
return this.opermode;
}
public void setOpermode(Short opermode) {
this.opermode = opermode;
}
@Column(name = "maxval", precision = 8, scale = 8)
public Float getMaxval() {
return this.maxval;
}
public void setMaxval(Float maxval) {
this.maxval = maxval;
}
@Column(name = "scale", precision = 8, scale = 8)
public Float getScale() {
return this.scale;
}
public void setScale(Float scale) {
this.scale = scale;
}
@Column(name = "setoff", precision = 8, scale = 8)
public Float getSetOff() {
return this.setoff;
}
public void setSetOff(Float setoff) {
this.setoff = setoff;
}
@Column(name = "j_end_date")
public Integer getJEndDate() {
return this.jEndDate;
}
public void setJEndDate(Integer jEndDate) {
this.jEndDate = jEndDate;
}
@Column(name = "j_end_time")
public Integer getJEndTime() {
return this.jEndTime;
}
public void setJEndTime(Integer jEndTime) {
this.jEndTime = jEndTime;
}
@Column(name = "mean_field_bias")
public Short getMeanFieldBias() {
return this.meanFieldBias;
}
public void setMeanFieldBias(Short meanFieldBias) {
this.meanFieldBias = meanFieldBias;
}
@Column(name = "precipdetectedflag")
public Short getPrecipDetectedFlag() {
return this.precipDetectedFlag;
}
public void setPrecipDetectedFlag(Short precipDetectedFlag) {
this.precipDetectedFlag = precipDetectedFlag;
}
@Column(name = "grid_filename", length = 20)
public String getGridFilename() {
return this.gridFilename;
}
public void setGridFilename(String gridFilename) {
this.gridFilename = gridFilename;
}
}

View file

@ -0,0 +1,105 @@
package com.raytheon.uf.common.dataplugin.shef.tables;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
*
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/22/2014 Redmine #3454 (A2 14.3.1) new dualpol-related table ID
*
* </pre>
*
* @author OHD
* @version 1.1
*/
@Embeddable
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DPRRadarId extends PersistableDataObject implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
@XmlElement
@DynamicSerializeElement
private String radid;
@XmlElement
@DynamicSerializeElement
private Date obstime;
public DPRRadarId() {
}
public DPRRadarId(String radid, Date obstime) {
this.radid = radid;
this.obstime = obstime;
}
@Column(name = "radid", nullable = false, length = 3)
public String getRadid() {
return this.radid;
}
public void setRadid(String radid) {
this.radid = radid;
}
@Column(name = "obstime", nullable = false, length = 29)
public Date getObstime() {
return this.obstime;
}
public void setObstime(Date obstime) {
this.obstime = obstime;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof DPRRadarId))
return false;
DPRRadarId castOther = (DPRRadarId) other;
return ((this.getRadid() == castOther.getRadid()) || (this.getRadid() != null
&& castOther.getRadid() != null && this.getRadid().equals(
castOther.getRadid())))
&& ((this.getObstime() == castOther.getObstime()) || (this
.getObstime() != null
&& castOther.getObstime() != null && this.getObstime()
.equals(castOther.getObstime())));
}
public int hashCode() {
int result = 17;
result = 37 * result
+ (getRadid() == null ? 0 : this.getRadid().hashCode());
result = 37 * result
+ (getObstime() == null ? 0 : this.getObstime().hashCode());
return result;
}
}

View file

@ -0,0 +1,544 @@
package com.raytheon.uf.common.dataplugin.shef.tables;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "dsaadapt")
@javax.xml.bind.annotation.XmlRootElement
@javax.xml.bind.annotation.XmlAccessorType(javax.xml.bind.annotation.XmlAccessType.NONE)
@com.raytheon.uf.common.serialization.annotations.DynamicSerialize
public class DSAAdapt extends com.raytheon.uf.common.dataplugin.persist.PersistableDataObject implements java.io.Serializable, com.raytheon.uf.common.serialization.ISerializableObject
{
private static final long serialVersionUID = 1L;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private DSAAdaptId id;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Short num_of_adap;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float default_ml_depth;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private String ml_overide_flag;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float kdp_mult;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float kdp_power;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float z_r_mult;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float z_r_power;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float zdr_z_mult;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float zdr_z_power;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float zdr_zdr_power;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float min_corr_precip;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float min_corr_kdp;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float refl_max;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float kdp_max_beam_blk;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float max_usability_blk;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float kdp_min_usage_rate;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float ws_mult;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float gr_mult;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float rh_mult;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float ds_mult;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float ic_mult;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float grid_is_full;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float paif_rate;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float paif_area;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float rain_time_thresh;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float num_zones;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float max_precip_rate;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float restart_time;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float max_interp_time;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float max_hourly_acc;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float time_bias;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float num_grpairs;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float reset_bias;
@javax.xml.bind.annotation.XmlElement
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
private Float longst_lag;
public DSAAdapt() {
}
public DSAAdapt(DSAAdaptId id)
{
this.id = id;
}
public DSAAdapt(DSAAdaptId id,
short num_of_adap, float default_ml_depth, String ml_overide_flag,
float kdp_mult, float kdp_power, float z_r_mult, float z_r_power,
float zdr_z_mult, float zdr_z_power, float zdr_zdr_power,
float min_corr_precip, float min_corr_kdp,
float refl_max, float kdp_max_beam_blk,
float max_usability_blk, float kdp_min_usage_rate,
float ws_mult, float gr_mult,
float rh_mult, float ds_mult, float ic_mult,
float grid_is_full, float paif_rate, float paif_area,
float rain_time_thresh,
float num_zones, float max_precip_rate, float restart_time,
float max_interp_time, float max_hourly_acc, float time_bias,
float num_grpairs, float reset_bias, float longst_lag
)
{
this.id = id;
this.num_of_adap = num_of_adap;
this.default_ml_depth = default_ml_depth;
this.ml_overide_flag = ml_overide_flag;
this.kdp_mult = kdp_mult;
this.kdp_power = kdp_power;
this.z_r_mult = z_r_mult;
this.z_r_power = z_r_power;
this.zdr_z_mult = zdr_z_mult;
this.zdr_z_power = zdr_z_power;
this.zdr_zdr_power = zdr_zdr_power;
this.min_corr_precip = min_corr_precip;
this.min_corr_kdp = min_corr_kdp;
this.refl_max = refl_max;
this.kdp_max_beam_blk = kdp_max_beam_blk;
this.max_usability_blk = max_usability_blk;
this.kdp_min_usage_rate = kdp_min_usage_rate;
this.ws_mult = ws_mult;
this.gr_mult = gr_mult;
this.rh_mult = rh_mult;
this.ds_mult = ds_mult;
this.ic_mult = ic_mult;
this.grid_is_full = grid_is_full;
this.paif_rate = paif_rate;
this.paif_area = paif_area;
this.rain_time_thresh =rain_time_thresh;
this.num_zones = num_zones;
this.max_precip_rate = max_precip_rate;
this.restart_time = restart_time;
this.max_interp_time = max_interp_time;
this.max_hourly_acc = max_hourly_acc;
this.time_bias = time_bias;
this.num_grpairs = num_grpairs;
this.reset_bias = reset_bias;
this.longst_lag = longst_lag;
}
@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name = "radid", column = @Column(name = "radid", nullable = false, length = 3)),
@AttributeOverride(name = "obstime", column = @Column(name = "obstime", nullable = false, length = 29)) })
public DSAAdaptId getId() {
return this.id;
}
public void setId(DSAAdaptId id) {
this.id = id;
}
@Column(name = "num_of_adap")
public Short getNumOfAdap() {
return this.num_of_adap;
}
public void setNumOfAdap(Short num_of_adap) {
this.num_of_adap = num_of_adap;
}
@Column(name = "default_ml_depth")
public Float getDefaultMlDepth() {
return this.default_ml_depth;
}
public void setDefaultMlDepth(Float default_ml_depth) {
this.default_ml_depth = default_ml_depth;
}
@Column(name = "ml_overide_flag")
public String getMlOverideFlag() {
return this.ml_overide_flag;
}
public void setMlOverideFlag(String ml_overide_flag) {
this.ml_overide_flag = ml_overide_flag;
}
@Column(name = "kdp_mult")
public Float getKdpMult() {
return this.kdp_mult;
}
public void setKdpMult(Float kdp_mult) {
this.kdp_mult = kdp_mult;
}
@Column(name = "kdp_power")
public Float getKdpPower() {
return this.kdp_power;
}
public void setKdpPower(Float kdp_power) {
this.kdp_power = kdp_power;
}
@Column(name = "z_r_mult")
public Float getZRMult() {
return this.z_r_mult;
}
public void setZRMult(Float z_r_mult) {
this.z_r_mult = z_r_mult;
}
@Column(name = "z_r_power")
public Float getZrPower() {
return this.z_r_power;
}
public void setZrPower(Float z_r_power) {
this.z_r_power = z_r_power;
}
@Column(name = "zdr_z_mult")
public Float getZdrZMult() {
return this.zdr_z_mult;
}
public void setZdrZMult(Float zdr_z_mult) {
this.zdr_z_mult = zdr_z_mult;
}
@Column(name = "zdr_z_power")
public Float getZdrZPower() {
return this.zdr_z_power;
}
public void setZdrZPower(Float zdr_z_power) {
this.zdr_z_power = zdr_z_power;
}
@Column(name = "zdr_zdr_power")
public Float getZdrZdrPower() {
return this.zdr_zdr_power;
}
public void setZdrZdrPower(Float zdr_zdr_power) {
this.zdr_zdr_power = zdr_zdr_power;
}
@Column(name = "min_corr_precip")
public Float getMinCorrPrecip() {
return this.min_corr_precip;
}
public void setMinCorrPrecip(Float min_corr_precip) {
this.min_corr_precip = min_corr_precip;
}
@Column(name = "min_corr_kdp")
public Float getMinCorrKdp() {
return this.min_corr_kdp;
}
public void setMinCorrKdp(Float min_corr_kdp) {
this.min_corr_kdp = min_corr_kdp;
}
@Column(name = "refl_max")
public Float getReflMax() {
return this.refl_max;
}
public void setReflMax(Float refl_max) {
this.refl_max = refl_max;
}
@Column(name = "kdp_max_beam_blk")
public Float getKdpMaxBeamBlk() {
return this.kdp_max_beam_blk;
}
public void setKdpMaxBeamBlk(Float kdp_max_beam_blk) {
this.kdp_max_beam_blk = kdp_max_beam_blk;
}
@Column(name = "max_usability_blk")
public Float getMaxUsabilityBlk() {
return this.max_usability_blk;
}
public void setMaxUsabilityBlk(Float max_usability_blk) {
this.max_usability_blk = max_usability_blk;
}
@Column(name = "kdp_min_usage_rate")
public Float getKdpMinUsageRate() {
return this.kdp_min_usage_rate;
}
public void setKdpMinUsageRate(Float kdp_min_usage_rate) {
this.kdp_min_usage_rate = kdp_min_usage_rate;
}
@Column(name = "ws_mult")
public Float getWsMult() {
return this.ws_mult;
}
public void setWsMult(Float ws_mult) {
this.ws_mult = ws_mult;
}
@Column(name = "gr_mult")
public Float getGrMult() {
return this.gr_mult;
}
public void setGrMult(Float gr_mult) {
this.gr_mult = gr_mult;
}
@Column(name = "rh_mult")
public Float getRhMult() {
return this.rh_mult;
}
public void setRhMult(Float rh_mult) {
this.rh_mult = rh_mult;
}
@Column(name = "ds_mult")
public Float getDsMult() {
return this.ds_mult;
}
public void setDsMult(Float ds_mult) {
this.ds_mult = ds_mult;
}
@Column(name = "ic_mult")
public Float getIcMult() {
return this.ic_mult;
}
public void setIcMult(Float ic_mult) {
this.ic_mult = ic_mult;
}
@Column(name = "grid_is_full")
public Float getGridIsFull() {
return this.grid_is_full;
}
public void setGridIsFull(Float grid_is_full) {
this.grid_is_full = grid_is_full;
}
@Column(name = "paif_rate")
public Float getPaifRate() {
return this.paif_rate;
}
public void setPaifRate(Float paif_rate) {
this.paif_rate = paif_rate;
}
@Column(name = "paif_area")
public Float getPaifArea() {
return this.paif_area;
}
public void setPaifArea(Float paif_area) {
this.paif_area = paif_area;
}
@Column(name = "rain_time_thresh")
public Float getRainTimeThresh() {
return this.rain_time_thresh;
}
public void setRainTimeThresh(Float rain_time_thresh) {
this.rain_time_thresh = rain_time_thresh;
}
@Column(name = "num_zones")
public Float getNumZones() {
return this.num_zones;
}
public void setNumZones(Float num_zones) {
this.num_zones = num_zones;
}
@Column(name = "max_precip_rate")
public Float getMaxPrecipRate() {
return this.max_precip_rate;
}
public void setMaxPrecipRate(Float max_precip_rate) {
this.max_precip_rate = max_precip_rate;
}
@Column(name = "restart_time")
public Float getRestartTime() {
return this.restart_time;
}
public void setRestartTime(Float restart_time) {
this.restart_time = restart_time;
}
@Column(name = "max_interp_time")
public Float getMaxInterpTime() {
return this.max_interp_time;
}
public void setMaxInterpTime(Float max_interp_time) {
this.max_interp_time = max_interp_time;
}
@Column(name = "max_hourly_acc")
public Float getMaxHourlyAcc() {
return this.max_hourly_acc;
}
public void setMaxHourlyAcc(Float max_hourly_acc) {
this.max_hourly_acc = max_hourly_acc;
}
@Column(name = "time_bias")
public Float getTimeBias() {
return this.time_bias;
}
public void setTimeBias(Float time_bias) {
this.time_bias = time_bias;
}
@Column(name = "num_grpairs")
public Float getNumGrPairs() {
return this.num_grpairs;
}
public void setNumGrPairs(Float num_gr_pairs) {
this.num_grpairs = num_gr_pairs;
}
@Column(name = "reset_bias")
public Float getResetBias() {
return this.reset_bias;
}
public void setResetBias(Float reset_bias) {
this.reset_bias = reset_bias;
}
@Column(name = "longst_lag")
public Float getLongstLag() {
return this.longst_lag;
}
public void setLongstLag(Float longst_lag) {
this.longst_lag = longst_lag;
}
}

View file

@ -0,0 +1,106 @@
package com.raytheon.uf.common.dataplugin.shef.tables;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
*
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/22/2014 Redmine #3454 (A2 14.3.1) new dualpol-related table ID
*
* </pre>
*
* @author OHD
* @version 1.1
*/
@Embeddable
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DSAAdaptId extends PersistableDataObject implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
@XmlElement
@DynamicSerializeElement
private String radid;
@XmlElement
@DynamicSerializeElement
private Date obstime;
public DSAAdaptId() {
}
public DSAAdaptId(String radid, Date obstime) {
this.radid = radid;
this.obstime = obstime;
}
@Column(name = "radid", nullable = false, length = 3)
public String getRadid() {
return this.radid;
}
public void setRadid(String radid) {
this.radid = radid;
}
@Column(name = "obstime", nullable = false, length = 29)
public Date getObstime() {
return this.obstime;
}
public void setObstime(Date obstime) {
this.obstime = obstime;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof DSAAdaptId))
return false;
DSAAdaptId castOther = (DSAAdaptId) other;
return ((this.getRadid() == castOther.getRadid()) || (this.getRadid() != null
&& castOther.getRadid() != null && this.getRadid().equals(
castOther.getRadid())))
&& ((this.getObstime() == castOther.getObstime()) || (this
.getObstime() != null
&& castOther.getObstime() != null && this.getObstime()
.equals(castOther.getObstime())));
}
public int hashCode() {
int result = 17;
result = 37 * result
+ (getRadid() == null ? 0 : this.getRadid().hashCode());
result = 37 * result
+ (getObstime() == null ? 0 : this.getObstime().hashCode());
return result;
}
}

View file

@ -0,0 +1,286 @@
package com.raytheon.uf.common.dataplugin.shef.tables;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
*
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/22/2014 Redmine #3454 (A2 14.3.1) new dualpol-related table DSARadar
*
* </pre>
*
* @author OHD
* @version 1.1
*/
@Entity
@Table(name = "dsaradar")
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DSARadar extends PersistableDataObject implements Serializable, ISerializableObject
{
private static final long serialVersionUID = 1L;
@XmlElement
@DynamicSerializeElement
private DSARadarId id;
@XmlElement
@DynamicSerializeElement
private Short volcovpat;
@XmlElement
@DynamicSerializeElement
private Short opermode;
@XmlElement
@DynamicSerializeElement
private Float maxval;
@XmlElement
@DynamicSerializeElement
private Float scale;
@XmlElement
@DynamicSerializeElement
private Float setoff;
@XmlElement
@DynamicSerializeElement
private Date beginTime;
@XmlElement
@DynamicSerializeElement
private Date endTime;
@XmlElement
@DynamicSerializeElement
private Short jBeginDate;
@XmlElement
@DynamicSerializeElement
private Short jBeginTime;
@XmlElement
@DynamicSerializeElement
private Short jEndDate;
@XmlElement
@DynamicSerializeElement
private Short jEndTime;
@XmlElement
@DynamicSerializeElement
private Short meanFieldBias;
@XmlElement
@DynamicSerializeElement
private Short nullProductFlag;
@XmlElement
@DynamicSerializeElement
private String gridFilename;
public DSARadar() {
}
public DSARadar(DSARadarId id)
{
this.id = id;
}
public DSARadar(DSARadarId id,
Short volcovpat, Short opermode,
Float maxval, Float scale, Float setoff,
Date beginTime, Date endTime,
Short jBeginDate, Short jBeginTime,
Short jEndDate, Short jEndTime,
Short meanFieldBias, Short nullProductFlag,
String gridFilename)
{
this.id = id;
this.volcovpat = volcovpat;
this.opermode = opermode;
this.maxval = maxval;
this.scale = scale;
this.setoff = setoff;
this.beginTime = beginTime;
this.endTime = endTime;
this.jBeginDate = jBeginDate;
this.jBeginTime = jBeginTime;
this.jEndDate = jEndDate;
this.jEndTime = jEndTime;
this.meanFieldBias = meanFieldBias;
this.nullProductFlag = nullProductFlag;
this.gridFilename = gridFilename;
}
@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name = "radid", column = @Column(name = "radid", nullable = false, length = 3)),
@AttributeOverride(name = "obstime", column = @Column(name = "obstime", nullable = false, length = 29)) })
public DSARadarId getId() {
return this.id;
}
public void setId(DSARadarId id) {
this.id = id;
}
@Column(name = "volcovpat")
public Short getVolcovpat() {
return this.volcovpat;
}
public void setVolcovpat(Short volcovpat) {
this.volcovpat = volcovpat;
}
@Column(name = "opermode")
public Short getOpermode() {
return this.opermode;
}
public void setOpermode(Short opermode) {
this.opermode = opermode;
}
@Column(name = "maxval", precision = 8, scale = 8)
public Float getMaxval() {
return this.maxval;
}
public void setMaxval(Float maxval) {
this.maxval = maxval;
}
@Column(name = "scale", precision = 8, scale = 8)
public Float getScale() {
return this.scale;
}
public void setScale(Float scale) {
this.scale = scale;
}
@Column(name = "setoff", precision = 8, scale = 8)
public Float getSetOff() {
return this.setoff;
}
public void setSetOff(Float setoff) {
this.setoff = setoff;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "begin_time")
public Date getBeginTime() {
return this.beginTime;
}
public void setBeginTime(Date beginTime) {
this.beginTime = beginTime;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "end_time")
public Date getEndTime() {
return this.endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
@Column(name = "j_beg_date")
public Short getJBeginDate() {
return this.jBeginDate;
}
public void setJBeginDate(Short jBeginDate) {
this.jBeginDate = jBeginDate;
}
@Column(name = "j_beg_time")
public Short getJBeginTime() {
return this.jBeginTime;
}
public void setJBeginTime(Short jBeginTime) {
this.jBeginTime = jBeginTime;
}
@Column(name = "j_end_date")
public Short getJEndDate() {
return this.jEndDate;
}
public void setJEndDate(Short jEndDate) {
this.jEndDate = jEndDate;
}
@Column(name = "j_end_time")
public Short getJEndTime() {
return this.jEndTime;
}
public void setJEndTime(Short jEndTime) {
this.jEndTime = jEndTime;
}
@Column(name = "mean_field_bias")
public Short getMeanFieldBias() {
return this.meanFieldBias;
}
public void setMeanFieldBias(Short meanFieldBias) {
this.meanFieldBias = meanFieldBias;
}
@Column(name = "nullproductflag")
public Short getNullProductFlag() {
return this.nullProductFlag;
}
public void setNullProductFlag(Short nullProductFlag) {
this.nullProductFlag = nullProductFlag;
}
@Column(name = "grid_filename", length = 20)
public String getGridFilename() {
return this.gridFilename;
}
public void setGridFilename(String gridFilename) {
this.gridFilename = gridFilename;
}
}

View file

@ -0,0 +1,104 @@
package com.raytheon.uf.common.dataplugin.shef.tables;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
*
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/22/2014 Redmine #3454 (A2 14.3.1) new dualpol-related table ID
*
* </pre>
*
* @author OHD
* @version 1.1
*/
@Embeddable
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DSARadarId extends PersistableDataObject implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
@XmlElement
@DynamicSerializeElement
private String radid;
@XmlElement
@DynamicSerializeElement
private Date obstime;
public DSARadarId() {
}
public DSARadarId(String radid, Date obstime) {
this.radid = radid;
this.obstime = obstime;
}
@Column(name = "radid", nullable = false, length = 3)
public String getRadid() {
return this.radid;
}
public void setRadid(String radid) {
this.radid = radid;
}
@Column(name = "obstime", nullable = false, length = 29)
public Date getObstime() {
return this.obstime;
}
public void setObstime(Date obstime) {
this.obstime = obstime;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof DSARadarId))
return false;
DSARadarId castOther = (DSARadarId) other;
return ((this.getRadid() == castOther.getRadid()) || (this.getRadid() != null
&& castOther.getRadid() != null && this.getRadid().equals(
castOther.getRadid())))
&& ((this.getObstime() == castOther.getObstime()) || (this
.getObstime() != null
&& castOther.getObstime() != null && this.getObstime()
.equals(castOther.getObstime())));
}
public int hashCode() {
int result = 17;
result = 37 * result
+ (getRadid() == null ? 0 : this.getRadid().hashCode());
result = 37 * result
+ (getObstime() == null ? 0 : this.getObstime().hashCode());
return result;
}
}

View file

@ -188,6 +188,14 @@ public class MonitorStateConfigurationManager {
return configXml.isPrecipRate();
}
/**
* HydroDualPol state
* @return
*/
public boolean getHydroDualPolState() {
return configXml.isHydroDualPol();
}
/**
* Fog state
*

View file

@ -63,6 +63,9 @@ public class MonitorStateXML implements ISerializableObject {
@XmlElement(name = "preciprate")
private boolean preciprate = false;
@XmlElement(name = "hydrodualpol")
private boolean hydrodualpol = false;
@XmlElement(name = "scan")
private boolean scan = false;
@ -112,10 +115,19 @@ public class MonitorStateXML implements ISerializableObject {
public void setPrecipRate(boolean preciprate) {
this.preciprate = preciprate;
}
public boolean isPrecipRate() {
return preciprate;
}
public void setHydroDualPol(boolean hydrodualpol) {
this.hydrodualpol = hydrodualpol;
}
public boolean isHydroDualPol() {
return hydrodualpol;
}
public void setScan(boolean scan) {
this.scan = scan;

View file

@ -27,4 +27,5 @@
<preciprate>true</preciprate>
<scan>true</scan>
<fssobs>true</fssobs>
</MonitorState>
<hydrodualpol>true</hydrodualpol>
</MonitorState>

View file

@ -0,0 +1,179 @@
package com.raytheon.uf.common.mpe.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
/**
* Read the DAA file.
*
*/
public class DAAFile {
private static final int NUM_DPA_COLS = 131;
private static final int NUM_DPA_ROWS = 131;
private static final double radarZero = Math.pow(10.0, -98.0 / 10.0);
/**
* Raw radar field.
*/
private double[][] stage1i;
/**
* Unbiased radar field (= raw radar * bias)
*/
private double[][] stage1u;
/**
* Zero data for mask.
*/
private double[][] zeroData;
/** The DAA file. */
private File file;
/** The Bias Value */
private double biasValue;
/**
* Constructor.
*
* @param fileName
* filename as String
*/
public DAAFile(String fileName) {
this(new File(fileName));
}
/**
* Constructor.
*
* @param file
* Filename as file
*/
public DAAFile(File file) {
this.file = file;
}
/**
* Load the data.
*
* @throws Exception
*
* @throws IOException
*/
public void load() throws Exception {
FileInputStream fis;
try {
fis = new FileInputStream(file);
FileChannel fc = fis.getChannel();
ByteBuffer byteBuf = fc.map(MapMode.READ_ONLY, 0, fis.available());
readData(byteBuf);
fis.close();
} catch (FileNotFoundException e) {
System.out.println("DAA file not found " + e);
// throw e;
} catch (IOException e) {
System.out.println("IO Error attempting to read DAA file " + e);
// throw e;
}
}
/**
* Read the data out of the byte buffer.
*
* stage1i array contains raw radar field stage1u array contains unbiased
* radar field (= raw radar * bias) both arrays are read in as mm and
* multiplied by 100 to make them look like RMOSAIC
*
* @param byteBuf
* @throws IOException
*/
private void readData(ByteBuffer byteBuf) throws IOException {
stage1i = new double[131][131];
stage1u = new double[131][131];
zeroData = new double[131][131];
byteBuf.order(ByteOrder.LITTLE_ENDIAN);
byteBuf.rewind();
for (int i = NUM_DPA_ROWS - 1; i >= 0; i--) {
for (int j = 0; j < NUM_DPA_COLS; j++) {
float f = byteBuf.getFloat();
if (f > -99.) {
if (f == -98) {
stage1i[i][j] = radarZero * 100;
stage1u[i][j] = radarZero * 100 * biasValue;
} else {
stage1i[i][j] = Math.pow(10, f / 10) * 100;
stage1u[i][j] = Math.pow(10, f / 10) * 100 * biasValue;
}
zeroData[i][j] = radarZero * 100;
} else {
// Set to missing for colorbar
stage1i[i][j] = -9999;
stage1u[i][j] = -9999;
zeroData[i][j] = -9999;
}
}
}
}
/**
* @return the file
*/
public File getFile() {
return file;
}
/**
* Get the raw radar field.
*
* @return
*/
public double[][] getStage1i() {
System.out.println("Getting Stage1i Data...");
return stage1i;
}
/**
* Get the unbiased radar field (= raw radar * bias)
*
* @return
*/
public double[][] getStage1u() {
System.out.println("Getting Stage1u Data...");
return stage1u;
}
/**
* Get an array of zero data to use as a mask.
*
* @return
*/
public double[][] getZeroData() {
return zeroData;
}
/**
* Set the bias value.
*
* @param biasValue
* The bias value to set
*/
public void setBiasValue(double biasValue) {
System.out.println("Bias Value set to " + biasValue);
this.biasValue = biasValue;
}
}

View file

@ -110,10 +110,10 @@ public class DPAFile {
fis.close();
} catch (FileNotFoundException e) {
System.out.println("DPA file not found " + e);
System.out.println("Radar file not found " + e);
// throw e;
} catch (IOException e) {
System.out.println("IO Error on DPA file " + e);
System.out.println("IO Error attempting to read radar file " + e);
// throw e;
}
}
@ -171,7 +171,7 @@ public class DPAFile {
* @return
*/
public double[][] getStage1i() {
System.out.println("Getting Stage1i Data...");
System.out.println("Getting Radar Data...");
return stage1i;
}
@ -181,7 +181,7 @@ public class DPAFile {
* @return
*/
public double[][] getStage1u() {
System.out.println("Getting Stage1u Data...");
System.out.println("Getting Radar Data multiplied by MFB...");
return stage1u;
}
@ -204,4 +204,4 @@ public class DPAFile {
System.out.println("Bias Value set to " + biasValue);
this.biasValue = biasValue;
}
}
}

View file

@ -125,9 +125,7 @@
#
#10/01/09 - Added 5 tokens for arcnav application. //only for arcnav for raxum application
#10/03/12 - Added token section for script execution
#02/12/2014 - Added token for default display to replace field in rwprefs table
#02/18/14 - Added section for run_report_alarm service configuration.
#04/10/14 - Added token for DuaPol radar productts processed in MPE, HPE/HPN
# ==============================================================================
# To see syntax rules for this file, see the bottom of this file
@ -181,42 +179,6 @@ MpeRUCFreezingLevel : ON
MpeLightningSrv : ON
#====================================================================================
#===================== run_report_alarm Configuration ===============================
# These settings modify behavior of the EDEX RunReportAlarmSrv service, which
# replaced the original run_report_alarm script ported from A1 hydro.
#
## Mandatory Arguments:
## alarm_product_id : The product id that will be used to write the alarm
## report product into the textdb.
##
## Optional Arguments:
## alarm_file_suffix : A Java date/time format string that will be used as
## the alarm report's file extension when the product is
## written to disk. Product file path is
## ${whfs_product_dir}/PRODUCT_ID.FILE_SUFFIX.
##
## alarm_report_mode : Report mode. Valid values are one of the following:
## ALL, FRESH, RECENT, UNREPORTED, NEAREST, NEAR_NOW,
## LATEST_MAXFCST, or NEW_OR_INCREASED.
##
## alarm_filter : Additional filtering options for the product.
## Valid values can one or many of the following:
## 'O', 'F', 'T', 'M', 'R', 'L', 'U', 'D'.
##
## alarm_pe_filter : Physical element filter.
##
## alarm_minutes : For certain report modes, creates a window going back
## or forward the specified number of minutes.
## Valid values are 1 - 999999.
##
## alarm_verbose : Whether or not to create a "verbose mode" report.
## Valid values are TRUE or FALSE.
##
alarm_product_id : CCCACRXXX
alarm_file_suffix : MMdd.HHmm
alarm_report_mode : NEAREST
# ==============================================================================
# Executable directory tokens.
@ -242,7 +204,7 @@ server_name : ONLINE # Informix database server name
db_name : hd_ob92lwx # IHFS database name
damcat_db_name : dc_ob5xxx # Dam Catalog database name
hdb_db_name : ob81_histdata # Historical database.
pghost : dx1f # The machine PostGres is running on
pghost : localhost # The machine PostGres is running on
pguser : awips # The user allowed to access PostGres
pgport : 5432 # The PostGres Server port
adb_name : adb_ob7xxx # RFC archive database name
@ -973,7 +935,6 @@ mpe_map_width : 1320
mpe_zoom_out_limit : 20
mpe_disclosure_limit : 60
mpe_map_projection : FLAT
mpe_def_display : MMOSAIC
### Misc tokens
mpe_load_hourlypc : ON
@ -1011,7 +972,7 @@ mpe_del_gage_zeros : OFF # ON/OFF flog to determine if a zero gage
mpe_selected_grid_gagediff : MMOSAIC
mpe_qpe_fieldtype : MMOSAIC # field type to be saved as qpe
mpe_generate_list : BMOSAIC,GAGEONLY,LMOSAIC,LSATPRE,MLMOSAIC,MMOSAIC,RMOSAIC,SATPRE,P3LMOSAIC,SRMOSAIC,SGMOSAIC,QMOSAIC,LQMOSAIC,MLQMOSAIC,RFCBMOSAIC,RFCMMOSAIC,RFCMOSAIC,SAVELEVEL2
mpe_generate_list : BMOSAIC,GAGEONLY,LMOSAIC,LSATPRE,MLMOSAIC,MMOSAIC,RMOSAIC,SATPRE,SRMOSAIC,SGMOSAIC,QMOSAIC,LQMOSAIC,MLQMOSAIC,RDMOSAIC,BDMOSAIC,LDMOSAIC,MDMOSAIC,MLDMOSAIC,AVGRDMOSAIC,MAXRDMOSAIC,SRDMOSAIC,SRDGMOSAIC
mpe_base_radar_mosaic : RMOSAIC # The base radar mosaic used for the fields
# that mpe_fieldgen generates
mpe_show_missing_gage : None # MPE missing gage display.
@ -1881,12 +1842,56 @@ dhm_d2d_data_dir : /data/fxa/Grid/LOCAL/netCDF/DHM # d2d data dir
dhm_d2d_notify_bin_dir : /awips/fxa/bin # d2d notify bin dir
rdhm_input_dir : $(geo_data)
dhm_rain_plus_melt_data_dir: $(geo_data)
# ===========================DualPol Radar processing Token ========================
# New Tokens for DPR/DSA product processing
hpe_dualpol_on : yes
dpr_grid_dir : $(pproc_local_data)/dpr_decoded
dsa_grid_dir : $(pproc_local_data)/dsa_decoded
# New tokens for DAA product processing
daa_grid_dir : $(pproc_local_data)/daa_decoded
daa_archive : OFF # ON/OFF flag for archiving daa products
daa_arch_dir : $(pproc_local_data)/daa_archive
daa_archive_window : 7 # number of minutes around top of hour
# for filtering products for archiving
daa_wind : 5
daa_decode_window : 5
daa_filter_decode : ON # whether time window filtering is on or off
daa_min_coverage_dur : 60
mpe_rdmosaic_dir : $(mpe_fieldgen_product_dir)/rdmosaic
mpe_bdmosaic_dir : $(mpe_fieldgen_product_dir)/bdmosaic
mpe_ldmosaic_dir : $(mpe_fieldgen_product_dir)/ldmosaic
mpe_mdmosaic_dir : $(mpe_fieldgen_product_dir)/mdmosaic
mpe_mldmosaic_dir : $(mpe_fieldgen_product_dir)/mldmosaic
mpe_avgrdmosaic_dir : $(mpe_fieldgen_product_dir)/avgrdmosaic
mpe_maxrdmosaic_dir : $(mpe_fieldgen_product_dir)/maxrdmosaic
mpe_srdmosaic_dir : $(mpe_fieldgen_product_dir)/srdmosaic
mpe_srdgmosaic_dir : $(mpe_fieldgen_product_dir)/srdgmosaic
mpe_statevardp_dir : $(mpe_fieldgen_product_dir)/state_var_dp
mpe_locbiasdp_dir : $(rfcwide_output_dir)/locbiasdp
mpe_locspandp_dir : $(rfcwide_output_dir)/locspandp
# Post Analysis tokens
mpe_post_analysis : OFF
mpe_post_output : $(mpe_fieldgen_product_dir)/post_analysis
# Modify mpe_generate_list token for DAA processing
# add ,RDMOSAIC,BDMOSAIC,LDMOSAIC,MDMOSAIC,MLDMOSAIC,AVGRDMOSAIC,MAXRDMOSAIC,SRDMOSAIC,SRDGMOSAIC to existing mpe_generate_list token
# ================== end of SSHP Directory Structure tokens ========================
# nrldb tokens
nrldb_log : $(whfs_log_dir)/nrldb
nrldb_data : $(whfs_local_data_dir)/nrldb
nrldb_config : $(whfs_config_dir)/nrldb
nrldb_tmp : /awips/hydroapps/whfs/local/data/output
# The syntax needed in the file is:
#

View file

@ -59,4 +59,11 @@
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ohd.edex.plugin.hydrodualpol"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -12,9 +12,23 @@ import ohd.hseb.util.AppsDefaults;
/**
*
* @author lawrence
*
* Represents an MPE Product.
* /**
* Class to handle MPE Product information, including product generation dependencies, for MPE.
* <p>
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 2013 DCS 167 C. Gobs Initial Creation
*
* </pre>
*
*
* @author Chip Gobs
*/
*
*/
public class MPEProductDescriptor implements Comparable<MPEProductDescriptor>

View file

@ -5,6 +5,7 @@
# David T. Miller RSIS OHD/HSEB
# October 30 2007 (adapted from purge_mpe_files)
# April 15, 2014 Add DualPol radar data DSA and DPR
# This allows you to run this script from outside of ./whfs/bin
RUN_FROM_DIR=`dirname $0`
@ -147,6 +148,10 @@ DSPXMRG=${apps_dir}/precip_proc/local/data/dsp_decoded
DSPARCHIVE=${apps_dir}/precip_proc/local/data/dsp_archive
DSPERROR=${apps_dir}/precip_proc/local/data/dsp_error
# Dual Pol DPR and DSA products
DPRXMRG=${apps_dir}/precip_proc/local/data/dpr_decoded
DSAXMRG=${apps_dir}/precip_proc/local/data/dsa_decoded
# Note kept these lines in case there's enough confidence to
# use the $PPROC_LOCAL_DATA value
# But with purging, must ensure what's purged is what was
@ -485,6 +490,27 @@ else
# exit 1
fi
if [[ -d $DSAXMRG && -n "$DSAXMRG" ]]
then
find $DSAXMRG -type f -name 'DSA*Z' -mmin +$XMRGAGE -print -exec rm {} \; \
>> $fnm
else
echo "DSA XMRG directory invalid. " >> $fnm
echo "Check .Apps_defaults settings or set_hydro_env script" \
>> $fnm
# exit 1
fi
if [[ -d $DPRXMRG && -n "$DPRXMRG" ]]
then
find $DPRXMRG -type f -name 'DPR*Z' -mmin +$XMRGAGE -print -exec rm {} \; \
>> $fnm
else
echo "DPR XMRG directory invalid. " >> $fnm
echo "Check .Apps_defaults settings or set_hydro_env script" \
>> $fnm
# exit 1
fi
Dte=`date -u`
echo "End purge_hpe_files at: " $Dte >> $fnm

View file

@ -28,6 +28,7 @@
# - changed purge of mpe_fieldgen logs to purge filenames mpe_*
# Dec 2007 - removed purge of old disagg logs from old disagg app
# Jan 2008 - added purge of DailyQC freezing level preprocessor logs.
# April 2014 - add purge dualpol products
# This allows you to run this script from outside of ./whfs/bin
RUN_FROM_DIR=`dirname $0`
@ -76,6 +77,20 @@ MPESRMOSAIC=$RFCWIDE_OUTPUT_DIR/srmosaic
MPESGMOSAIC=$RFCWIDE_OUTPUT_DIR/sgmosaic
MPESRGMOSAIC=$RFCWIDE_OUTPUT_DIR/srgmosaic
MPERDMOSAIC=$RFCWIDE_OUTPUT_DIR/rdmosaic
MPEBDMOSAIC=$RFCWIDE_OUTPUT_DIR/bdmosaic
MPELDMOSAIC=$RFCWIDE_OUTPUT_DIR/ldmosaic
MPELOCSPANDP=$RFCWIDE_OUTPUT_DIR/locspandp
MPELOCBIASDP=$RFCWIDE_OUTPUT_DIR/locbiasdp
MPESTATEVARDP=$RFCWIDE_OUTPUT_DIR/state_var_dp
MPESRDMOSAIC=$RFCWIDE_OUTPUT_DIR/srdmosaic
MPESRDGMOSAIC=$RFCWIDE_OUTPUT_DIR/srdgmosaic
MPEMDMOSAIC=$RFCWIDE_OUTPUT_DIR/mdmosaic
MPEMLDMOSAIC=$RFCWIDE_OUTPUT_DIR/mldmosaic
MPEAVGRDMOSAIC=$RFCWIDE_OUTPUT_DIR/avgrdmosaic
MPEMAXRDMOSAIC=$RFCWIDE_OUTPUT_DIR/maxrdmosaic
MPERFCBMOSAIC=$RFCWIDE_OUTPUT_DIR/rfcbmosaic
MPERFCMMOSAIC=$RFCWIDE_OUTPUT_DIR/rfcmmosaic
@ -289,6 +304,33 @@ find $RFCBIASINDIR -name '*[0-9]' -type f -mtime +1 -print -exec rm {} \; \
find $RFCBIASOUTDIR -name '*z' -type f -mtime +1 -print -exec rm {} \; \
>> $fnm
find $MPEMDMOSAIC -name '*z' -type f -mtime +2 -print -exec rm {} \; \
>> $fnm
find $MPEMLDMOSAIC -name '*z' -type f -mtime +2 -print -exec rm {} \; \
>> $fnm
find $MPEAVGRDMOSAIC -name '*z' -type f -mtime +2 -print -exec rm {} \; \
>> $fnm
find $MPEMAXRDMOSAIC -name '*z' -type f -mtime +2 -print -exec rm {} \; \
>> $fnm
find $MPERDMOSAIC -name '*z' -type f -mtime +2 -print -exec rm {} \; \
>> $fnm
find $MPEBDMOSAIC -name '*z' -type f -mtime +2 -print -exec rm {} \; \
>> $fnm
find $MPELDMOSAIC -name '*z' -type f -mtime +2 -print -exec rm {} \; \
>> $fnm
find $MPELOCSPANDP -name '*z' -type f -mtime +1 -print -exec rm {} \; \
>> $fnm
find $MPELOCBIASDP -name '*z' -type f -mtime +1 -print -exec rm {} \; \
>> $fnm
find $MPESTATEVARDP -name '*z' -type f -mtime +0 -print -exec rm {} \; \
>> $fnm
find $MPESRDMOSAIC -name '*z' -type f -mtime +1 -print -exec rm {} \; \
>> $fnm
find $MPESRDGMOSAIC -name '*z' -type f -mtime +1 -print -exec rm {} \; \
>> $fnm
Dte=`date -u`
echo "End purge_mpe_files at: " $Dte >> $fnm

View file

@ -1,3 +1,6 @@
#ifndef DISAGG_H
#define DISAGG_H
#include <time.h>
#include "HourlyPP.h"
@ -43,8 +46,11 @@ void Read1hrGageVals();
void Disagg6hr();
void DisaggPointMethod();
void DisaggGridMethod();
void Delete1hrDisaggValues();
void Write1hrValuesFor6hrGages();
int GetQPEGrids(int, int);
void free_1hr_station_list();
void disagg_cleanup();
void grid_cleanup();
#endif /* ifndef DISAGG_H */

View file

@ -18,7 +18,8 @@
void fill_pixmap ( Pixmap user_pixmap ) ;
int get_vip_level();
int get_vip_level(int num_levels, int *levels, int value);
int get_vip_level_allow_negative(int num_levels, int *levels, int value);
void MPEUtil_copy_area ( Widget w , XtPointer client_data , XEvent * calldata ,
Boolean * flag ) ;

View file

@ -40,6 +40,7 @@
#define QPEMAPPER_SITE_NAME_LEN 20 /* The max length of a site name in
QPEmapper. */
#define GAGE_ID_LEN 8
#define MESSAGE_LEN 512
#define HHMMSS_LEN 8
#define YYYYMMDDHH_LEN 10
@ -57,9 +58,12 @@
#define DEFAULT_MIN_GOOD_STATIONS 5
#define DEFAULT_DQC_COPY_TO_IHFS 0
#define DEFAULT_DQC_COPY_TO_ARCHIVE 0
#define DEFAULT_SAVE_NETCDF 0
#define DEFAULT_SAVE_GRIB 0
#define DAILYQC_FAILED 1
#define DAILYQC_OK 0
#define NUM_QCTYPE 3
struct _dqc_run_date
{

View file

@ -43,10 +43,23 @@ enum MpeBestProdList { RMOSAIC,
P3LMOSAIC,
RFCMOSAIC,
RFCBMOSAIC,
RFCMMOSAIC,
QMOSAIC,
LQMOSAIC,
MLQMOSAIC,
RFCMMOSAIC,
RDMOSAIC,
AVGRDMOSAIC,
MAXRDMOSAIC,
BDMOSAIC,
LDMOSAIC,
MDMOSAIC,
MLDMOSAIC,
SRDMOSAIC,
SRDGMOSAIC,
LOCALFIELD1,
LOCALFIELD2,
LOCALFIELD3,
NUM_BEST_PRODUCTS } ;
/* Added April 2, 2008. These names correspond to the
@ -71,7 +84,19 @@ static const char * MpeBestProdNames [ NUM_BEST_PRODUCTS ] =
"RFC Multi-sensor Mosaic",
"Raw Q2 Mosaic",
"Local Bias Q2 Mosaic",
"Multi-sensor Q2 Mosaic"};
"Multi-sensor Q2 Mosaic",
"DP Radar Mosaic",
"DP Average Radar Mosaic",
"DP Maximum Radar Mosaic",
"DP Field Bias Radar Mosaic",
"DP Local Bias Radar Mosaic",
"DP Multi-sensor Mosaic",
"DP Local Bias Multi-sensor Mosaic",
"DP Satellite Radar Mosaic",
"DP Satellite Radar Gage Mosaic",
"Local Field 1",
"Local Field 2",
"Local Field 3"};
/* Added April 3, 2008. These display field types correspond to the
@ -99,9 +124,21 @@ static const enum DisplayFieldData MPEBestDisplayTypes [ NUM_BEST_PRODUCTS ] =
display_rfcmMosaic,
display_qMosaic,
display_lqMosaic,
display_mlqMosaic };
display_mlqMosaic,
display_rdMosaic,
display_avgrdMosaic,
display_maxrdMosaic,
display_bdMosaic,
display_ldMosaic,
display_mdMosaic,
display_mldMosaic,
display_srdMosaic,
display_srdgMosaic,
display_localField1,
display_localField2,
display_localField3 };
/* The token names to for the list of mpe products to generate and the
best qpe. */
@ -113,17 +150,22 @@ static const enum DisplayFieldData MPEBestDisplayTypes [ NUM_BEST_PRODUCTS ] =
/* Token which contains which of the radar mosaics to use
as the base for the MPE products. */
#define MPE_BASE_RADAR_MOSAIC_TOKEN "mpe_base_radar_mosaic"
#define MPE_BASE_RADARDP_MOSAIC_TOKEN "mpe_base_radardp_mosaic"
void get_mpe_product_state ( const char * product , const int * product_len ,
const int * verbose , int * state ,
int * exit_status ) ;
int isInGenerateList(const char * qpeFieldName);
void get_mpe_qpe_fieldtype ( const int * verbose , char * bestfield ,
int * bestfield_len , int * exit_status ) ;
void get_mpe_base_radar ( const int * verbose , char * base_radar_field ,
int * baseradar_len , int * exit_status );
void get_mpe_base_radardp ( const int * verbose , char * base_radardp_field ,
int * baseradar_len , int * exit_status );
const char ** get_qpe_fields_array ( ) ;
#endif /* #ifndef GET_MPE_PRODUCT_STATE_H */

View file

@ -35,6 +35,12 @@
#define num_6hr_gridded_freezing_colors 16
#define num_6hr_mean_freezing_colors 16
#define num_precip_diff_colors 19
#define num_precip_diff_levels 17
#define num_precip_ratio_colors 17
#define num_precip_ratio_levels 15
void writeDefaultMPEColorDataFile();
static const char * height_colors [ num_height_colors ] =
@ -266,4 +272,82 @@ static const double mean_temperature_levels_6hr [ num_6hr_mean_temperature_color
20.0, 30.0, 40.0, 50.0, 60.0, 70.0,
80.0, 90.0, 100.0, 110.0, 120.0 };
/*
static const char * precip_diff_colors [ num_precip_diff_colors ] =
{ "GRAY30", "GRAY30" ,
"DODGERBLUE1" , "CYAN" , "DARKGREEN" ,
"GREEN" , "GREENYELLOW" , "YELLOW" ,
"DARKORANGE1" ,"BLACK" , "BLACK",
"RED" , "RED2" , "RED3" ,
"MAGENTA1" , "MAGENTA2", "DARKORCHID"
} ;
*/
static const char * precip_diff_colors [ num_precip_diff_colors ] =
{ "GRAY30", "GRAY30" ,
"MAGENTA1" ,"MEDIUMORCHID", "DARKORCHID",
"MEDIUMBLUE" ,"BLUE", "DODGERBLUE", "DARKTURQUOISE" ,
"CYAN",
"BLACK" , "BLACK",
"GREEN" , "GREENYELLOW" , "YELLOW" ,
"DARKORANGE1" ,
"ORANGERED" , "RED2" , "RED3"
} ;
static const double precip_diff_levels [ num_precip_diff_colors ] =
{ -9999, -8888,
-0.75 , -0.5, -.25 ,
-0.1, -0.08 , -0.06 ,-0.03,
-0.01, //CYAN
0.0, 0.01,
0.03, 0.06 , 0.08 ,
0.1,
0.25 , 0.50 , .75
} ;
static const char * precip_ratio_colors [ num_precip_ratio_colors ] =
{ "GRAY30", "GRAY30" ,
"MAGENTA1", "MEDIUMORCHID", "DARKORCHID",
"MEDIUMBLUE" ,"DODGERBLUE", "DARKTURQUOISE" ,"CYAN",
"BLACK",
"GREEN", "GREENYELLOW" , "YELLOW" ,
"DARKORANGE1" ,
"ORANGERED" , "RED2" , "RED3"
} ;
static const double precip_ratio_levels [ num_precip_ratio_colors ] =
{
-9999, -8888,
0.1, 0.2 ,
0.3, 0.5 , 0.6 , 0.75,
0.95, 1.05,
1.5, 2.0 , 4.0 ,
6.0,
8.0 , 16.0 , 32.0
} ;
#endif /* #ifndef MPE_COLORS_H */

View file

@ -29,18 +29,27 @@ typedef enum ColorUse
{ RADAR_MOSAIC_USE,
AVG_RADAR_MOSAIC_USE,
MAX_RADAR_MOSAIC_USE,
FIELD_BIAS_MOSAIC_USE,
LOCAL_BIAS_MOSAIC_USE,
GAGE_ONLY_ANALYSIS,
SATELLITE_PRECIP,
LOCAL_BIAS_SATELLITE_PRECIP,
MULTI_SENSOR_MOSAIC,
LOCAL_BIAS_MULTI_MOSAIC,
P3_LOCAL_BIAS_MOSAIC,
BEST_ESTIMATE_QPE,
MULTI_HOUR_QPE,
LOCAL_SPAN,
LOCAL_BIAS,
LOCAL_SPAN_DP,
LOCAL_BIAS_DP,
HEIGHT_FIELD,
RADAR_COVERAGE_FIELD,
PRISM,
@ -55,29 +64,57 @@ typedef enum ColorUse
Q2_MOSAIC,
Q2_LOCAL_BIAS_MOSAIC,
MULTI_SENSOR_Q2_MOSAIC,
DUAL_POL_RADAR_MOSAIC_USE,
DUAL_POL_AVG_RADAR_MOSAIC_USE,
DUAL_POL_MAX_RADAR_MOSAIC_USE,
DUAL_POL_FIELD_BIAS_MOSAIC_USE,
DUAL_POL_LOCAL_BIAS_MOSAIC_USE,
DUAL_POL_MULTISENSOR_FIELD_BIAS_MOSAIC_USE,
DUAL_POL_MULTISENSOR_LOCAL_BIAS_MOSAIC_USE,
DUAL_POL_SATELLITE_RADAR_MOSAIC_USE,
DUAL_POL_SATELLITE_RADAR_GAGE_MOSAIC_USE,
LOCAL_FIELD1,
LOCAL_FIELD2,
LOCAL_FIELD3,
NUM_COLORUSE_ITEMS
} ColorUse ;
enum DisplayFieldData { display_rMosaic,
typedef enum DisplayFieldData { display_rMosaic,
display_avgrMosaic,
display_maxrMosaic,
display_bMosaic,
display_lMosaic,
display_gageOnly,
display_satPrecip,
display_lsatPrecip,
display_mMosaic,
display_mlMosaic,
display_p3Mosaic,
display_Xmrg,
display_multiHour,
display_Locspan,
display_Locbias,
display_Locspan_dp,
display_Locbias_dp,
display_Height,
display_Index,
display_Prism,
display_maxtempPrism,
display_mintempPrism,
display_rfcMosaic,
display_sgMosaic,
display_srMosaic,
@ -87,9 +124,72 @@ enum DisplayFieldData { display_rMosaic,
display_qMosaic,
display_lqMosaic,
display_mlqMosaic,
//dual pol fields
display_rdMosaic,
display_avgrdMosaic,
display_maxrdMosaic,
display_bdMosaic,
display_ldMosaic,
display_mdMosaic,
display_mldMosaic,
display_srdMosaic,
display_srdgMosaic,
display_localField1,
display_localField2,
display_localField3,
//new comparison fields
display_diffField,
display_ratioField,
display_subValue,
display_missing } ;
display_missing
} DisplayFieldData;
typedef enum MPEFieldSubtype
{
hourly_precip_accum_subtype,
multihour_precip_accum_subtype,
precip_diff_subtype,
precip_ratio_subtype,
height_subtype,
index_subtype,
prism_subtype,
locbias_subtype,
locspan_subtype,
num_subtypes
} MPEFieldSubtype;
typedef struct MPEField
{
DisplayFieldData fieldType;
char * color_value_db_use;
char * file_name_use;
char * dir_token_name;
MPEFieldSubtype subtype;
// ColorUse color_use // do we really both a string version and an enum version?
// char * legend_display_name; //from drawMpeLegend
char * long_name;
} MPEField;
extern MPEField mpe_field_table[];
extern DisplayFieldData comparisonFieldData1;
extern DisplayFieldData comparisonFieldData2;
const char ** get_mpe_field_names ( ) ;
MPEField getMPEField(DisplayFieldData fieldType);
DisplayFieldData getDisplayFieldDataByName(const char * fieldName);
#endif /*ifndef MPE_FIELD_NAMES_H */

View file

@ -52,12 +52,13 @@
/* Ordering of the elements in this list must be the same as the beginning
* of the enum DisplayFieldData type in the mpe_field_names.h header file. */
typedef enum {rmosaic = 0, avgrmosaic, maxrmosaic, bmosaic, lmosaic, gaugeonly,
satpre, lsatpre, mmosaic, mlmosaic, p3lmosaic, srmosaic, sgmosaic, srgmosaic,
qmosaic, lqmosaic, mlqmosaic, rfcmosaic, rfcbmosaic, rfcmmosaic, num_mosaics
typedef enum {rmosaic = 0, avgrmosaic, maxrmosaic, gaugeonly, bmosaic, lmosaic,
mmosaic, mlmosaic, satpre, lsatpre, p3lmosaic, srmosaic, sgmosaic, srgmosaic,
qmosaic, lqmosaic, mlqmosaic, rdmosaic, avgrdmosaic, maxrdmosaic,
bdmosaic, ldmosaic, mdmosaic, mldmosaic, srdmosaic, srdgmosaic,
rfcmosaic, rfcbmosaic, rfcmmosaic, num_mosaics
}mosaicType ;
extern char currTime[HHMMSS_LEN + 1];
extern char message[MESSAGE_LEN] ;
@ -100,7 +101,8 @@ typedef struct _radar_result_struct
{
char radID[ RADAR_ID_LEN + 1];
short edit_bias;
short ignore_radar;
short ignore_dpa_radar;
short ignore_daa_radar;
float bias ;
} radar_result_struct;
@ -303,6 +305,19 @@ void MPEFieldGen_runRMosaic(const run_date_struct * pRunDate,
double ** QPEMosaic,
int * blnMosaic) ;
void MPEFieldGen_runRDMosaic(const run_date_struct * pRunDate,
const geo_data_struct * pGeoData,
mpe_params_struct * pMPEParams,
const radarLoc_table_struct * pRadarLocTable ,
const gage_table_struct * pGageTable,
const gage_table_struct * pGageTableP3,
const gage_table_struct * pQCGageTable,
double * meanFieldBias,
int ** IDDP,
double ** RDMosaic,
double ** QPEMosaic,
int * blnMosaic) ;
void MPEFieldGen_readRadarLoc ( radarLoc_table_struct * pRadarLocTable ) ;
void MPEFieldGen_readRadarResult (const char * datetime,
@ -326,7 +341,23 @@ void readDPARadar(const char * rad,
int * itim,
long int * irc) ;
void MPEFieldGen_readMisc(const radarLoc_table_struct * pRadarLocTable,
void MPEFieldGen_readDAARadar(const char * rad,
const char * datetime,
const int idpawind,
double * maxvald,
double * bias,
char * fname,
int * itim,
int * coverageDur,
int * nullProductFlag,
long int * irc) ;
void MPEFieldGen_readDAARadarResult (const char * datetime,
radar_result_struct * pRadarResult,
short * count ,
long int * irc);
void MPEFieldGen_readMisc(const radarLoc_table_struct * pRadarLocTable,
const char * os,
short int ** radarMiscBins ) ;
@ -341,12 +372,23 @@ void MPEFieldGen_getMeanBias(const radarLoc_record_struct * pRadarLocRecord,
double * memSpanBias,
int * gageRadarPairNum) ;
void MPEFieldGen_pairGageRadar(const radarLoc_record_struct * pRadarLocRecord,
void MPEFieldGen_getMeanBiasDP(const radarLoc_record_struct * pRadarLocRecord,
const char * datetime ,
short int radarMiscBins [][NUM_DPA_COLS] ,
float radar [][NUM_DPA_COLS] ,
const geo_data_struct * pGeoData ,
const gage_table_struct * pGageArray ,
const mpe_params_struct * pMPEParams ,
double * meanBias,
double * memSpanBias,
int * gageRadarPairNum) ;
void MPEFieldGen_pairGageRadar(const radarLoc_record_struct * pRadarLocRecord,
short int radarMiscBins [][NUM_DPA_COLS] ,
float radar [][NUM_DPA_COLS] ,
const geo_data_struct * pGeoData ,
const gage_table_struct * pGageArray ,
const mpe_params_struct * pMPEParams ,
gage_radar_pair_table_struct * pGageRadarPairTable) ;
void MPEFieldGen_calculatePixelHeight(const double lon_coord,
@ -365,6 +407,14 @@ void MPEFieldGen_calculateMeanBias(const char * radarID,
double * meanBias,
double * memSpanBias ) ;
void MPEFieldGen_calculateMeanBiasDP(const char * radarID,
const char * datetime ,
const mpe_params_struct * pMPEParams ,
const gage_table_struct * pGageArray,
gage_radar_pair_table_struct * pGageRadarPairTable ,
double * meanBias,
double * memSpanBias ) ;
void MPEFieldGen_gageRadarPairsQC(const mpe_params_struct * pMPEParams ,
const double bias_long ,
gage_radar_pair_table_struct * pGageRadarPairTable ,
@ -388,7 +438,17 @@ void MPEFieldGen_write_rwbiasdyn(const char *rad,
double * bb,
long int *irc) ;
void MPEFieldGen_read_rwbiasdyn2(const char *rad,
void MPEFieldGen_write_daabiasdyn(const char *rad,
const char * site_id,
const char * dt,
const int num_span,
double * num_pairs,
double * sumgag,
double * sumrad,
double * bb,
long int *irc) ;
void MPEFieldGen_read_rwbiasdyn2(const char *rad,
const char * site_id,
const char * str,
const int lag_cut,
@ -400,6 +460,18 @@ void MPEFieldGen_read_rwbiasdyn2(const char *rad,
char sstr1[19],
long int *irc) ;
void MPEFieldGen_read_daabiasdyn(const char *rad,
const char * site_id,
const char * str,
const int lag_cut,
double *num_pairs,
double *sumgag,
double *sumrad,
double *bias,
int *lag,
char sstr1[19],
long int *irc) ;
void MPEFieldGen_read_spe ( const char * satpre_filename ,
const geo_data_struct * pGeoData,
double ** pSatPre,
@ -456,6 +528,41 @@ void runBMosaic(const run_date_struct * pRunDate ,
double ** BMosaic,
double ** QPEMosaic) ;
void runBDMosaic(const run_date_struct * pRunDate ,
const geo_data_struct * pGeoData ,
const mpe_params_struct * pMPEParams ,
double * meanFieldBias ,
int ** ID ,
double ** RDMosaic ,
double ** BDMosaic,
double ** QPEMosaic) ;
void runMLDMosaic(const run_date_struct * pRunDate ,
const geo_data_struct * pGeoData ,
mpe_params_struct * pMPEParams ,
const int gageSize,
short * iug ,
short * ivg ,
float * zg ,
int ** ID ,
double ** RDMosaic ,
double ** LDMosaic ,
double ** umeang ,
double ** QPEMosaic) ;
void runMDMosaic(const run_date_struct * pRunDate ,
const geo_data_struct * pGeoData ,
mpe_params_struct * pMPEParams ,
const int gageSize,
short * iug ,
short * ivg ,
float * zg ,
int ** ID ,
double ** RDMosaic ,
double ** BDMosaic ,
double ** umeang ,
double ** QPEMosaic) ;
void MPEFieldGen_runLMosaic(const run_date_struct * pRunDate ,
const geo_data_struct * pGeoData ,
mpe_params_struct * pMPEParams ,
@ -466,6 +573,18 @@ void MPEFieldGen_runLMosaic(const run_date_struct * pRunDate ,
double ** RMosaic ,
double ** LMosaic,
double ** QPEMosaic) ;
void runLDMosaic(const run_date_struct * pRunDate ,
const geo_data_struct * pGeoData ,
mpe_params_struct * pMPEParams ,
const int gageSize,
short * iug ,
short * ivg ,
float * zg ,
double ** RDMosaic ,
double ** LDMosaic,
double ** QPEMosaic) ;
void runQMosaic(const run_date_struct * pRunDate ,
const geo_data_struct * pGeoData ,
const mpe_params_struct * pMPEParams ,
@ -482,6 +601,7 @@ void runLQMosaic(const run_date_struct * pRunDate ,
double ** QMosaic ,
double ** LQMosaic,
double ** MPEFieldGen_QPEMosaic) ;
void MPEFieldGen_lb_gr_pairs ( float gr_min_value ,
const int gageSize,
short * iug ,
@ -515,6 +635,7 @@ void MPEFieldGen_runMLMosaic(const run_date_struct * pRunDate ,
double ** LMosaic ,
double ** umeang ,
double ** QPEMosaic) ;
void runMLQMosaic(const run_date_struct * pRunDate ,
const geo_data_struct * pGeoData ,
mpe_params_struct * pMPEParams ,
@ -527,6 +648,7 @@ void runMLQMosaic(const run_date_struct * pRunDate ,
double ** LQMosaic ,
double ** umeang ,
double ** MPEFieldGen_QPEMosaic) ;
void runSatpre ( const run_date_struct * pRunDate,
const geo_data_struct * pGeoData,
mpe_params_struct * pMPEParams,
@ -572,6 +694,15 @@ void runSRGMosaic(const run_date_struct * pRunDate ,
double ** umeang ,
double ** QPEMosaic) ;
void runSRDGMosaic(const run_date_struct * pRunDate ,
const geo_data_struct * pGeoData ,
mpe_params_struct * pMPEParams ,
const int gageSize,
short * iug ,
short * ivg ,
float * zg ,
double ** umeang ,
double ** QPEMosaic) ;
int MPEFieldGen_runP3LMosaic ( const run_date_struct * pRunDate,
const mpe_params_struct * pMPEParams,
@ -715,6 +846,24 @@ void MPEFieldGen_createMosaic(const radarLoc_record_struct * pRadarLocRecord,
int ** AvgMosaicNumRadars,
int * blnMosaic);
void createRDMosaic(const radarLoc_record_struct * pRadarLocRecord,
float radar [ ][ NUM_DPA_COLS ] ,
short int radarMiscBins [ ][ NUM_DPA_COLS],
const int index ,
const geo_data_struct * pGeoData ,
double ** RDMosaic ,
double ** MHeight,
int ** radarIDDP,
double ** MaxRDMosaic,
double ** AvgRDMosaic,
int ** AvgRDMosaicNumRadars,
int * blnMosaic);
void MPEFieldGen_rfcw_load_static ( int * status );
void get_rgb(const char* color_name, int *r, int *g, int *b);
void read_daa_decoded ( const char * filename ,
const int * fname_length ,
float radar [ ] [ NUM_DPA_COLS ] ,
int * ierr ) ;
#endif /* #ifndef MPE_FIELDGEN_H */

View file

@ -11,6 +11,7 @@
* MODIFICATION HISTORY:
* DATE PROGRAMMER DESCRIPTION/REASON
* May 2011 S Naples Added process_PC token
* Sep 2013 Added dual-pol changes
********************************************************************************
*/
@ -20,6 +21,15 @@
#include "mpe_db_tables.h"
#include "mpe_constants.h"
#include "mpe_field_names.h"
/*-----------------------------------------------------------------*/
/* polarization type (SinglePol or DualPol) for multisensor fields */
/*-----------------------------------------------------------------*/
typedef enum MultisensorPolarizationType
{
SinglePol,
DualPol
} MultisensorPolarizationType;
/*--------------------------------*/
/* definition of variables */
@ -47,11 +57,25 @@ typedef struct _mpe_params_struct
char xmrgdtform[XMRGDTFORM_LEN+1];
/** number of minutes around top of hour in which to search
* for a top-of-hour product.
* for a top-of-hour DPA product.
* determined by token "dpa_wind".
* default = 10 minutes.
**/
int dpa_wind;
/** number of minutes around top of hour in which to search
* for a top-of-hour DAA product.
* determined by token "daa_wind".
* default = 5 minutes.
**/
int daa_wind;
/**
* minimum coverage of an hour
* for a radar product to be considered good
* units = minutes
* default = 60
**/
int daa_min_coverage_dur;
/** check if need delete zeros in gage data
* determined by token "mpe_del_gage_zeros".
@ -83,12 +107,18 @@ typedef struct _mpe_params_struct
char qpe_fieldtype[MOSAIC_TYPE_LEN];
enum DisplayFieldData mosaic_type;
/** blnMeanFieldBias = the mean field bias flag.
/** blnMeanFieldBias = the mean field bias flag for single-pol radars
* = 0 -- don't compute mean field bias
* = 1 -- compute mean field bias
**/
int blnMeanFieldBias;
/** blnMeanFieldBiasDP = the mean field bias flag for dual-pol radars
* = 0 -- don't compute mean field bias
* = 1 -- compute mean field bias
**/
int blnMeanFieldBiasDP;
/** locbias_1hr_rerun = the local bias rerun.
* = 0 -- do not recalc local bias on rerun
* = 1 -- recalc local bias on rerun
@ -104,7 +134,20 @@ typedef struct _mpe_params_struct
*/
int sat_avail;
int radar_avail_num ;
int build_neighbor_list ;
/*----------------------------------------------------------------------*/
/* neighbor list generation flag */
/* build_neighbor_list_SP = 0 -- neighbor list not generated */
/* = 1 -- neighbor list generated for this hour for SP multisensor fields*/
/* (same definitionsfor build_neighbor_list_DP) */
/*----------------------------------------------------------------------*/
int build_neighbor_list_SP ;
int build_neighbor_list_DP ;
/*-----------------------------------------------------------------*/
/* polarization type (SinglePol or DualPol) for multisensor fields */
/*-----------------------------------------------------------------*/
enum MultisensorPolarizationType polarizationType;
/** mpe_save_netcdf = integer value of mpe_save_netcdf token.
* if token is found as "ON",

View file

@ -75,9 +75,9 @@ void MPEFieldGen_multi_sensor(const geo_data_struct * pGeoData ,
double ** est ,
int * errFlag) ;
void MPEFieldGen_ms_soe(const int rowSize , const int colSize ,
void MPEFieldGen_ms_soe(const int rowSize , const int colSize ,
const int isrch_g, const double cvr,
const double f0, const int nbrs_g,
const double f0, const int nbrs_g,
const int nbrs_r, double ** umeang,
const int i, const int j,
const double rain_min, const double dist_min,
@ -86,13 +86,14 @@ void MPEFieldGen_ms_soe(const int rowSize , const int colSize ,
const double cor0ic, const double rngic,
const double cor0pir, const double cor0ir,
const double rngir, const double cor0pcg,
const double cor0cg, const double rngcg,
const double cor0pcc, const double cor0cc,
const double rngcc, const double cor0pcr,
const double cor0cg, const double rngcg,
const double cor0pcc, const double cor0cc,
const double rngcc, const double cor0pcr,
const double cor0cr, const double rngcr,
short * iug, short * ivg, float * zg,
short * iur, short * ivr, float * zr,
short * ilist_g, double * est) ;
short * ilist_g, double * est,
int * errFlag);
void MPEFieldGen_covmatms(const int isrch_g, const double varg,
const double varr, const int nbrs_g,

View file

@ -1,8 +1,8 @@
/*
* packgrib.h
*
* Created on: Aug 26, 2011
* Author: snaples
* Created on: BEFORE OB83
* Author: ohd
*/
/*

View file

@ -21,5 +21,7 @@
void read_dpa_fname ( const char rad [ 4 ] , const char * datetime ,
char fname [ 17 ] , long int * irc ) ;
void read_daa_fname ( const char rad [ 4 ] , const char * datetime ,
char fname [ 17 ] , long int * irc ) ;
#endif /* #ifndef READ_DPA_FILENAME_H */

View file

@ -18,6 +18,7 @@
#define READ_PRODUCT_DT_H
void read_product_dt ( char rad[4], char * datetime, int * n );
void read_daaproduct_dt ( char rad[4], char * datetime, int * n );
#endif /* #ifndef READ_PRODUCT_DT_H */

View file

@ -20,5 +20,6 @@
#define READ_RADAR_GRIDS_H
void read_radar_grids ( int ss_number ) ;
void read_dp_radar_grids ( int ss_number ) ;
#endif /* #ifndef READ_RADAR_GRIDS_H */

View file

@ -23,4 +23,6 @@ enum RadarIgnoreFlag { DontIgnoreRadar , IgnoreRadar } ;
void read_rresult ( char * datetime ) ;
void read_DAArresult ( char * datetime ) ;
#endif /* #ifndef READ_RRESULT_H */

View file

@ -27,4 +27,8 @@ void read_stage1_decoded_ ( const char * filename ,
float radar [ ] [ NUM_DPA_COLS ] ,
int * ierr ) ;
void read_daa_decoded_file ( const char * filename ,
const int * fname_length ,
float radar [ ] [ NUM_DPA_COLS ] ,
int * ierr ) ;
#endif /* #ifndef READ_STAGE1_DATA_H */

View file

@ -43,15 +43,17 @@ void hour_sensitive_RFCW();
/*----------------------------------*/
char date_form[4]; /* date format for xmrg filename */
int daa_min_coverage_dur; /* NOTE: this variable is same as field in mpe_params_struct */
/*--------------------------------------------------*/
/* reading radar related data */
/*--------------------------------------------------*/
/*------------------------------------------*/
/* radar related data */
/*------------------------------------------*/
short int ***stage1u;
short int ***radcov;
char **datetime_radar_prod;
char **datetime_daaradar_prod;
/*--------------------------------------------------------*/
/* routines for reading data from PseudoGageRadarVal and */

View file

@ -58,6 +58,9 @@ void do_time_lapse_RFCW ( Widget w , XtPointer clientdata ,
void ignore_radar_RFCW ( Widget w , XtPointer clientdata ,
XtPointer calldata ) ;
void ignore_dp_radar_RFCW ( Widget w , XtPointer clientdata ,
XtPointer calldata ) ;
void next_callback_RFCW ( Widget w , XtPointer clientdata ,
XtPointer calldata ) ;

View file

@ -85,6 +85,7 @@ typedef struct {
Widget edit_multi_sensor_field_button;
Widget edit_bias_value_button;
Widget ignore_widget;
Widget ignore_dp_widget;
Widget edit_popupShell;
Widget edit_canvas;
Widget save_widget;
@ -112,6 +113,11 @@ typedef struct {
Widget rfc_qpe_mosaic;
Widget transmit_rfc_qpe;
Widget transmit_rfc_bias;
Widget post_analysis_widget;
/* added by zhan */
Widget restart_widget;
} rfcwide_widget_struct;
typedef struct {
@ -152,6 +158,9 @@ Widget p3lmosaic_widget;
Widget rawq2mosaic_widget;
Widget locbiasq2mosaic_widget;
Widget multiq2mosaic_widget;
Widget localfield1_widget;
Widget localfield2_widget;
Widget localfield3_widget;
Widget gageonly_widget;
Widget xmrg_widget;
Widget multihour_widget;
@ -167,6 +176,18 @@ Widget srmosaic_widget;
Widget srgmosaic_widget;
Widget rfcbmosaic_widget;
Widget rfcmmosaic_widget;
//dual pol widgets
Widget rdmosaic_widget;
Widget avgrdmosaic_widget;
Widget maxrdmosaic_widget;
Widget bdmosaic_widget;
Widget ldmosaic_widget;
Widget mdmosaic_widget;
Widget mldmosaic_widget;
Widget srdmosaic_widget;
Widget srdgmosaic_widget;
Widget bias_widget;
Widget bias_shell;
Widget applyInfoPb[40];

View file

@ -185,9 +185,11 @@ float *bias_slope;
float *bias_inter;
float *sibias;
short int *iflarad;
short int *iflarad_dp;
short int *iflgg;
short int *iflml;
short int *iflign;
short int *iflign_dp; //dual-pol version of ignore radar array
char mosaic_type[10];
char default_mosaic_type[10];
int iselect;

View file

@ -19,4 +19,7 @@
void update_flig_RFCW ( short ignore_radar_flag, char * rid ,
char * datetime );
void update_flig_dp_RFCW ( short ignore_radar_flag, char * rid ,
char * datetime );
#endif /* #ifndef UPDATE_FLIG_RFCW_H */

View file

@ -54,6 +54,6 @@ void MPEFieldGen_apply_mfb(const double * mfbias ,
if(RMosaic[i][j] != MOSAIC_DEFAULT)
BMosaic[i][j] = mfbias[k-1] * RMosaic[i][j] ;
}
}
}
}
} /* for j */
} /* for i */
} /* end MPEFieldGen_apply_mfb */

View file

@ -162,7 +162,8 @@ void MPEFieldGen_apply_mpe_polygons ( double ** real_mosaic,
/* The polygons have been applied. Return this field to the calling
routine so that it can be written out to a xmrg file. */
return;
}
} /* end MPEFieldGen_apply_mpe_polygons */
void MPEFieldGen_editPolygonDestructor ( const geo_data_struct * pGeoData )
{
@ -181,15 +182,11 @@ void MPEFieldGen_editPolygonDestructor ( const geo_data_struct * pGeoData )
}
free_poly_temp ( );
}
} /* end MPEFieldGen_editPolygonDestructor */
/* Honestly, this function seems to do absolutely NOTHING! */
bool MPEFieldGen_eliminateP3Gages ( int hrapx, int hrapy, enum DisplayFieldData field )
{
return true;
/* ============== Statements containing RCS keywords: */
{static char rcs_id1[] = "$Source: /fs/hseb/ob83/ohd/pproc_lib/src/MPEFieldGen/RCS/apply_polygons.c,v $";
static char rcs_id2[] = "$Id: apply_polygons.c,v 1.1 2007/10/15 12:19:05 dsa Exp lawrence $";}
/* =================================================== */
}
} /* MPEFieldGen_eliminateP3Gages */

View file

@ -23,12 +23,7 @@ void allocNeighborList(const geo_data_struct * pGeoData) ;
void MPEFieldGen_buildNeighborList (const geo_data_struct * pGeoData ,
mpe_params_struct * pMPEParams,
const int gageSize, short * iug, short * ivg, float * zg )
{
if(pMPEParams->build_neighbor_list == 1)
return ;
pMPEParams->build_neighbor_list = 1 ;
{
const int rowSize = pGeoData->num_rows;
const int colSize = pGeoData->num_cols;
@ -50,6 +45,20 @@ void MPEFieldGen_buildNeighborList (const geo_data_struct * pGeoData ,
double mid_hrap ;
int indx;
if ((pMPEParams->polarizationType == SinglePol) && (pMPEParams->build_neighbor_list_SP == 1)) return;
if((pMPEParams->polarizationType == DualPol) && (pMPEParams->build_neighbor_list_DP == 1)) return;
if (pMPEParams->polarizationType == SinglePol)
{
pMPEParams->build_neighbor_list_SP = 1;
}
if (pMPEParams->polarizationType == DualPol)
{
pMPEParams->build_neighbor_list_DP = 1;
}
getCurrentTime(currTime) ;
sprintf( message , "%s = time begin building neighbor list." ,
currTime) ;

View file

@ -0,0 +1,261 @@
/******************************************************************************
* FILENAME: calculateMeanBiasDP.c
*
* Purpose:
* performs mean field bias estimation via exponential
* smoothing (Schweppe 1973)
*
* calling function: getMeanBiasDP
* functions called: read_daabiasdyn, gageRadarPairsQC,
* updateDAAStateVariable, write_daabiasdyn
*
* input variables
*
* radarID - radar id
*
* datetime - YYYY-MM-DD HH:MM:SS formatted datetime
*
* pMPEParams - static parameters
* - DAA mean-field bias will use same parameters as DPA mean-field bias
* (for now)
*
* pGageArray - array of gage data
*
* pGageRadarPairTable - array of positive gage/radar pair data
*
*
* output variables
*
* meanBias - the mean field bias value
* memSpanBias - the mean field bias value in mem_span array.
*
*******************************************************************************
*/
#include "mpe_fieldgen.h"
void calculateMeanBiasDP(const char * radarID,
const char * datetime ,
const mpe_params_struct * pMPEParams ,
const gage_table_struct * pGageArray,
gage_radar_pair_table_struct * pGageRadarPairTable ,
double * meanBias,
double * memSpanBias )
{
double num_pairs[NUM_MEMORY_SPANS], sumGage[NUM_MEMORY_SPANS],
sumRadar[NUM_MEMORY_SPANS], bias[NUM_MEMORY_SPANS] ;
char datetime1[ANSI_YEARSEC_TIME_LEN + 1] ;
int lag, i, flag ;
float * mem_span ;
double bias_long ;
long int irc=0 ;
/* char site_id[RFC_LEN + 1] = ""; */
const char *site_id = pMPEParams->fxa_local_site;
const int num_span = pMPEParams->ptrRWBiasStat->num_span ;
const int lag_cut = pMPEParams->ptrRWBiasStat->lag_cut ;
const int init_span = pMPEParams->ptrRWBiasStat->init_span ;
/**
* check that number of memory spans
* does not exceed NUM_MEMORY_SPANS.
**/
if(num_span > NUM_MEMORY_SPANS)
{
sprintf ( message , "ERROR: number of memory spans %d great than %d"
"\n\tProgram exit.",
num_span, NUM_MEMORY_SPANS) ;
shutDownMPE( message, logFile );
}
/**
* read state variables for current hour from DAABiasDyn table
* if record not found for current hour,
* then look back lag_cut hours for a record
* if record not found within lag_cut hours,
* then reinitialize state variables to 0.0.
**/
/* allocate memory for the mem_span data */
mem_span = (float *)malloc(NUM_MEMORY_SPANS * sizeof( float ));
if(mem_span == NULL)
{
sprintf ( message , "ERROR: memory allocation failure"
" in calculateMeanBias function."
"\n\tProgram exit.") ;
shutDownMPE( message, logFile );
}
mem_span[0] = (float)pMPEParams->ptrRWBiasStat->mem_span1 ;
mem_span[1] = (float)pMPEParams->ptrRWBiasStat->mem_span2 ;
mem_span[2] = (float)pMPEParams->ptrRWBiasStat->mem_span3 ;
mem_span[3] = (float)pMPEParams->ptrRWBiasStat->mem_span4 ;
mem_span[4] = (float)pMPEParams->ptrRWBiasStat->mem_span5 ;
mem_span[5] = (float)pMPEParams->ptrRWBiasStat->mem_span6 ;
mem_span[6] = (float)pMPEParams->ptrRWBiasStat->mem_span7 ;
mem_span[7] = (float)pMPEParams->ptrRWBiasStat->mem_span8 ;
mem_span[8] = (float)pMPEParams->ptrRWBiasStat->mem_span9 ;
mem_span[9] = (float)pMPEParams->ptrRWBiasStat->mem_span10;
MPEFieldGen_read_daabiasdyn(radarID, pMPEParams->fxa_local_site, datetime,
lag_cut, num_pairs, sumGage,
sumRadar, bias, &lag, datetime1, &irc) ;
if((lag > 1) && (lag < lag_cut))
{
sprintf ( message , "daa state variables used are from %d hours ago", lag);
printMessage(message, logFile);
}
if(irc == 0)
{
sprintf ( message , "*** state variables read from database ***\n"
"index memspan num_pairs sumgage sumradar bias");
printMessage(message, logFile);
bias_long = bias[num_span - 1] ;
for(i = 0; i < num_span; i++)
{
sprintf ( message , "%5d %12.3f %7.1f %7.2f %7.2f %6.2f" ,
i, mem_span[i], num_pairs[i],
sumGage[i], sumRadar[i], bias[i]);
printMessage(message, logFile);
}
}
else
{
if(irc == 100)
{
sprintf ( message , "Records not found in DAABiasDyn table "
"between current date/time and date/time = %s"
" -- state variables reinitialized", datetime1);
}
else
{
sprintf ( message , "Database error %ld attempting select in "
"the DAABiasDyn table for date/time = %s"
" -- daa state variables reinitialized", irc, datetime1);
}
printMessage(message, logFile);
*meanBias = 1.0 ;
bias_long = 1.0 ;
sprintf ( message , "index memspan num_pairs sumgage sumradar bias");
printMessage(message, logFile);
for(i = 0; i < num_span; i++)
{
sumGage[i] = 0.0 ;
sumRadar[i] = 0.0 ;
num_pairs[i] = 0.0 ;
bias[i] = 1.0 ;
sprintf ( message , "%5d%12.3f %7.1f %7.2f %7.2f %6.2f" ,
i, mem_span[i], num_pairs[i],
sumGage[i], sumRadar[i], bias[i]);
printMessage(message, logFile);
}
}
/**
* if lag > lag_cut, then perform storm-by-storm reinitialization of
* spatial averages of positive gage and radar rainfall
**/
if(lag >= lag_cut)
{
for(i = 0; i < init_span; i++)
{
sumGage[i] = sumGage[init_span - 1] ;
sumRadar[i] = sumRadar[init_span - 1] ;
}
}
/**
* check gage/radar pairs for quality control
* bias_long is the bias value with longest memory span
**/
MPEFieldGen_gageRadarPairsQC(pMPEParams, bias_long, pGageRadarPairTable, &flag) ;
if(flag != 0)
{
sprintf ( message , "gage/radar pairs qc not done.");
printMessage(message, logFile);
}
/**
* update state variables
**/
MPEFieldGen_updateStateVariable(pMPEParams, mem_span, lag,
pGageRadarPairTable, sumGage, sumRadar, num_pairs) ;
/**
* compute the bias for each mem_span value
**/
for( i = 0; i < num_span; i++)
{
if((sumGage[i] == 0.0) || (sumRadar[i] == 0.0))
bias[i] = 1.0 ;
else
bias[i] = sumGage[i] / sumRadar[i] ;
}
/**
* compute the best bias
**/
*meanBias = 1.0 ;
for( i = 0; i < num_span; i++)
{
if(num_pairs[i] > pMPEParams->ptrRWBiasStat->npair_bias_select)
{
*meanBias = bias[i] ;
*memSpanBias = (double)mem_span[i] ;
break ;
}
}
/**
* write updated state variables back to DAABiasDyn table
**/
sprintf ( message , "computed bias = %5.2f\n"
"writing state variables to database.\n"
"index memspan num_pairs sumgage"
" sumradar bias", *meanBias );
printMessage(message, logFile);
for(i = 0; i < num_span; i++)
{
sprintf ( message , "%5d %12.3f %7.1f %7.2f %7.2f %6.2f" ,
i, mem_span[i], num_pairs[i],
sumGage[i], sumRadar[i], bias[i]);
printMessage(message, logFile);
}
write_daabiasdyn(radarID, pMPEParams->fxa_local_site, datetime,
num_span, num_pairs, sumGage, sumRadar, bias, &irc) ;
if(irc != 0)
{
sprintf ( message , "Database error %ld "
"attempting write to the DAABiasDyn table"
" for date = %s", irc, datetime);
printMessage(message, logFile);
}
if(mem_span != NULL)
{
free(mem_span) ;
mem_span = NULL ;
}
/* ============== Statements containing RCS keywords: */
{static char rcs_id1[] = "$Source: /fs/hseb/ob9e/ohd/pproc_lib/src/MPEFieldGen/RCS/calculateMeanBiasDP.c,v $";
static char rcs_id2[] = "$Id: calculateMeanBiasDP.c,v 1.1 2012/04/25 16:32:12 pst Exp $";}
/* =================================================== */
}

View file

@ -0,0 +1,236 @@
/*******************************************************************************
* FILENAME: createRDMosaic.c
*
* Purpose:
* creates mosaics of the raw radar data
* includes both dual-pol and single-pol radars
*
* calling function: runRDMosaic
* functions called: LatLongToHrap
*
* input variables
*
* pRadarLocRecord - data record from radarLoc table
*
* radar - two-dimensional radar data
*
* index - radar index data
*
* radarMiscBins - misc bin data
*
* pGeoData - global HRAP lowerleft-corner bin and dimension
* and dimension of the RFC estimation domain
*
* output variables
*
* RDMosaic - two-dimensional raw radar data
*
* MHeight - two-dimensional radar height data
*
*
********************************************************************************
*/
#include "mpe_fieldgen.h"
//Chip thinks the BUG is in here
void createRDMosaic(const radarLoc_record_struct * pRadarLocRecord,
float radar [ ] [ NUM_DPA_COLS ] ,
short int radarMiscBins [ ] [ NUM_DPA_COLS ],
const int index ,
const geo_data_struct * pGeoData ,
double ** RDMosaic ,
double ** MHeight,
int ** radarIDDP,
double ** MaxRDMosaic,
double ** AvgRDMosaic,
int ** AvgRDMosaicNumRadars,
int * blnMosaic)
{
static const char * fname = "mpe_radar_beam_height";
char beamheight_dir [PATH_LEN] = {'\0'};
static char * rfcwide_beamheight_dir_token = "rfcwide_beamheight_dir";
char station_file_path [ PATH_LEN + FNAME_LEN ] = {'\0'};
static double radar_beam_height [NUM_DPA_ROWS][NUM_DPA_COLS];
double row, col, pixelHeight = 0 ;
FILE * fp = NULL;
static int first = 1;
int intRow, intCol ;
int i, j ;
int length;
int status;
/**
* If this is the first call, load in the radar beam height data
* from the radar beam height file.
**/
if ( first == 1 )
{
first = 0;
getAppsDefaults ( rfcwide_beamheight_dir_token, beamheight_dir );
length = strlen ( beamheight_dir );
if ( length > 0 )
{
sprintf ( station_file_path, "%s/%s", beamheight_dir, fname );
}
else
{
sprintf ( message, "Token %s is no defined. Application will look "
"for the radar beam height file in the current "
"working directory.\n",
rfcwide_beamheight_dir_token );
printMessage ( message, logFile );
strcpy ( station_file_path, fname );
}
/* Write a log message indicating that the height file is about to
be read. */
getCurrentTime ( currTime );
sprintf ( message, "%s = time begin read radar height file.\n"
"radar height file=%s", currTime,
station_file_path );
printMessage ( message, logFile );
/* Attempt to open the height data file. */
fp = fopen ( station_file_path, "r" );
if ( fp == NULL )
{
/* Could not open the station file. */
sprintf ( message, "Could not open file %s. "
"Create radar height file and rerun "
"MPE Fieldgen.\n\tProgram exit.",
station_file_path );
shutDownMPE ( message, logFile );
}
status = fread ( radar_beam_height, sizeof(double), NUM_DPA_ELEMENTS,
fp );
fclose ( fp );
fp = NULL ;
if ( status != NUM_DPA_ELEMENTS )
{
sprintf ( message, "Error reading radar height file %s.\n"
"\tProgram exit.", station_file_path );
shutDownMPE ( message, logFile );
}
}
/**
* locate hrap pixel that radar is in
**/
LatLongToHrapByReference ( pRadarLocRecord->latitude ,
pRadarLocRecord->longitude ,
&row , &col ) ;
intCol = (int)col ;
intRow = (int)row ;
/**
* calculate starting hrap coordinants
**/
for(j = 0; j < NUM_DPA_COLS; j ++)
{
for(i = 0; i < NUM_DPA_COLS; i ++)
{
/**
* check radar pixel to make sure it exists,
* this check insures that the height array
* is dynamic and varies with radar availabilty.
**/
if(radar[i][j] < 0.0)
continue ;
/**
* compute location of radar pixel on national hrap grid,
* then check to make sure this point is in rfc area.
**/
int tmpRow = intRow - 65 + i ;
int tmpCol = intCol - 65 + j ;
/* Retrieve the pixel height. */
pixelHeight = radar_beam_height [ i ][ j ];
pixelHeight += pRadarLocRecord->elevation ;
/**
* check to make sure pixel height
* is less than that on mosaic.
*
* convert x,y coordinates to local
* coordinates of RMosaic
* and MHeight array
**/
tmpCol -= pGeoData->hrap_x ;
tmpRow -= pGeoData->hrap_y ;
if ((tmpCol < 0) || (tmpRow < 0))
continue ;
if ((tmpCol >= pGeoData->num_cols) ||
(tmpRow >= pGeoData->num_rows))
continue ;
if ((blnMosaic[rdmosaic] == 1) &&
(MHeight[tmpRow][tmpCol] == MOSAIC_DEFAULT ||
pixelHeight < MHeight[tmpRow][tmpCol]))
{
/**
* check to make sure pixel is not a radarMiscBins
* additional check for fake radarMiscBins data.
**/
if(radarMiscBins[i][j] < 0) continue ;
if(radarMiscBins[i][j] != 0)
{
RDMosaic[tmpRow][tmpCol] = (double)radar[i][j] ;
MHeight[tmpRow][tmpCol] = pixelHeight ;
radarIDDP[tmpRow][tmpCol] = index ;
}
}
// for the average and max mosaic calculations
// code added to calculate the average and max mosaics
// the following code just adds up the values for the average
// mosaic from each contributing radar. this is later on used
// by the code in the run_rdmosaic.c to calculate the real average
// by taking into account how many radars actually contributed.
// for the max mosaic, end of the radar loop would produce the
// final result
// -------------------------------
if(radarMiscBins[i][j] != 0)
{
if(blnMosaic[avgrdmosaic] == 1 && radar[i][j] != RADAR_DEFAULT)
{
if(AvgRDMosaic[tmpRow][tmpCol] != MOSAIC_DEFAULT)
{
AvgRDMosaic[tmpRow][tmpCol] += (double)radar[i][j];
}
else if(AvgRDMosaic[tmpRow][tmpCol] == MOSAIC_DEFAULT)
{
AvgRDMosaic[tmpRow][tmpCol] = (double)radar[i][j];
}
(AvgRDMosaicNumRadars[tmpRow][tmpCol])++;
}
if(blnMosaic[maxrdmosaic] == 1 &&
MaxRDMosaic[tmpRow][tmpCol] < (double)radar[i][j])
{
MaxRDMosaic[tmpRow][tmpCol] = (double)radar[i][j];
}
}
// -------------------------------
// end of ave and max mosaic code
}
}
/* ============== Statements containing RCS keywords: */
{static char rcs_id1[] = "$Source: /fs/hseb/ob9e/ohd/pproc_lib/src/MPEFieldGen/RCS/createRDMosaic.c,v $";
static char rcs_id2[] = "$Id: createRDMosaic.c,v 1.3 2012/08/23 16:48:09 pst Exp $";}
/* =================================================== */
}

View file

@ -204,7 +204,7 @@ void MPEFieldGen_gageRadarPairsQC(const mpe_params_struct * pMPEParams ,
}
}
}
else
else /* (npair < npair_stddev_test) */
{
slope = bias_long ;
b = 0.0 ;
@ -241,7 +241,8 @@ void MPEFieldGen_gageRadarPairsQC(const mpe_params_struct * pMPEParams ,
printMessage(message, logFile);
}
}
}
} /* (npair < npair_stddev_test) */
pGageRadarPairTable->pairNum = count;
}
} /* end MPEFieldGen_gageRadarPairsQC */

Some files were not shown because too many files have changed in this diff Show more