Skip to content

Commit

Permalink
Add new AMDAR options (#1148)
Browse files Browse the repository at this point in the history
Last one of the week, it adds in the ability to plot from Bill's new
AMDAR database.
  • Loading branch information
JeffHamiltonNOAA committed Jan 19, 2024
2 parents e2800cf + 1122756 commit f512f32
Show file tree
Hide file tree
Showing 24 changed files with 815 additions and 36 deletions.
2 changes: 1 addition & 1 deletion MATScommon
2 changes: 1 addition & 1 deletion METexpress
Submodule METexpress updated 1 files
+1 −1 MATScommon
6 changes: 4 additions & 2 deletions apps/upperair/server/dataFunctions/data_contour.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,12 @@ dataContour = function (plotParams, plotFunction) {
} else {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.GFS_Areg${region} as m1`;
}
} else if (database.includes("Vapor")) {
queryTableClause = queryTableClause.replace("_sums", "_vapor_sums");
}

let phaseClause = "";
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
const phaseStr = curve.phase;
const phaseOptionsMap = matsCollections.phase.findOne(
{ name: "phase" },
Expand Down Expand Up @@ -208,7 +210,7 @@ dataContour = function (plotParams, plotFunction) {
statement = statement.replace("{{phaseClause}}", phaseClause);
statement = statement.replace("{{dateClause}}", dateClause);
statement = statement.split("{{dateString}}").join(dateString);
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
// AMDAR tables have all partial sums so we can get them all from the main table
statement = statement.split("m1").join("m0");
}
Expand Down
6 changes: 4 additions & 2 deletions apps/upperair/server/dataFunctions/data_contour_diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,12 @@ dataContourDiff = function (plotParams, plotFunction) {
} else {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.GFS_Areg${region} as m1`;
}
} else if (database.includes("Vapor")) {
queryTableClause = queryTableClause.replace("_sums", "_vapor_sums");
}

let phaseClause = "";
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
const phaseStr = curve.phase;
const phaseOptionsMap = matsCollections.phase.findOne(
{ name: "phase" },
Expand Down Expand Up @@ -218,7 +220,7 @@ dataContourDiff = function (plotParams, plotFunction) {
statement = statement.replace("{{phaseClause}}", phaseClause);
statement = statement.replace("{{dateClause}}", dateClause);
statement = statement.split("{{dateString}}").join(dateString);
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
// AMDAR tables have all partial sums so we can get them all from the main table
statement = statement.split("m1").join("m0");
}
Expand Down
8 changes: 5 additions & 3 deletions apps/upperair/server/dataFunctions/data_dailymodelcycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ dataDailyModelCycle = function (plotParams, plotFunction) {
} else {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.GFS_Areg${region} as m1`;
}
} else if (database.includes("Vapor")) {
queryTableClause = queryTableClause.replace("_sums", "_vapor_sums");
}
} else {
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
throw new Error(
"Single/multi-station plotting is not supported by the AMDAR databse."
);
Expand Down Expand Up @@ -195,7 +197,7 @@ dataDailyModelCycle = function (plotParams, plotFunction) {
`group_concat(unix_timestamp(m0.date)+3600*m0.hour, ';', ${levelVar}, ';', ${variable[0]}, ';', ${NClause}, ';', ${variable[2]}, ';', ${variable[3]}, ';', ${variable[4]}, ';', ${variable[5]} order by unix_timestamp(m0.date)+3600*m0.hour, ${levelVar}) as sub_data, count(${variable[0]}) as N0`;

let phaseClause = "";
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
const phaseStr = curve.phase;
const phaseOptionsMap = matsCollections.phase.findOne(
{ name: "phase" },
Expand Down Expand Up @@ -256,7 +258,7 @@ dataDailyModelCycle = function (plotParams, plotFunction) {
statement = statement.replace("{{phaseClause}}", phaseClause);
statement = statement.replace("{{dateClause}}", dateClause);
statement = statement.replace("{{siteDateClause}}", siteDateClause);
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
// AMDAR tables have all partial sums so we can get them all from the main table
statement = statement.split("m1").join("m0");
}
Expand Down
8 changes: 5 additions & 3 deletions apps/upperair/server/dataFunctions/data_dieoff.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ dataDieoff = function (plotParams, plotFunction) {
} else {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.GFS_Areg${region} as m1`;
}
} else if (database.includes("Vapor")) {
queryTableClause = queryTableClause.replace("_sums", "_vapor_sums");
}
} else {
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
throw new Error(
"Single/multi-station plotting is not supported by the AMDAR databse."
);
Expand Down Expand Up @@ -214,7 +216,7 @@ dataDieoff = function (plotParams, plotFunction) {
`group_concat(unix_timestamp(m0.date)+3600*m0.hour, ';', ${levelVar}, ';', ${variable[0]}, ';', ${NClause}, ';', ${variable[2]}, ';', ${variable[3]}, ';', ${variable[4]}, ';', ${variable[5]} order by unix_timestamp(m0.date)+3600*m0.hour, ${levelVar}) as sub_data, count(${variable[0]}) as N0`;

let phaseClause = "";
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
const phaseStr = curve.phase;
const phaseOptionsMap = matsCollections.phase.findOne(
{ name: "phase" },
Expand Down Expand Up @@ -277,7 +279,7 @@ dataDieoff = function (plotParams, plotFunction) {
statement = statement.replace("{{phaseClause}}", phaseClause);
statement = statement.replace("{{dateClause}}", dateClause);
statement = statement.replace("{{siteDateClause}}", siteDateClause);
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
// AMDAR tables have all partial sums so we can get them all from the main table
statement = statement.split("m1").join("m0");
}
Expand Down
8 changes: 5 additions & 3 deletions apps/upperair/server/dataFunctions/data_histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ dataHistogram = function (plotParams, plotFunction) {
} else {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.GFS_Areg${region} as m1`;
}
} else if (database.includes("Vapor")) {
queryTableClause = queryTableClause.replace("_sums", "_vapor_sums");
}
} else {
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
throw new Error(
"Single/multi-station plotting is not supported by the AMDAR databse."
);
Expand Down Expand Up @@ -194,7 +196,7 @@ dataHistogram = function (plotParams, plotFunction) {
`group_concat(unix_timestamp(m0.date)+3600*m0.hour, ';', ${levelVar}, ';', ${variable[0]}, ';', ${NClause}, ';', ${variable[2]}, ';', ${variable[3]}, ';', ${variable[4]}, ';', ${variable[5]} order by unix_timestamp(m0.date)+3600*m0.hour, ${levelVar}) as sub_data, count(${variable[0]}) as N0`;

let phaseClause = "";
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
const phaseStr = curve.phase;
const phaseOptionsMap = matsCollections.phase.findOne(
{ name: "phase" },
Expand Down Expand Up @@ -258,7 +260,7 @@ dataHistogram = function (plotParams, plotFunction) {
statement = statement.replace("{{phaseClause}}", phaseClause);
statement = statement.replace("{{dateClause}}", dateClause);
statement = statement.replace("{{siteDateClause}}", siteDateClause);
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
// AMDAR tables have all partial sums so we can get them all from the main table
statement = statement.split("m1").join("m0");
}
Expand Down
2 changes: 1 addition & 1 deletion apps/upperair/server/dataFunctions/data_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ dataMap = function (plotParams, plotFunction) {

let sitesClause = "";

if (database === "AMDAR") {
if (database.includes("AMDAR")) {
throw new Error(
"Single/multi-station plotting is not supported by the AMDAR databse."
);
Expand Down
8 changes: 5 additions & 3 deletions apps/upperair/server/dataFunctions/data_profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ dataProfile = function (plotParams, plotFunction) {
} else {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.GFS_Areg${region} as m1`;
}
} else if (database.includes("Vapor")) {
queryTableClause = queryTableClause.replace("_sums", "_vapor_sums");
}
} else {
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
throw new Error(
"Single/multi-station plotting is not supported by the AMDAR databse."
);
Expand Down Expand Up @@ -192,7 +194,7 @@ dataProfile = function (plotParams, plotFunction) {
`group_concat(unix_timestamp(m0.date)+3600*m0.hour, ';', ${levelVar}, ';', ${variable[0]}, ';', ${NClause}, ';', ${variable[2]}, ';', ${variable[3]}, ';', ${variable[4]}, ';', ${variable[5]} order by unix_timestamp(m0.date)+3600*m0.hour, ${levelVar}) as sub_data, count(${variable[0]}) as N0`;

let phaseClause = "";
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
const phaseStr = curve.phase;
const phaseOptionsMap = matsCollections.phase.findOne(
{ name: "phase" },
Expand Down Expand Up @@ -254,7 +256,7 @@ dataProfile = function (plotParams, plotFunction) {
statement = statement.replace("{{phaseClause}}", phaseClause);
statement = statement.replace("{{dateClause}}", dateClause);
statement = statement.replace("{{siteDateClause}}", siteDateClause);
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
// AMDAR tables have all partial sums so we can get them all from the main table
statement = statement.split("m1").join("m0");
}
Expand Down
8 changes: 5 additions & 3 deletions apps/upperair/server/dataFunctions/data_series.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@ dataSeries = function (plotParams, plotFunction) {
} else {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.GFS_Areg${region} as m1`;
}
} else if (database.includes("Vapor")) {
queryTableClause = queryTableClause.replace("_sums", "_vapor_sums");
}
} else {
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
throw new Error(
"Single/multi-station plotting is not supported by the AMDAR databse."
);
Expand Down Expand Up @@ -200,7 +202,7 @@ dataSeries = function (plotParams, plotFunction) {
`group_concat(unix_timestamp(m0.date)+3600*m0.hour, ';', ${levelVar}, ';', ${variable[0]}, ';', ${NClause}, ';', ${variable[2]}, ';', ${variable[3]}, ';', ${variable[4]}, ';', ${variable[5]} order by unix_timestamp(m0.date)+3600*m0.hour, ${levelVar}) as sub_data, count(${variable[0]}) as N0`;

let phaseClause = "";
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
const phaseStr = curve.phase;
const phaseOptionsMap = matsCollections.phase.findOne(
{ name: "phase" },
Expand Down Expand Up @@ -262,7 +264,7 @@ dataSeries = function (plotParams, plotFunction) {
statement = statement.replace("{{phaseClause}}", phaseClause);
statement = statement.replace("{{dateClause}}", dateClause);
statement = statement.replace("{{siteDateClause}}", siteDateClause);
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
// AMDAR tables have all partial sums so we can get them all from the main table
statement = statement.split("m1").join("m0");
}
Expand Down
6 changes: 4 additions & 2 deletions apps/upperair/server/dataFunctions/data_simple_scatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ dataSimpleScatter = function (plotParams, plotFunction) {
}

let phaseClause = "";
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
const phaseStr = curve.phase;
const phaseOptionsMap = matsCollections.phase.findOne(
{ name: "phase" },
Expand Down Expand Up @@ -174,6 +174,8 @@ dataSimpleScatter = function (plotParams, plotFunction) {
} else {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.GFS_Areg${region} as m1`;
}
} else if (database.includes("Vapor")) {
queryTableClause = queryTableClause.replace("_sums", "_vapor_sums");
}

const { statVarUnitMap } = matsCollections.variable.findOne(
Expand Down Expand Up @@ -218,7 +220,7 @@ dataSimpleScatter = function (plotParams, plotFunction) {
statement = statement.replace("{{phaseClause}}", phaseClause);
statement = statement.replace("{{dateClause}}", dateClause);
statement = statement.split("{{dateString}}").join(dateString);
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
// AMDAR tables have all partial sums so we can get them all from the main table
statement = statement.split("m1").join("m0");
}
Expand Down
8 changes: 5 additions & 3 deletions apps/upperair/server/dataFunctions/data_validtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ dataValidTime = function (plotParams, plotFunction) {
} else {
queryTableClause = `${queryTableClause}, ${databaseRef.sumsDB}.GFS_Areg${region} as m1`;
}
} else if (database.includes("Vapor")) {
queryTableClause = queryTableClause.replace("_sums", "_vapor_sums");
}
} else {
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
throw new Error(
"Single/multi-station plotting is not supported by the AMDAR databse."
);
Expand Down Expand Up @@ -187,7 +189,7 @@ dataValidTime = function (plotParams, plotFunction) {
`group_concat(unix_timestamp(m0.date)+3600*m0.hour, ';', ${levelVar}, ';', ${variable[0]}, ';', ${NClause}, ';', ${variable[2]}, ';', ${variable[3]}, ';', ${variable[4]}, ';', ${variable[5]} order by unix_timestamp(m0.date)+3600*m0.hour, ${levelVar}) as sub_data, count(${variable[0]}) as N0`;

let phaseClause = "";
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
const phaseStr = curve.phase;
const phaseOptionsMap = matsCollections.phase.findOne(
{ name: "phase" },
Expand Down Expand Up @@ -246,7 +248,7 @@ dataValidTime = function (plotParams, plotFunction) {
statement = statement.replace("{{phaseClause}}", phaseClause);
statement = statement.replace("{{dateClause}}", dateClause);
statement = statement.replace("{{siteDateClause}}", siteDateClause);
if (database === "AMDAR") {
if (database.includes("AMDAR")) {
// AMDAR tables have all partial sums so we can get them all from the main table
statement = statement.split("m1").join("m0");
}
Expand Down
7 changes: 6 additions & 1 deletion apps/upperair/server/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ import {
const dbNames = {
"RAOBs (Traditional)": { modelDB: "ruc_ua", sumsDB: "ruc_ua_sums2" },
"RAOBs (GDAS)": { modelDB: "ruc_ua_pb", sumsDB: "ruc_ua_pb_sums2" },
AMDAR: { modelDB: "acars_RR2", sumsDB: "acars_RR2" },
"AMDAR (Traditional)": { modelDB: "acars_RR2", sumsDB: "acars_RR2" },
"AMDAR (GDAS)": { modelDB: "pb_amdar", sumsDB: "pb_amdar" },
"AMDAR (GDAS; Only Obs That Include Vapor)": {
modelDB: "pb_amdar",
sumsDB: "pb_amdar",
},
};
const dbs = Object.keys(dbNames);

Expand Down
Loading

0 comments on commit f512f32

Please sign in to comment.