Skip to content

Commit

Permalink
Don't join main GSL models with other tables (#1190)
Browse files Browse the repository at this point in the history
Most of our upper air RAOB tables need to be joined with the GFS or
other models to fill in missing obs sums. However, this is unnecessary
for the lab's primary models. This PR excludes those models.
  • Loading branch information
JeffHamiltonNOAA committed May 24, 2024
2 parents 1ab7409 + 991a0d0 commit 86aa86f
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 9 deletions.
6 changes: 5 additions & 1 deletion apps/upperair/server/dataFunctions/data_contour.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ dataContour = function (plotParams, plotFunction) {
// Most of the RAOBs tables don't store a model sum or an obs sum for some reason.
// So, we get the obs sum from HRRR_OPS, HRRR_HI, or GFS, because the obs are the same across all models.
// Then we get the model sum by adding the obs sum to the bias sum (bias = model-obs).
if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
// We exclude GSL's main models, which do have all the sums.
const modelsToExclude = ["ncep_oper_Areg", "RAP_130_Areg", "RAP_Areg", "HRRR_Areg"];
if (modelsToExclude.includes(model)) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.${model}${region} as m1`;
} else if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_OPS_Areg${region} as m1`;
} else if (region.toString() === "19") {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_HI_Areg${region} as m1`;
Expand Down
11 changes: 10 additions & 1 deletion apps/upperair/server/dataFunctions/data_contour_diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,16 @@ dataContourDiff = function (plotParams, plotFunction) {
// Most of the RAOBs tables don't store a model sum or an obs sum for some reason.
// So, we get the obs sum from HRRR_OPS, HRRR_HI, or GFS, because the obs are the same across all models.
// Then we get the model sum by adding the obs sum to the bias sum (bias = model-obs).
if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
// We exclude GSL's main models, which do have all the sums.
const modelsToExclude = [
"ncep_oper_Areg",
"RAP_130_Areg",
"RAP_Areg",
"HRRR_Areg",
];
if (modelsToExclude.includes(model)) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.${model}${region} as m1`;
} else if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_OPS_Areg${region} as m1`;
} else if (region.toString() === "19") {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_HI_Areg${region} as m1`;
Expand Down
11 changes: 10 additions & 1 deletion apps/upperair/server/dataFunctions/data_dailymodelcycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,16 @@ dataDailyModelCycle = function (plotParams, plotFunction) {
// Most of the RAOBs tables don't store a model sum or an obs sum for some reason.
// So, we get the obs sum from HRRR_OPS, HRRR_HI, or GFS, because the obs are the same across all models.
// Then we get the model sum by adding the obs sum to the bias sum (bias = model-obs).
if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
// We exclude GSL's main models, which do have all the sums.
const modelsToExclude = [
"ncep_oper_Areg",
"RAP_130_Areg",
"RAP_Areg",
"HRRR_Areg",
];
if (modelsToExclude.includes(model)) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.${model}${region} as m1`;
} else if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_OPS_Areg${region} as m1`;
} else if (region.toString() === "19") {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_HI_Areg${region} as m1`;
Expand Down
11 changes: 10 additions & 1 deletion apps/upperair/server/dataFunctions/data_dieoff.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,16 @@ dataDieoff = function (plotParams, plotFunction) {
// Most of the RAOBs tables don't store a model sum or an obs sum for some reason.
// So, we get the obs sum from HRRR_OPS, HRRR_HI, or GFS, because the obs are the same across all models.
// Then we get the model sum by adding the obs sum to the bias sum (bias = model-obs).
if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
// We exclude GSL's main models, which do have all the sums.
const modelsToExclude = [
"ncep_oper_Areg",
"RAP_130_Areg",
"RAP_Areg",
"HRRR_Areg",
];
if (modelsToExclude.includes(model)) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.${model}${region} as m1`;
} else if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_OPS_Areg${region} as m1`;
} else if (region.toString() === "19") {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_HI_Areg${region} as m1`;
Expand Down
11 changes: 10 additions & 1 deletion apps/upperair/server/dataFunctions/data_histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,16 @@ dataHistogram = function (plotParams, plotFunction) {
// Most of the RAOBs tables don't store a model sum or an obs sum for some reason.
// So, we get the obs sum from HRRR_OPS, HRRR_HI, or GFS, because the obs are the same across all models.
// Then we get the model sum by adding the obs sum to the bias sum (bias = model-obs).
if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
// We exclude GSL's main models, which do have all the sums.
const modelsToExclude = [
"ncep_oper_Areg",
"RAP_130_Areg",
"RAP_Areg",
"HRRR_Areg",
];
if (modelsToExclude.includes(model)) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.${model}${region} as m1`;
} else if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_OPS_Areg${region} as m1`;
} else if (region.toString() === "19") {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_HI_Areg${region} as m1`;
Expand Down
11 changes: 10 additions & 1 deletion apps/upperair/server/dataFunctions/data_profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,16 @@ dataProfile = function (plotParams, plotFunction) {
// Most of the RAOBs tables don't store a model sum or an obs sum for some reason.
// So, we get the obs sum from HRRR_OPS, HRRR_HI, or GFS, because the obs are the same across all models.
// Then we get the model sum by adding the obs sum to the bias sum (bias = model-obs).
if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
// We exclude GSL's main models, which do have all the sums.
const modelsToExclude = [
"ncep_oper_Areg",
"RAP_130_Areg",
"RAP_Areg",
"HRRR_Areg",
];
if (modelsToExclude.includes(model)) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.${model}${region} as m1`;
} else if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_OPS_Areg${region} as m1`;
} else if (region.toString() === "19") {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_HI_Areg${region} as m1`;
Expand Down
11 changes: 10 additions & 1 deletion apps/upperair/server/dataFunctions/data_series.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,16 @@ dataSeries = function (plotParams, plotFunction) {
// Most of the RAOBs tables don't store a model sum or an obs sum for some reason.
// So, we get the obs sum from HRRR_OPS, HRRR_HI, or GFS, because the obs are the same across all models.
// Then we get the model sum by adding the obs sum to the bias sum (bias = model-obs).
if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
// We exclude GSL's main models, which do have all the sums.
const modelsToExclude = [
"ncep_oper_Areg",
"RAP_130_Areg",
"RAP_Areg",
"HRRR_Areg",
];
if (modelsToExclude.includes(model)) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.${model}${region} as m1`;
} else if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_OPS_Areg${region} as m1`;
} else if (region.toString() === "19") {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_HI_Areg${region} as m1`;
Expand Down
11 changes: 10 additions & 1 deletion apps/upperair/server/dataFunctions/data_simple_scatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,16 @@ dataSimpleScatter = function (plotParams, plotFunction) {
// Most of the RAOBs tables don't store a model sum or an obs sum for some reason.
// So, we get the obs sum from HRRR_OPS, HRRR_HI, or GFS, because the obs are the same across all models.
// Then we get the model sum by adding the obs sum to the bias sum (bias = model-obs).
if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
// We exclude GSL's main models, which do have all the sums.
const modelsToExclude = [
"ncep_oper_Areg",
"RAP_130_Areg",
"RAP_Areg",
"HRRR_Areg",
];
if (modelsToExclude.includes(model)) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.${model}${region} as m1`;
} else if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_OPS_Areg${region} as m1`;
} else if (region.toString() === "19") {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_HI_Areg${region} as m1`;
Expand Down
11 changes: 10 additions & 1 deletion apps/upperair/server/dataFunctions/data_validtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,16 @@ dataValidTime = function (plotParams, plotFunction) {
// Most of the RAOBs tables don't store a model sum or an obs sum for some reason.
// So, we get the obs sum from HRRR_OPS, HRRR_HI, or GFS, because the obs are the same across all models.
// Then we get the model sum by adding the obs sum to the bias sum (bias = model-obs).
if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
// We exclude GSL's main models, which do have all the sums.
const modelsToExclude = [
"ncep_oper_Areg",
"RAP_130_Areg",
"RAP_Areg",
"HRRR_Areg",
];
if (modelsToExclude.includes(model)) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.${model}${region} as m1`;
} else if (["5", "14", "15", "16", "17", "18"].includes(region.toString())) {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_OPS_Areg${region} as m1`;
} else if (region.toString() === "19") {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.HRRR_HI_Areg${region} as m1`;
Expand Down

0 comments on commit 86aa86f

Please sign in to comment.