diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GatherLevelNode.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GatherLevelNode.java
index ef729cd8b0..991dfd5d0b 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GatherLevelNode.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GatherLevelNode.java
@@ -20,37 +20,45 @@
package com.raytheon.viz.grid.inv;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import com.raytheon.uf.common.inventory.data.AbstractRequestableData;
-import com.raytheon.uf.common.inventory.data.AggregateRequestableData;
-import com.raytheon.uf.common.inventory.exception.DataCubeException;
-import com.raytheon.uf.common.inventory.TimeAndSpace;
-import com.raytheon.uf.common.inventory.tree.AbstractRequestableNode;
+import com.raytheon.uf.common.dataplugin.grid.GridConstants;
import com.raytheon.uf.common.dataplugin.level.Level;
+import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
+import com.raytheon.uf.common.derivparam.inv.AvailabilityContainer;
+import com.raytheon.uf.common.derivparam.inv.MetadataContainer;
import com.raytheon.uf.common.derivparam.library.DerivParamDesc;
import com.raytheon.uf.common.derivparam.library.DerivParamMethod;
import com.raytheon.uf.common.derivparam.tree.AbstractAliasLevelNode;
+import com.raytheon.uf.common.inventory.TimeAndSpace;
+import com.raytheon.uf.common.inventory.data.AbstractRequestableData;
+import com.raytheon.uf.common.inventory.data.AggregateRequestableData;
+import com.raytheon.uf.common.inventory.exception.DataCubeException;
+import com.raytheon.uf.common.inventory.tree.AbstractRequestableNode;
+import com.raytheon.uf.viz.core.exception.VizException;
/**
*
- * Builds AggregateRecords which contain all perturbations for a given record
+ * Builds AggregateRecords which contain all perturbations for a specific
+ * parameter/level of an ensemble model.
*
*
*
* SOFTWARE HISTORY
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Feb 26, 2010 bsteffen Initial creation
+ * Date Ticket# Engineer Description
+ * ------------- -------- --------- --------------------------
+ * Feb 26, 2010 bsteffen Initial creation
+ * Oct 09, 2015 4931 bsteffen Do separate requests each distinct
+ * ensemble_id
*
*
*
* @author bsteffen
- * @version 1.0
*/
public class GatherLevelNode extends AbstractAliasLevelNode {
@@ -64,20 +72,56 @@ public class GatherLevelNode extends AbstractAliasLevelNode {
super(sourceNode, desc, method, modelName, level);
}
+ @Override
+ public Map> getDataDependency(
+ Set times, AvailabilityContainer container) {
+ /*
+ * The MetadataContainer cannot handle the dependencies because we must
+ * add an ensemble_id constraint so return that there is no dependency
+ * and instead request needed data in getData()
+ */
+ return Collections.emptyMap();
+ }
+
@Override
public Set getData(
Set availability,
Map> dependencyData)
throws DataCubeException {
+ return gatherData(availability, getRequestConstraints());
+ }
+
+ /**
+ * This method can be used in place of {@link #getData(Set, Map)} to
+ * retrieve the data for this node. Since this node must perform separate
+ * request for each distinct ensemble_id that is being gathered, the
+ * dependency data that is normally passed to getData is unnecessary. This
+ * method takes in some original constraints which will be passed along in
+ * case the original query had additional constraints not handled normally
+ * by derived parameters(For example Secondary Id)
+ */
+ public Set gatherData(
+ Set availability,
+ Map originalConstraints)
+ throws DataCubeException {
Map> availMap = new HashMap>();
- for (AbstractRequestableData data : dependencyData.get(sourceNode)) {
- TimeAndSpace ast = data.getTimeAndSpace();
- List avail = availMap.get(ast);
- if (avail == null) {
- avail = new ArrayList();
- availMap.put(ast, avail);
+ for (String member : getSourceEnsembles()) {
+ Map constraints = new HashMap<>(
+ originalConstraints);
+ constraints.put(GridConstants.ENSEMBLE_ID, new RequestConstraint(
+ member));
+ MetadataContainer container = new GridMetadataContainer(
+ constraints, new AvailabilityContainer(constraints));
+ for (AbstractRequestableData data : container.getData(sourceNode,
+ availability)) {
+ TimeAndSpace ast = data.getTimeAndSpace();
+ List avail = availMap.get(ast);
+ if (avail == null) {
+ avail = new ArrayList();
+ availMap.put(ast, avail);
+ }
+ avail.add(data);
}
- avail.add(data);
}
Set result = new HashSet();
for (List records : availMap.values()) {
@@ -89,6 +133,38 @@ public class GatherLevelNode extends AbstractAliasLevelNode {
return result;
}
+ /**
+ * @return the {@link List} of ensemble_ids that this node is gathering.
+ */
+ protected List getSourceEnsembles() throws DataCubeException {
+ try {
+ return GridInventory.getEnsembles(sourceNode);
+ } catch (VizException e) {
+ throw new DataCubeException(e);
+ }
+ }
+
+ /**
+ * @return the request constraint map that can be used for requesting all
+ * data for this node.
+ */
+ protected Map getRequestConstraints() {
+ Map constraints = new HashMap<>();
+ constraints.put(GridConstants.PLUGIN_NAME, new RequestConstraint(
+ GridConstants.GRID));
+ constraints.put(GridConstants.DATASET_ID, new RequestConstraint(
+ getModelName()));
+ constraints.put(GridConstants.PARAMETER_ABBREVIATION,
+ new RequestConstraint(getDesc().getAbbreviation()));
+ constraints.put(GridConstants.MASTER_LEVEL_NAME, new RequestConstraint(
+ getLevel().getMasterLevel().getName()));
+ constraints.put(GridConstants.LEVEL_ONE, new RequestConstraint(
+ getLevel().getLevelOneValueAsString()));
+ constraints.put(GridConstants.LEVEL_TWO, new RequestConstraint(
+ getLevel().getLevelTwoValueAsString()));
+ return constraints;
+ }
+
@Override
public GatherLevelNode clone() {
return new GatherLevelNode(this);
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/GH_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/GH_perts.xml
index 7c30200e4e..ae6fcd86e0 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/GH_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/GH_perts.xml
@@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/MnT_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/MnT_perts.xml
index 8a5d3e9446..cd2e3fd7d3 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/MnT_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/MnT_perts.xml
@@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/MxT_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/MxT_perts.xml
index 5cb54b3898..f831b44ec5 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/MxT_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/MxT_perts.xml
@@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/RH_001_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/RH_001_perts.xml
index 55d45ac3cc..36c271f19c 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/RH_001_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/RH_001_perts.xml
@@ -19,7 +19,7 @@
AWIPS II NEW FILE - RH_001_perts.xml
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/RH_002_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/RH_002_perts.xml
index 3f55f47edd..2f2b45cbb3 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/RH_002_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/RH_002_perts.xml
@@ -19,7 +19,7 @@
AWIPS II NEW FILE - RH_002_perts.xml
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/RH_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/RH_perts.xml
index d2ec1d5511..9d548aa3ba 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/RH_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/RH_perts.xml
@@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TP24hr_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TP24hr_perts.xml
index 0b1ce1d2ab..65fd4cf58f 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TP24hr_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TP24hr_perts.xml
@@ -23,7 +23,7 @@
AWIPS II NEW FILE - TP24hr_perts.xml
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TP6hr_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TP6hr_perts.xml
index 3fcbbd8e46..04ad3bbb09 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TP6hr_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TP6hr_perts.xml
@@ -18,7 +18,7 @@
AWIPS II NEW FILE - TP6hr_perts.xml
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TP_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TP_perts.xml
index 0cc53a50ea..e1a12c7acc 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TP_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TP_perts.xml
@@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TPrun_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TPrun_perts.xml
index 7fc7715f6d..41d4e367e4 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TPrun_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/TPrun_perts.xml
@@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/T_001_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/T_001_perts.xml
index bff92f9776..4b97e2144c 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/T_001_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/T_001_perts.xml
@@ -15,7 +15,7 @@
NEW FILE - T_001_perts.xml
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/T_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/T_perts.xml
index aafadd4113..703d48f0b9 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/T_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/T_perts.xml
@@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/Wind_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/Wind_perts.xml
index 4e126cbbdc..e772b28b2f 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/Wind_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/Wind_perts.xml
@@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/msl-P_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/msl-P_perts.xml
index 6c8b74024b..57cd8b67a1 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/msl-P_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/msl-P_perts.xml
@@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_001_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_001_perts.xml
index 75218ddf88..21ed4f0364 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_001_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_001_perts.xml
@@ -19,7 +19,7 @@
AWIPS II NEW FILE - wSp_001_perts.xml
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_002_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_002_perts.xml
index 1589c2ee0f..cff3da76fb 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_002_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_002_perts.xml
@@ -21,7 +21,7 @@
AWIPS II NEW FILE - wSp_002_perts.xml
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_003_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_003_perts.xml
index 9fc7dc28a4..db3baa9601 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_003_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_003_perts.xml
@@ -19,7 +19,7 @@
AWIPS II NEW FILE - wSp_003_perts.xml
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_004_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_004_perts.xml
index cf3d911d6a..13755904c8 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_004_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_004_perts.xml
@@ -19,7 +19,7 @@
AWIPS II NEW FILE - wSp_004_perts.xml
-->
-
+
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_perts.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_perts.xml
index e60ac5ceb1..3319a44114 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_perts.xml
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/derivedParameters/definitions/wSp_perts.xml
@@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
-
+