From fce69884392ba2cd5c1cbcac19011598a76e19c1 Mon Sep 17 00:00:00 2001 From: Molly Smith Date: Fri, 15 Nov 2024 07:52:26 -0700 Subject: [PATCH] Feature met cyclone improvements (#163) This PR improves the matching algorithm for MET Cyclone by having it match by storm_id as well as time. It also correctly filters out missing values in the MET Cyclone data, and makes error bar thickness customizable. --- MATScommon | 2 +- .../server/dataFunctions/data_dieoff.js | 4 ++-- .../server/dataFunctions/data_histogram.js | 4 ++-- .../server/dataFunctions/data_series.js | 4 ++-- .../server/dataFunctions/data_validtime.js | 4 ++-- .../server/dataFunctions/data_yeartoyear.js | 4 ++-- apps/met-cyclone/server/main.js | 14 +++++++------- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/MATScommon b/MATScommon index 3a28a7dfe..76a4ef62e 160000 --- a/MATScommon +++ b/MATScommon @@ -1 +1 @@ -Subproject commit 3a28a7dfec83697ae291c1ea524dcac0d4955a24 +Subproject commit 76a4ef62eacfc040fb674d5bdb22b049163522f6 diff --git a/apps/met-cyclone/server/dataFunctions/data_dieoff.js b/apps/met-cyclone/server/dataFunctions/data_dieoff.js index 041e45683..00c970b7e 100644 --- a/apps/met-cyclone/server/dataFunctions/data_dieoff.js +++ b/apps/met-cyclone/server/dataFunctions/data_dieoff.js @@ -22,7 +22,7 @@ dataDieoff = function (plotParams, plotFunction) { completeness: plotParams.completeness, outliers: plotParams.outliers, hideGaps: plotParams.noGapsCheck, - hasLevels: false, + hasLevels: true, }; const dataRequests = {}; // used to store data queries const queryArray = []; @@ -100,7 +100,7 @@ dataDieoff = function (plotParams, plotFunction) { thresholdClause = `and h.fcst_thresh = '${threshold}'`; } else if (statLineType === "precalculated") { // set up fields specific to precalculated stats - statisticClause = `avg(${statisticOptionsMap[statistic][2]}) as stat, group_concat(distinct ${statisticOptionsMap[statistic][2]}, ';', 9999, ';', unix_timestamp(ld.fcst_valid) order by unix_timestamp(ld.fcst_valid)) as sub_data`; + statisticClause = `avg(${statisticOptionsMap[statistic][2]}) as stat, group_concat(distinct ${statisticOptionsMap[statistic][2]}, ';', 9999, ';', unix_timestamp(ld.fcst_valid), ';', h.storm_id order by unix_timestamp(ld.fcst_valid), h.storm_id) as sub_data`; statHeaderType = "tcst_header"; [, lineDataType] = statisticOptionsMap[statistic]; modelClause = `and h.amodel = '${model}'`; diff --git a/apps/met-cyclone/server/dataFunctions/data_histogram.js b/apps/met-cyclone/server/dataFunctions/data_histogram.js index 18d53365a..09ea7fcf2 100644 --- a/apps/met-cyclone/server/dataFunctions/data_histogram.js +++ b/apps/met-cyclone/server/dataFunctions/data_histogram.js @@ -20,7 +20,7 @@ dataHistogram = function (plotParams, plotFunction) { completeness: plotParams.completeness, outliers: plotParams.outliers, hideGaps: plotParams.noGapsCheck, - hasLevels: false, + hasLevels: true, }; const alreadyMatched = false; const dataRequests = {}; // used to store data queries @@ -102,7 +102,7 @@ dataHistogram = function (plotParams, plotFunction) { thresholdClause = `and h.fcst_thresh = '${threshold}'`; } else if (statLineType === "precalculated") { // set up fields specific to precalculated stats - statisticClause = `avg(${statisticOptionsMap[statistic][2]}) as stat, group_concat(distinct ${statisticOptionsMap[statistic][2]}, ';', 9999, ';', unix_timestamp(ld.fcst_valid) order by unix_timestamp(ld.fcst_valid)) as sub_data`; + statisticClause = `avg(${statisticOptionsMap[statistic][2]}) as stat, group_concat(distinct ${statisticOptionsMap[statistic][2]}, ';', 9999, ';', unix_timestamp(ld.fcst_valid), ';', h.storm_id order by unix_timestamp(ld.fcst_valid), h.storm_id) as sub_data`; statHeaderType = "tcst_header"; [, lineDataType] = statisticOptionsMap[statistic]; modelClause = `and h.amodel = '${model}'`; diff --git a/apps/met-cyclone/server/dataFunctions/data_series.js b/apps/met-cyclone/server/dataFunctions/data_series.js index 1f57da93e..06f86d64c 100644 --- a/apps/met-cyclone/server/dataFunctions/data_series.js +++ b/apps/met-cyclone/server/dataFunctions/data_series.js @@ -22,7 +22,7 @@ dataSeries = function (plotParams, plotFunction) { completeness: plotParams.completeness, outliers: plotParams.outliers, hideGaps: plotParams.noGapsCheck, - hasLevels: false, + hasLevels: true, }; const dataRequests = {}; // used to store data queries const queryArray = []; @@ -103,7 +103,7 @@ dataSeries = function (plotParams, plotFunction) { thresholdClause = `and h.fcst_thresh = '${threshold}'`; } else if (statLineType === "precalculated") { // set up fields specific to precalculated stats - statisticClause = `avg(${statisticOptionsMap[statistic][2]}) as stat, group_concat(distinct ${statisticOptionsMap[statistic][2]}, ';', 9999, ';', unix_timestamp(ld.fcst_valid) order by unix_timestamp(ld.fcst_valid)) as sub_data`; + statisticClause = `avg(${statisticOptionsMap[statistic][2]}) as stat, group_concat(distinct ${statisticOptionsMap[statistic][2]}, ';', 9999, ';', unix_timestamp(ld.fcst_valid), ';', h.storm_id order by unix_timestamp(ld.fcst_valid), h.storm_id) as sub_data`; statHeaderType = "tcst_header"; [, lineDataType] = statisticOptionsMap[statistic]; modelClause = `and h.amodel = '${model}'`; diff --git a/apps/met-cyclone/server/dataFunctions/data_validtime.js b/apps/met-cyclone/server/dataFunctions/data_validtime.js index 959d07f4f..90c581ba3 100644 --- a/apps/met-cyclone/server/dataFunctions/data_validtime.js +++ b/apps/met-cyclone/server/dataFunctions/data_validtime.js @@ -22,7 +22,7 @@ dataValidTime = function (plotParams, plotFunction) { completeness: plotParams.completeness, outliers: plotParams.outliers, hideGaps: plotParams.noGapsCheck, - hasLevels: false, + hasLevels: true, }; const dataRequests = {}; // used to store data queries const queryArray = []; @@ -100,7 +100,7 @@ dataValidTime = function (plotParams, plotFunction) { thresholdClause = `and h.fcst_thresh = '${threshold}'`; } else if (statLineType === "precalculated") { // set up fields specific to precalculated stats - statisticClause = `avg(${statisticOptionsMap[statistic][2]}) as stat, group_concat(distinct ${statisticOptionsMap[statistic][2]}, ';', 9999, ';', unix_timestamp(ld.fcst_valid) order by unix_timestamp(ld.fcst_valid)) as sub_data`; + statisticClause = `avg(${statisticOptionsMap[statistic][2]}) as stat, group_concat(distinct ${statisticOptionsMap[statistic][2]}, ';', 9999, ';', unix_timestamp(ld.fcst_valid), ';', h.storm_id order by unix_timestamp(ld.fcst_valid), h.storm_id) as sub_data`; statHeaderType = "tcst_header"; [, lineDataType] = statisticOptionsMap[statistic]; modelClause = `and h.amodel = '${model}'`; diff --git a/apps/met-cyclone/server/dataFunctions/data_yeartoyear.js b/apps/met-cyclone/server/dataFunctions/data_yeartoyear.js index 8c1488667..a8486a8b2 100644 --- a/apps/met-cyclone/server/dataFunctions/data_yeartoyear.js +++ b/apps/met-cyclone/server/dataFunctions/data_yeartoyear.js @@ -21,7 +21,7 @@ dataYearToYear = function (plotParams, plotFunction) { completeness: plotParams.completeness, outliers: plotParams.outliers, hideGaps: plotParams.noGapsCheck, - hasLevels: false, + hasLevels: true, }; const dataRequests = {}; // used to store data queries const queryArray = []; @@ -99,7 +99,7 @@ dataYearToYear = function (plotParams, plotFunction) { thresholdClause = `and h.fcst_thresh = '${threshold}'`; } else if (statLineType === "precalculated") { // set up fields specific to precalculated stats - statisticClause = `avg(${statisticOptionsMap[statistic][2]}) as stat, group_concat(distinct ${statisticOptionsMap[statistic][2]}, ';', 9999, ';', unix_timestamp(ld.fcst_valid) order by unix_timestamp(ld.fcst_valid)) as sub_data`; + statisticClause = `avg(${statisticOptionsMap[statistic][2]}) as stat, group_concat(distinct ${statisticOptionsMap[statistic][2]}, ';', 9999, ';', unix_timestamp(ld.fcst_valid), ';', h.storm_id order by unix_timestamp(ld.fcst_valid), h.storm_id) as sub_data`; statHeaderType = "tcst_header"; [, lineDataType] = statisticOptionsMap[statistic]; modelClause = `and h.amodel = '${model}'`; diff --git a/apps/met-cyclone/server/main.js b/apps/met-cyclone/server/main.js index 96a4e25ef..bbffe80ac 100644 --- a/apps/met-cyclone/server/main.js +++ b/apps/met-cyclone/server/main.js @@ -299,14 +299,14 @@ const doCurveParams = function () { "Model-truth distance to land (nm)": [ "precalculated", "line_data_tcmpr", - "ld.adland-ld.bdland", + "if(ld.adland != -9999 and ld.bdland != -9999,ld.adland-ld.bdland,null)", ], "Model MSLP (mb)": ["precalculated", "line_data_tcmpr", "ld.amslp"], "Truth MSLP (mb)": ["precalculated", "line_data_tcmpr", "ld.bmslp"], "Model-truth MSLP (mb)": [ "precalculated", "line_data_tcmpr", - "ld.amslp-ld.bmslp", + "if(ld.amslp != -9999 and ld.bmslp != -9999,ld.amslp-ld.bmslp,null)", ], "Model maximum wind speed (kts)": [ "precalculated", @@ -321,7 +321,7 @@ const doCurveParams = function () { "Model-truth maximum wind speed (kts)": [ "precalculated", "line_data_tcmpr", - "ld.amax_wind-ld.bmax_wind", + "if(ld.amax_wind != -9999 and ld.bmax_wind != -9999,ld.amax_wind-ld.bmax_wind,null)", ], "Model radius of maximum winds (nm)": [ "precalculated", @@ -336,28 +336,28 @@ const doCurveParams = function () { "Model-truth radius of maximum winds (nm)": [ "precalculated", "line_data_tcmpr", - "ld.amrd-ld.bmrd", + "if(ld.amrd != -9999 and ld.bmrd != -9999,ld.amrd-ld.bmrd,null)", ], "Model eye diameter (nm)": ["precalculated", "line_data_tcmpr", "ld.aeye"], "Truth eye diameter (nm)": ["precalculated", "line_data_tcmpr", "ld.beye"], "Model-truth eye diameter (nm)": [ "precalculated", "line_data_tcmpr", - "ld.aeye-ld.beye", + "if(ld.aeye != -9999 and ld.beye != -9999,ld.aeye-ld.beye,null)", ], "Model storm speed (kts)": ["precalculated", "line_data_tcmpr", "ld.aspeed"], "Truth storm speed (kts)": ["precalculated", "line_data_tcmpr", "ld.bspeed"], "Model-truth storm speed (kts)": [ "precalculated", "line_data_tcmpr", - "ld.aspeed-ld.bspeed", + "if(ld.aspeed != -9999 and ld.bspeed != -9999,ld.aspeed-ld.bspeed,null)", ], "Model storm direction (deg)": ["precalculated", "line_data_tcmpr", "ld.adir"], "Truth storm direction (deg)": ["precalculated", "line_data_tcmpr", "ld.bdir"], "Model-truth storm direction (deg)": [ "precalculated", "line_data_tcmpr", - "ld.adir-ld.bdir", + "if(ld.adir != -9999 and ld.bdir != -9999,ld.adir-ld.bdir,null)", ], }, line_data_ctc: {