From fc17f5170e21d5c1be07ae5af16788bfbceb5478 Mon Sep 17 00:00:00 2001 From: TatianaBurek Date: Tue, 17 Oct 2023 14:45:19 -0600 Subject: [PATCH] specify the color of the no resolution and no skill lines for the reliability diagram #465 --- java/edu/ucar/metviewer/MVPlotJob.java | 21 ++++++++++++ java/edu/ucar/metviewer/MVPlotJobParser.java | 18 ++++++++--- .../metviewer/jobManager/RelyJobManager.java | 2 ++ webapp/metviewer/js/metviewer_common.js | 30 +++++++++++++++++ webapp/metviewer/js/metviewer_common.min.js | 9 +++--- webapp/metviewer/plotJSP/rely.jsp | 32 +++++++++++++------ 6 files changed, 93 insertions(+), 19 deletions(-) diff --git a/java/edu/ucar/metviewer/MVPlotJob.java b/java/edu/ucar/metviewer/MVPlotJob.java index ff3b9745..b3caa333 100644 --- a/java/edu/ucar/metviewer/MVPlotJob.java +++ b/java/edu/ucar/metviewer/MVPlotJob.java @@ -232,6 +232,9 @@ public class MVPlotJob { protected List lines = new ArrayList<>(); + protected String referenceLineCol = "#FF0000"; + protected String noskillLineCol = "#FF0000"; + /** * Deep copy of the MVPlotJob, useful for inheritance. @@ -350,6 +353,8 @@ public MVPlotJob copy() { job._strLegendNcol = _strLegendNcol; job._strCaptionWeight = _strCaptionWeight; job._strCaptionCol = _strCaptionCol; + job.referenceLineCol = referenceLineCol; + job.noskillLineCol = noskillLineCol; job._strCaptionSize = _strCaptionSize; job._strCaptionOffset = _strCaptionOffset; job._strCaptionAlign = _strCaptionAlign; @@ -2378,5 +2383,21 @@ public String getLineType() { } return "N/A"; } + + public String getReferenceLineCol() { + return referenceLineCol; + } + + public void setReferenceLineCol(String referenceLineCol) { + this.referenceLineCol = referenceLineCol; + } + + public String getNoskillLineCol() { + return noskillLineCol; + } + + public void setNoskillLineCol(String noskillLineCol) { + this.noskillLineCol = noskillLineCol; + } } diff --git a/java/edu/ucar/metviewer/MVPlotJobParser.java b/java/edu/ucar/metviewer/MVPlotJobParser.java index a6a68f6f..0a884e2a 100644 --- a/java/edu/ucar/metviewer/MVPlotJobParser.java +++ b/java/edu/ucar/metviewer/MVPlotJobParser.java @@ -192,6 +192,10 @@ public final class MVPlotJobParser { MVPlotJob.class.getDeclaredMethod("setCaptionWeight", String.class)); formatToStrValues .put("caption_col", MVPlotJob.class.getDeclaredMethod("setCaptionCol", String.class)); + formatToStrValues + .put("reference_line_col", MVPlotJob.class.getDeclaredMethod("setReferenceLineCol", String.class)); + formatToStrValues + .put("noskill_line_col", MVPlotJob.class.getDeclaredMethod("setNoskillLineCol", String.class)); formatToStrValues .put("caption_size", MVPlotJob.class.getDeclaredMethod("setCaptionSize", String.class)); formatToStrValues.put("caption_offset", @@ -895,10 +899,10 @@ public static StringBuilder serializeJob(MVPlotJob job, DatabaseInfo databaseInf xmlStr.append("").append(job.getRelyEventHist()).append(""); xmlStr.append("").append(job.getAddSkillLine()).append(""); xmlStr.append("").append(job.getAddNoSkillLine()).append(""); - xmlStr.append("").append(job.getAddReferenceLine()) - .append(""); - xmlStr.append("").append(job.getAddPointThresholds()) - .append(""); + xmlStr.append("").append(job.getNoskillLineCol()).append(""); + xmlStr.append("").append(job.getAddReferenceLine()).append(""); + xmlStr.append("").append(job.getReferenceLineCol()).append(""); + xmlStr.append("").append(job.getAddPointThresholds()).append(""); xmlStr.append("").append(job.getReverseConnectionOrder()) .append(""); xmlStr.append("").append(job.getCreateHtml()) @@ -1919,7 +1923,11 @@ else if (node.tag.equals("roc_calc")) { } else if (node.tag.equals("add_noskill_line")) { job.setAddNoSkillLine(node.value.equalsIgnoreCase("true")); } else if (node.tag.equals("add_reference_line")) { - job.setAddReferenceLine(node.value.equalsIgnoreCase("true")); + job.setAddReferenceLine(node.value.equalsIgnoreCase("true"));} + else if (node.tag.equals("reference_line_col")) { + job.setReferenceLineCol(node.value);} + else if (node.tag.equals("noskill_line_col")) { + job.setNoskillLineCol(node.value); } else if (node.tag.equals("create_html")) { job.setCreateHtml(node.value.equalsIgnoreCase("true")); } diff --git a/java/edu/ucar/metviewer/jobManager/RelyJobManager.java b/java/edu/ucar/metviewer/jobManager/RelyJobManager.java index 0e3b6fd6..abd00643 100644 --- a/java/edu/ucar/metviewer/jobManager/RelyJobManager.java +++ b/java/edu/ucar/metviewer/jobManager/RelyJobManager.java @@ -152,6 +152,8 @@ protected void run(MVPlotJob job) throws ParseException, ValidationException, IO yamlInfo.put("add_reference_line", job.getAddReferenceLine() ? "True" : "False"); yamlInfo.put("rely_event_hist", job.getRelyEventHist().equals("TRUE") ? "True" : "False"); yamlInfo.put("inset_hist", job.getInsetHist() ? "True" : "False"); + yamlInfo.put("reference_line_col", job.getReferenceLineCol()); + yamlInfo.put("noskill_line_col", job.getNoskillLineCol()); rscriptStatManager.prepareDataFileAndRscript(job, plotFixPerm, yamlInfo, new ArrayList<>()); job.setPlotTmpl(this.getPythonScript()); diff --git a/webapp/metviewer/js/metviewer_common.js b/webapp/metviewer/js/metviewer_common.js index 6fbbd205..8fefb9f2 100644 --- a/webapp/metviewer/js/metviewer_common.js +++ b/webapp/metviewer/js/metviewer_common.js @@ -3979,6 +3979,19 @@ function createXMLRely(plot) { agg_stat.append($('').text($('#eveq_dis').is(':checked'))); agg_stat.append($('').text($('#cl_step').val())); plot.append(agg_stat); + var reference_line_col = $('#reference_line_col').val(); + if (reference_line_col.startsWith("#")) { + plot.append($('').text(reference_line_col)); + } else { + plot.append($('').text("#" + reference_line_col)); + } + var noskill_line_col = $('#noskill_line_col').val(); + if (noskill_line_col.startsWith("#")) { + plot.append($('').text(noskill_line_col)); + } else { + plot.append($('').text("#" + noskill_line_col)); + } + plot = createXMLCommon(plot); return plot; } @@ -6367,6 +6380,21 @@ function loadXMLRely() { $('#add_reference_line').prop('checked', false); } } + if (initXML.find("plot").find("reference_line_col")) { + var reference_line_col = $(initXML.find("plot").find("reference_line_col")).text(); + if (reference_line_col.length > 7) { + reference_line_col = reference_line_col.substring(0, 7); + } + $('#reference_line_col').colorpicker('setColor', reference_line_col); + } + if (initXML.find("plot").find("noskill_line_col")) { + var noskill_line_col = $(initXML.find("plot").find("noskill_line_col")).text(); + if (noskill_line_col.length > 7) { + noskill_line_col = noskill_line_col.substring(0, 7); + } + $('#noskill_line_col').colorpicker('setColor', noskill_line_col); + } + loadXMLStatistics(); $("#event_equal").prop('checked', $(initXML.find("plot").find("event_equal")).text() == "true").trigger("change"); @@ -8137,6 +8165,8 @@ function initPage() { }); $('#caption_col').colorpicker('setColor', '#333333'); + + $("#error_message").dialog({ modal: true, autoOpen: false, diff --git a/webapp/metviewer/js/metviewer_common.min.js b/webapp/metviewer/js/metviewer_common.min.js index d4133099..984b37aa 100644 --- a/webapp/metviewer/js/metviewer_common.min.js +++ b/webapp/metviewer/js/metviewer_common.min.js @@ -148,8 +148,8 @@ function sendXml(){var a=getSelectedDatabases();if(a){var b=$("");b.a currentTab&&(a.append($("").text($("#contour_intervals").val())),a.append($("").text($("#color_palette").val())),a.append($("").text($("#add_color_bar").is(":checked"))),a.append($("").text($("#reverse_y").is(":checked"))),a.append($("").text($("#reverse_x").is(":checked"))),a.append($("").text($("#add_contour_overlay").is(":checked"))))}else if("Box"===currentTab)d=$("input:radio[name ='statistics']:checked").val(), d="revision_statistics"===d?$(""):$(""),a.append(d),a=createXMLBox(a);else if("Bar"===currentTab)d=$(""),a.append(d),a=createXMLBox(a);else if("Hist"===currentTab){var e=$("input:radio[name='hist_line_type']:checked").val();"rhist"===e?d=$(""):"phist"===e?d=$(""):"relp"===e&&(d=$("")); a.append(d);a=createXMLHist(a)}else"Roc"===currentTab?(d=$(""),a.append(d),a=createXMLRoc(a)):"Rely"===currentTab?(d=$(""),a.append(d),a=createXMLRely(a)):"Ens_ss"===currentTab?(d=$(""),a.append(d),a=createXMLEns(a)):"Perf"===currentTab?(d=$(""),a.append(d),a=createXMLPerf(a),a=createXMLCommon(a)):"Taylor"===currentTab?(d=$(""), -a.append(d),a=createXMLTaylor(a),a=createXMLCommon(a)):"Eclv"===currentTab&&(d=$(""),a.append(d),a=createXMLEclv(a));b.append(a);b=$("").append(b).html().replace(/label="eclv.R_tmpl"),a.append(d),a=createXMLEclv(a));b.append(a);b=$("").append(b).html().replace(/label="").text($("#ensss_pts").val()));a.append($("").text($("input:radio[name='ensss_pts_disp']:checked").val()));return a=createXMLCommon(a)} function createXMLRoc(a){try{$("#listdt").saveCell(lastSelRow,lastSelCol)}catch(c){console.log("Can't save row "+lastSelRow)}a.append(createSeriesElementForAxis(1,series_var_y1_indexes));a=createXMLPlotFix(a);var b=$("");"pct"==$("input:radio[name='roc_type']:checked").val()?(b.append($("").text("true")),b.append($("").text("false"))):(b.append($("").text("false")),b.append($("").text("true")));a.append(b);b=$("");try{var d= $("#summary_curve").multiselect("getChecked")}catch(c){d=[]}for(var e=0;e").text(d[e].value));d=$("");d.text($("#add_point_thresholds").prop("checked"));e=$("");e.text($("#reverse_connection_order").prop("checked"));a.append(b);a.append(d);a.append(e);return a=createXMLCommon(a)} @@ -158,7 +158,7 @@ d.append($("").text($("#boot_ci").val())),d.append($(""). function createXMLHist(a){try{$("#listdt").saveCell(lastSelRow,lastSelCol)}catch(b){console.log("Can't save row "+lastSelRow)}a.append(createSeriesElementForAxis(1,series_var_y1_indexes));a=createXMLPlotFix(a);a.append($("").text($("input:radio[name='normalized_histogram']:checked").val()));return a=createXMLCommon(a)} function createXMLRely(a){try{$("#listdt").saveCell(lastSelRow,lastSelCol)}catch(c){console.log("Can't save row "+lastSelRow)}a.append(createSeriesElementForAxis(1,series_var_y1_indexes));a=createXMLPlotFix(a);var b=$("");b.text($("#rely_event_hist").prop("checked"));a.append(b);b=$("");try{var d=$("#summary_curve").multiselect("getChecked")}catch(c){d=[]}for(var e=0;e").text(d[e].value));a.append(b);d=$(""); d.text($("#add_skill_line").prop("checked"));a.append(d);d=$("");d.text($("#add_noskill_line").prop("checked"));a.append(d);d=$("");d.text($("#add_reference_line").prop("checked"));a.append(d);d=$("");d.text($("#inset_hist").prop("checked"));a.append(d);d=$("");d.append($("").text("true"));d.append($("").text($("#boot_repl").val()));d.append($("").text($("#boot_random_seed").val()));d.append($("").text($("#boot_ci").val())); -d.append($("").text($("#eveq_dis").is(":checked")));d.append($("").text($("#cl_step").val()));a.append(d);return a=createXMLCommon(a)} +d.append($("").text($("#eveq_dis").is(":checked")));d.append($("").text($("#cl_step").val()));a.append(d);d=$("#reference_line_col").val();d.startsWith("#")?a.append($("").text(d)):a.append($("").text("#"+d));d=$("#noskill_line_col").val();d.startsWith("#")?a.append($("").text(d)):a.append($("").text("#"+d));return a=createXMLCommon(a)} function createXMLBox(a){a=createXMLSeries(a);a=createXMLCommon(a);a.append($("").text($("#box_pts").is(":checked")));a.append($("").text($("#box_outline").is(":checked")));a.append($("").text($("#box_notch").is(":checked")));a.append($("").text($("#box_avg").is(":checked")));a.append($("").text($("#box_boxwex").val()));return a} function createXMLPlotFix(a){var b=$("");if("none"!==$("#fixed_var_table").css("display"))for(var d=0;d").attr("name",$("#fixed_var_"+fixed_var_indexes[d]).val()).attr("equalize",$("#fix_var_event_equal_"+fixed_var_indexes[d]).is(":checked")),c=$("").attr("name",$("#fixed_var_"+fixed_var_indexes[d]).val()+"_"+d),f=$("#fixed_var_val_"+fixed_var_indexes[d]).val();if(f){for(var g=0;g").text(f[g]));e.append(c); b.append(e)}}a.append(b);return a} @@ -285,7 +285,8 @@ function loadXMLRely(){var a=$(initXML.find("plot").find("lines"));if(a){a=$(a.f try{$("#series_var_y1_"+(a+1)).val(e).multiselect("refresh")}catch(c){}$(b[a]).find("val").each(function(){d.push($(this).text())});"fcst_init_beg"==e||"fcst_valid_beg"==e||"fcst_valid"==e||"fcst_init"==e?$("#series_var_val_y1_date_period_button_"+(a+1)).css("display","block"):$("#series_var_val_y1_date_period_button_"+(a+1)).css("display","none");updateSeriesVarValHist(a+1,d)}else series_var_y1_indexes=[],updateSeriesVarValHist(1,[]);updatePlotFix();if(initXML.find("plot").find("summary_curve")&& 0 - +
- + -
-
- +
+
+ + + +
+
+