Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various scorecard bug fixes #1181

Merged
merged 6 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion METexpress
Submodule METexpress updated 1 files
+1 −1 MATScommon
36 changes: 7 additions & 29 deletions apps/scorecard/server/dataFunctions/processScorecard.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,16 @@ const dealWithUATables = function (
// get obs partial sums from the GFS
secondaryModelOption = `, ${databaseValue}.GFS_Areg${regionValue} as m1`;
}
// RAOB tables don't have phases, but we use the clause to facilitate the table join
// facilitate the table join
updatedQueryTemplate = updatedQueryTemplate.replace(
/\{\{phaseClause\}\}/g,
/\{\{joinClause\}\}/g,
"AND m0.date = m1.date AND m0.hour = m1.hour AND m0.mb10 = m1.mb10"
);
} else {
// AMDAR tables have all partial sums so we can get them all from the main table
updatedQueryTemplate = updatedQueryTemplate.replace(/m1/g, "m0");
// AMDAR tables have phases
updatedQueryTemplate = updatedQueryTemplate.replace(
/\{\{phaseClause\}\}/g,
"AND m0.up_dn = 2"
);
// no need to join
updatedQueryTemplate = updatedQueryTemplate.replace(/\{\{joinClause\}\}/g, "");
}
// either add the m1 clause to the template or remove the secondary model option entirely
updatedQueryTemplate = updatedQueryTemplate.replace(
Expand Down Expand Up @@ -179,28 +176,6 @@ processScorecard = function (plotParams, plotFunction) {
dateRange = plotParams.dates;
}

// get the union of the fcst-length arrays of all the curves
const fcstLengthsSet = new Set();
plotParams.curves.forEach(function (curve) {
if (!curve["forecast-length"]) {
fcstLengthsSet.add("0");
} else {
curve["forecast-length"].forEach(function (fcl) {
fcstLengthsSet.add(fcl);
});
}
});
const fcstLengths = Array.from(fcstLengthsSet);

// get the union of all the regions of all the curves
const regionsSet = new Set();
plotParams.curves.forEach(function (curve) {
curve.region.forEach(function (r) {
regionsSet.add(r);
});
});
const regions = Array.from(regionsSet);

// create an id for the document
let idDateRange = dateRange.replace(/ /g, "_");
idDateRange = idDateRange.replace(/:/g, "_");
Expand Down Expand Up @@ -386,6 +361,9 @@ processScorecard = function (plotParams, plotFunction) {

// create the empty object for this block
const { label } = curve;
const fcstLengths =
curve["forecast-length"] === undefined ? [] : curve["forecast-length"];
const regions = curve.region === undefined ? [] : curve.region;

// duplicate the curve so we're not modifying a function parameter, which the linter doesn't like
const scorecardCurve = curve;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ SELECT unix_timestamp(m0.date)+3600*m0.hour AS avtime,
AND m0.hour IN({{validTimes}})
AND m0.fcst_len = {{forecastLength}}
AND m0.mb10*10 = {{level}}
{{phaseClause}}
{{joinClause}}
GROUP BY avtime
ORDER BY avtime;
6 changes: 3 additions & 3 deletions apps/scorecard/server/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ const doPlotParams = function () {
type: matsTypes.InputTypes.radioGroup,
options: ["RedGreen", "RedBlue"],
controlButtonCovered: false,
default: "RedGreen",
default: "RedBlue",
controlButtonVisibility: "block",
displayOrder: 1,
displayPriority: 1,
Expand Down Expand Up @@ -574,7 +574,7 @@ const doPlotParams = function () {
controlButtonCovered: true,
controlButtonText: " ",
controlButtonFA: "fa-sm fa-solid fa-caret-up",
default: "#00ff00",
default: "#0000ff",
controlButtonVisibility: "block",
displayOrder: 4,
displayPriority: 1,
Expand All @@ -599,7 +599,7 @@ const doPlotParams = function () {
controlButtonCovered: true,
controlButtonText: " ",
controlButtonFA: "fa-xl fa-solid fa-caret-up",
default: "#00ff00",
default: "#0000ff",
controlButtonVisibility: "block",
displayOrder: 5,
displayPriority: 1,
Expand Down
Loading