From fc17f5170e21d5c1be07ae5af16788bfbceb5478 Mon Sep 17 00:00:00 2001 From: TatianaBurek Date: Tue, 17 Oct 2023 14:45:19 -0600 Subject: [PATCH 1/5] 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 - +
- + -
-
- +
+
+ + + +
+
+ From fb31a33f3d5969d13b7d4a8058bdee96bef87c83 Mon Sep 17 00:00:00 2001 From: lisagoodrich <33230218+lisagoodrich@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:47:05 -0600 Subject: [PATCH 2/5] Feature 497 headers (#502) * fixing headers, adding Contributors Guide to the index file * removing Contributors Guide. It crashed. * updating headers and some titles with capitalizing * changing Template Formatting to it's own section * Adding Contributors Guide to make it viewable * Removing Contributor's Guide from exclude_patterns * Update docs/Users_Guide/installation.rst Co-authored-by: Julie Prestopnik * Update docs/Users_Guide/web_service.rst Co-authored-by: Julie Prestopnik * Update docs/Users_Guide/web_service.rst Co-authored-by: Julie Prestopnik * fixing header underline * returning headers to their original state * Changing Index header back to its original state --------- Co-authored-by: Julie Prestopnik --- docs/Contributors_Guide/index.rst | 5 ++-- docs/Contributors_Guide/testing.rst | 23 +++++++++-------- docs/Users_Guide/barplots.rst | 9 ++++--- docs/Users_Guide/batch.rst | 13 ++++++---- docs/Users_Guide/boxplot.rst | 9 ++++--- docs/Users_Guide/common.rst | 3 ++- docs/Users_Guide/contourplot.rst | 9 ++++--- docs/Users_Guide/database_loading.rst | 8 +++--- docs/Users_Guide/database_scrubbing.rst | 5 ++-- docs/Users_Guide/eclvplots.rst | 12 +++++---- docs/Users_Guide/etb_plot.rst | 9 ++++--- docs/Users_Guide/index.rst | 4 +-- docs/Users_Guide/installation.rst | 14 +++++----- docs/Users_Guide/overview.rst | 34 ++++++++++++------------- docs/Users_Guide/perfdiag.rst | 12 +++++---- docs/Users_Guide/references.rst | 3 ++- docs/Users_Guide/reliabilityplots.rst | 13 ++++++---- docs/Users_Guide/rocplot.rst | 12 +++++---- docs/Users_Guide/scorecard.rst | 16 +++++++----- docs/Users_Guide/seriesplots.rst | 9 ++++--- docs/Users_Guide/spreadskillplot.rst | 9 ++++--- docs/Users_Guide/taylordiag.rst | 12 +++++---- docs/Users_Guide/web_service.rst | 20 ++++++++------- docs/conf.py | 2 +- docs/index.rst | 8 +++--- 25 files changed, 152 insertions(+), 121 deletions(-) diff --git a/docs/Contributors_Guide/index.rst b/docs/Contributors_Guide/index.rst index a1ddc46f..b08361e8 100644 --- a/docs/Contributors_Guide/index.rst +++ b/docs/Contributors_Guide/index.rst @@ -1,7 +1,6 @@ - -=================== +################### Contributor's Guide -=================== +################### .. toctree:: :titlesonly: diff --git a/docs/Contributors_Guide/testing.rst b/docs/Contributors_Guide/testing.rst index 78f7da56..6a64b28a 100644 --- a/docs/Contributors_Guide/testing.rst +++ b/docs/Contributors_Guide/testing.rst @@ -1,8 +1,9 @@ +************** Testing Module -============== +************** -Testing example - install and run on dakota -------------------------------------------- +Testing Example - Install and Run on dakota +=========================================== **Testing directory and branch information** @@ -45,8 +46,8 @@ stored in the `git store `_ . Also, **auto_test.sh** should be modified to send emails with testing results. -Testing - capture ------------------ +Testing - Capture +================= The testing module is used to execute the regression testing of a specified version of METviewer. The capture tool is invoked by using the mv_test.sh @@ -173,13 +174,13 @@ directory structure might look like this, for example... ... -Testing - verify ----------------- +Testing - Verify +================ The mv_compare.sh script accepts a branch and a tag that it uses to identify a test subdirectory and a second "expected" branch and tag that it uses to identify a comparison test directory. If tags are omitted the HEAD is used. The compare script looks for corresponding image files in the corresponding plots directories and does a binary comparison of the corresponding files. Differences will be reported as errors. -auto test ---------- +Auto Test +========= The auto_test.sh script defines the branch, optionally a tag, directories, and database credentials for a version under test and a comparison version. It performs the following steps. @@ -286,8 +287,8 @@ to pass, produced and expected files should be byte identical. NOTE: R scripts create visually similar results but bitwise different image files on different platforms. -Testing submodules ------------------- +Testing Submodules +================== **LoadDataTest** recreates and refills the mv_test database with MET output data and compares the number of rows in each table with the expected number. diff --git a/docs/Users_Guide/barplots.rst b/docs/Users_Guide/barplots.rst index 32e65f76..3c263781 100644 --- a/docs/Users_Guide/barplots.rst +++ b/docs/Users_Guide/barplots.rst @@ -1,8 +1,9 @@ +********* Bar Plots -========= +********* Description ------------ +=========== A bar plot shows comparisons among discrete categories. One axis of the chart shows the specific categories being compared, while the other @@ -22,7 +23,7 @@ Bar plots often represent counts or frequencies, however, bar plots can represent means, medians, standard deviations, or any other statistic. How-To -------- +====== Selection of options to produce the plot proceeds approximately counter-clockwise around the METviewer window. The steps to create a series @@ -92,7 +93,7 @@ plot are: There are many other options for plots, but these are the basics. Example --------- +======= The image below shows an example of the plot and set-up options for a series plot in METviewer. This example uses the database diff --git a/docs/Users_Guide/batch.rst b/docs/Users_Guide/batch.rst index 63e719cc..688ff52c 100644 --- a/docs/Users_Guide/batch.rst +++ b/docs/Users_Guide/batch.rst @@ -1,5 +1,6 @@ +********************* Batch Plotting Module -===================== +********************* The batch plotting system is used to generate a number of plots of data in the METviewer database. The usage statement: @@ -170,7 +171,8 @@ conceptually, a list of **** structures. | **:** Turns on a difference curve should be plotted for the y2 series; calculated as the pairwise difference between the members of the first series minus the second - example:list(c("series1","series2"), c("series3","series4")). | -**Template Formatting** +Template Formatting +=================== Template values have the syntax {var_name[?param1=val1[&param2=val2[...]]]}. For example, @@ -439,10 +441,11 @@ starting at 1 for each fcst_var. | MODE Statistics ---------------- +=============== Single Object Statistics -~~~~~~~~~~~~~~~~~~~~~~~~ +------------------------ + MODE statistics are broken up into two categories: single and pair statistics. Single statistics are suffixed with a three letter code which indicates the group of objects over which the statistic should be calculated @@ -597,7 +600,7 @@ RATIO\_ with AREARAT\_ and OBJ with OBJA. - OBJFBIAS Pair Object Statistics -~~~~~~~~~~~~~~~~~~~~~~ +---------------------- MODE object pair statistics are specified using the following format: STATNAME_CC where STATNAME is one of the Object Pair Statistics in the diff --git a/docs/Users_Guide/boxplot.rst b/docs/Users_Guide/boxplot.rst index a5cb6d26..e505dc15 100644 --- a/docs/Users_Guide/boxplot.rst +++ b/docs/Users_Guide/boxplot.rst @@ -1,8 +1,9 @@ +********* Box Plots -========= +********* Description ------------ +=========== Box plots, or box and whisker plots, are a way to summarize a distribution of values using Tukey's 5-number summary @@ -27,7 +28,7 @@ threshold. Here, each forecast and observation is binary, but the verification statistic is continuous. How-To ---------- +====== Selection of options to produce the plot proceeds approximately counter-clockwise around the METviewer window. The steps to create a @@ -105,7 +106,7 @@ There are many other options for plots, but these are the basics. Example --------- +======= The example below shows a boxplot of the RMSE for 2m temperature over the CONUS. Many of the standard METviewer plotting options are available diff --git a/docs/Users_Guide/common.rst b/docs/Users_Guide/common.rst index 0245046d..891cc6a7 100644 --- a/docs/Users_Guide/common.rst +++ b/docs/Users_Guide/common.rst @@ -1,5 +1,6 @@ +********************* Common XML Structures -===================== +********************* The database loading module and batch plotting module both use XML input files. Some XML structures can be used in either input file. These common structures are documented below. diff --git a/docs/Users_Guide/contourplot.rst b/docs/Users_Guide/contourplot.rst index 6dc62863..debd71eb 100644 --- a/docs/Users_Guide/contourplot.rst +++ b/docs/Users_Guide/contourplot.rst @@ -1,8 +1,9 @@ +************* Contour Plots -============= +************* Description ------------ +=========== Contour plots are a very general plot type somewhat similar to a scatter plot. The axes are specified by the user, and any will do so long as the @@ -13,7 +14,7 @@ examine the difference in statistics between two NWP models as a contour plot, as is shown in the example below. How-To -------- +====== Selection of options to produce the plot proceeds approximately counter-clockwise around the METviewer window. The steps to create a contour @@ -76,7 +77,7 @@ plot are: There are many other options for plots, but these are the basics. Example --------- +======= The example is a contour plot of temperature mean error (bias) for one model at different pressure levels over a range of initialization times. diff --git a/docs/Users_Guide/database_loading.rst b/docs/Users_Guide/database_loading.rst index 74c26e6b..39b0d761 100644 --- a/docs/Users_Guide/database_loading.rst +++ b/docs/Users_Guide/database_loading.rst @@ -1,5 +1,6 @@ +*********************** Database Loading Module -======================= +*********************** The database loading module is used to insert, update, and delete MET output data in the database. The tool is invoked using the mv_load.sh script. The @@ -134,7 +135,7 @@ change it to Example -------- +======= Here is a simple example: @@ -203,7 +204,8 @@ specified by the named folder_dates. ... Troubleshooting ---------------- +=============== + .. _test: .. list-table:: diff --git a/docs/Users_Guide/database_scrubbing.rst b/docs/Users_Guide/database_scrubbing.rst index 01f3ff05..956114b1 100644 --- a/docs/Users_Guide/database_scrubbing.rst +++ b/docs/Users_Guide/database_scrubbing.rst @@ -1,5 +1,6 @@ +************************* Database Scrubbing Module -========================= +************************* The database scrubbing utility is used to to delete data from METviewer databases that meets some user-specified selection criteria. The usage @@ -58,7 +59,7 @@ performed (**FALSE**). | Examples --------- +======== **Example 1: Prune by describing the data ()** diff --git a/docs/Users_Guide/eclvplots.rst b/docs/Users_Guide/eclvplots.rst index 1f1f94ad..2bf1bccf 100644 --- a/docs/Users_Guide/eclvplots.rst +++ b/docs/Users_Guide/eclvplots.rst @@ -1,8 +1,9 @@ +****************************** Economic Cost/Loss Value Plots -============================== +****************************** Description ------------ +=========== The Economic Cost Loss Value statistic is sometimes also called the Relative value score (:ref:`Richardson, 2000`; @@ -23,11 +24,12 @@ The ECLV score can range from -:math:`\infty` to 1. Like ROC diagrams, it gives information that can be used in decision making. Line Type ---------- +========= + ECLV requires the ECLV line type generated by either Point-Stat or Grid-Stat. How-To ------- +====== Selection of options to produce the ECLV plot proceeds approximately counter-clockwise around the METviewer window. @@ -81,7 +83,7 @@ counter-clockwise around the METviewer window. Example --------- +======= The figure below shows an ECLV plot. In this example, three different forecasting systems are used to predict precipitation at two different diff --git a/docs/Users_Guide/etb_plot.rst b/docs/Users_Guide/etb_plot.rst index 01159734..1ae97729 100644 --- a/docs/Users_Guide/etb_plot.rst +++ b/docs/Users_Guide/etb_plot.rst @@ -1,8 +1,9 @@ +******************************** Equivalence Testing Bounds Plots -================================ +******************************** Description ------------ +=========== A statistical hypothesis is an assertion about the distribution function for one or more random variables. Generally, two hypotheses are considered, a null hypothesis denoted by H0, and an alternative denoted by @@ -32,7 +33,7 @@ In this case, H0 is accepted if the CI bounds fall completely between the tolera and H0 is rejected otherwise. How-To -------- +====== Selection of options to produce the plot proceeds approximately counter-clockwise around the METviewer window. The steps to create a @@ -104,7 +105,7 @@ There are many other options for plots, but these are the basics. Example --------- +======= The image below shows an example of the plot and set-up options for a series plot in METviewer. This example uses the database diff --git a/docs/Users_Guide/index.rst b/docs/Users_Guide/index.rst index 237d3271..c7553d0e 100644 --- a/docs/Users_Guide/index.rst +++ b/docs/Users_Guide/index.rst @@ -1,6 +1,6 @@ -============ +############ User's Guide -============ +############ **Foreword: A note to METviewer users** diff --git a/docs/Users_Guide/installation.rst b/docs/Users_Guide/installation.rst index 00ac5e20..d368621d 100644 --- a/docs/Users_Guide/installation.rst +++ b/docs/Users_Guide/installation.rst @@ -1,17 +1,18 @@ .. _install: +**************************** METviewer Installation Guide -============================ +**************************** Introduction ------------- +============ This chapter describes how to install METviewer. METviewer has been developed and tested on Linux operating systems. Support for additional platforms and compilers may be added in future releases. Installing METviewer --------------------- +==================== METviewer relies on the following tools. These must be installed and tested prior to installing METviewer: @@ -117,8 +118,8 @@ clone `METdataio repository `_ git clone https://github.com/dtcenter/METdataio.git -Configure and build METviewer -_____________________________ +Configure and Build METviewer +----------------------------- #. Configure the batch and loading tools: @@ -225,7 +226,8 @@ _____________________________ ln -s /d3/projects/METViewer/src_dev/apps/verif/metviewer/sql/mv_mysql.sql mv_mysql.sql Making a Database Accessible in the METviewer Web Application -------------------------------------------------------------- +============================================================= + To make a new database accessible in the METviewer Web Application click on "Reload list of databases" button in the upper right corner of the main JSP page. The list of available databases should be updated and a diff --git a/docs/Users_Guide/overview.rst b/docs/Users_Guide/overview.rst index 5b494767..10826d6a 100644 --- a/docs/Users_Guide/overview.rst +++ b/docs/Users_Guide/overview.rst @@ -1,9 +1,9 @@ +********************* Overview of METviewer -===================== +********************* - -Purpose and organization of the User's Guide --------------------------------------------- +Purpose and Organization of the User's Guide +============================================ The goal of this User's Guide is to provide basic information for users of the METviewer database and display system to enable users to create plots @@ -13,7 +13,7 @@ The METviewer User's Guide is organized as follows. The Developmental Testbed Center (DTC) --------------------------------------- +====================================== METviewer has been developed, and will be maintained and enhanced, by the Developmental Testbed Center (`DTC `_ ). The main @@ -34,8 +34,8 @@ modeling community for testing and evaluation of new model capabilities, applications in new environments, and so on. -METviewer goals and design philosophy -------------------------------------- +METviewer Goals and Design Philosophy +===================================== The METviewer tool reads MET verification statistics output from a database and creates plots using the R statistical package. The tool includes a web @@ -55,7 +55,7 @@ private sector, and operational modeling and prediction centers. METviewer Requirements ----------------------- +====================== METviewer requires installation of Java, Apache / Tomcat, MySQL, and R statistics. @@ -70,7 +70,7 @@ statistics. .. _userspec: METviewer User Specifications ------------------------------ +============================= The top menu allows the user to select a database and type for the plot. @@ -121,7 +121,7 @@ trying to compare the skill of one or more predictions. METviewer Output ----------------- +================ METviewer output all appears in the tabbed boxes at the top right quadrant of the web browser. The plot will show by default, but the user can click any @@ -160,7 +160,7 @@ recommended that the user click through at least the plot and xml windows and save this output. METviewer Plot Formatting Specifications ----------------------------------------- +======================================== METviewer plot formatting options appear in the tabbed boxes at the bottom right quadrant of the web browser. The “Titles & Labels” tab will show by @@ -193,7 +193,7 @@ reset all options to the defaults. METviewer Series Formatting Specifications ------------------------------------------- +========================================== At the bottom of the METviewer window is the series formatting box. It allows the user to control the minute details of each line on a plot, including @@ -205,7 +205,7 @@ place (so subsequent plots are identical in format). METviewer History Menu ----------------------- +====================== Along the left of the METviewer GUI, hidden by default, is the history menu. To open this menu, click the arrow at the top left side right underneath @@ -215,8 +215,8 @@ from this menu to recover plots they may have neglected to save. Clicking on the button showing loads the plot. -Future development plans ------------------------- +Future Development Plans +======================== METviewer is an evolving verification database and display software package. New capabilities are planned in controlled, successive version releases. Bug @@ -226,8 +226,8 @@ releases of METviewer. Additionally, updates to accommodate new features of the MET software are often required. -Code support ------------- +Code Support +============ METviewer support is provided through the `METplus GitHub Discussions Forum `_. diff --git a/docs/Users_Guide/perfdiag.rst b/docs/Users_Guide/perfdiag.rst index 7fae76d7..055547ec 100644 --- a/docs/Users_Guide/perfdiag.rst +++ b/docs/Users_Guide/perfdiag.rst @@ -1,8 +1,9 @@ +******************** Performance Diagrams -==================== +******************** Description ------------ +=========== Performance diagrams are used to show the relationship between categorical statistics, with axes representing detection and success (1 - false alarm) @@ -23,7 +24,8 @@ to the right side. CSI amounts are listed to the right side of the plot, with better values falling closer to the top. Line Type ---------- +========= + Performance requires categorical statistics generated by either Point-Stat or Grid-Stat. These are: @@ -32,7 +34,7 @@ or Grid-Stat. These are: * CTS How-To -------- +====== Selection of options to produce the reliability diagram proceeds approximately counter-clockwise around the METviewer window. @@ -84,7 +86,7 @@ approximately counter-clockwise around the METviewer window. There are many other options for plots, but these are the basics. Example --------- +======= The reliability diagram shown below is for 3 hour accumulated precipitation over the CONUS for 8 ensemble members at the 18 hour diff --git a/docs/Users_Guide/references.rst b/docs/Users_Guide/references.rst index c42baaf8..1eb12194 100644 --- a/docs/Users_Guide/references.rst +++ b/docs/Users_Guide/references.rst @@ -1,5 +1,6 @@ +********** References -========== +********** .. _Hoaglin: diff --git a/docs/Users_Guide/reliabilityplots.rst b/docs/Users_Guide/reliabilityplots.rst index f6ba23d6..cda0ff25 100644 --- a/docs/Users_Guide/reliabilityplots.rst +++ b/docs/Users_Guide/reliabilityplots.rst @@ -1,8 +1,10 @@ + +***************** Reliability Plots -================= +***************** Description ------------ +=========== Reliability (or attributes) diagrams are used to show the conditional bias of probabilistic forecasts. If a probability forecast is reliable, then @@ -26,13 +28,14 @@ Reliability diagrams can be used to make adjustments to the conditional bias of the forecast probabilities. Line Type ---------- +========= + Reliability diagrams require the probability statistics (PCT line type) generated by either Point-Stat or Grid-Stat. How-To -------- +====== Selection of options to produce the reliability diagram proceeds approximately counter-clockwise around the METviewer window. @@ -101,7 +104,7 @@ There are many other options for plots, but these are the basics. Example --------- +======= The reliability diagram shown below is for the probability of 24 hour precipitation with accumulations greater than or equal to 12.7 cm occurring diff --git a/docs/Users_Guide/rocplot.rst b/docs/Users_Guide/rocplot.rst index 3e942f6c..004db4c7 100644 --- a/docs/Users_Guide/rocplot.rst +++ b/docs/Users_Guide/rocplot.rst @@ -1,8 +1,9 @@ +********************************************* Receiver Operating Characteristic (ROC) Plots -============================================== +********************************************* Description ------------ +=========== MET produces a hit rate (Probability of Detection; POD) and Probability of False Detection (POFD) values for each user-specified threshold of a forecast @@ -24,7 +25,8 @@ conditioned on the forecasts. Line Type ---------- +========= + ROC requires probability statistics generated by either Point-Stat or Grid-Stat. These line types are: @@ -33,7 +35,7 @@ Grid-Stat. These line types are: * CTC How-To -------- +====== Selection of options to produce the ROC plot proceeds approximately counter-clockwise around the METviewer window. @@ -100,7 +102,7 @@ There are many other options for plots, but these are the basics. Example --------- +======= The plot shown below is for two different probability of precipitation forecasts. The dashed diagonal line represents the no-skill line. Ideal diff --git a/docs/Users_Guide/scorecard.rst b/docs/Users_Guide/scorecard.rst index 37413d85..708ef122 100644 --- a/docs/Users_Guide/scorecard.rst +++ b/docs/Users_Guide/scorecard.rst @@ -1,16 +1,17 @@ +********** Scorecards -========== +********** Description ------------ +=========== A scorecard is a graphical representation of significance and performance of a comparison, normally a comparison between two models. The scorecard can only be produced using xml code. The xml code specifications are listed in the detail below. There is no GUI interface. -EMC vs. NCAR method of determining p-values for Aggregation statistics ----------------------------------------------------------------------- +EMC vs. NCAR Method of Determining p-values for Aggregation Statistics +====================================================================== In statistics, the p-value represents the probability of a statistic having a value at least as extreme as observed, in this case a difference between two @@ -42,7 +43,8 @@ compared to a resampled distribution rather than a known, theoretical distribution. Line Type ---------- +========= + Scorecards can be run with either summary or aggregation logic. Aggregation logic is the default and generally, the better choice. The following are line types scorecards support: @@ -70,7 +72,7 @@ line types scorecards support: * RPS How-To -------- +====== The scorecard module is used to generate a scorecard PNG and HTML images using data in the METviewer database. The usage statement: @@ -316,7 +318,7 @@ system folders. image. Default value: Verification Scorecard Example -------- +======= The image below shows the output of scorecard_example.xml. diff --git a/docs/Users_Guide/seriesplots.rst b/docs/Users_Guide/seriesplots.rst index cefc74b2..c045928e 100644 --- a/docs/Users_Guide/seriesplots.rst +++ b/docs/Users_Guide/seriesplots.rst @@ -1,8 +1,9 @@ +************ Series Plots -============ +************ Description ------------ +=========== The series plot is the most general of all the METviewer plotting options. A series plot is really just a special case of a scatter plot, where the @@ -15,7 +16,7 @@ lead times or thresholds (on the X-axis). The tremendous flexibility of this plot means that the user must specify many options. How-To -------- +====== Selection of options to produce the plot proceeds approximately counter-clockwise around the METviewer window. The steps to create a @@ -93,7 +94,7 @@ There are many other options for plots, but these are the basics. Example --------- +======= The image below shows an example of the plot and set-up options for a series plot in METviewer. This example uses the database diff --git a/docs/Users_Guide/spreadskillplot.rst b/docs/Users_Guide/spreadskillplot.rst index 2ef6ad66..d4308029 100644 --- a/docs/Users_Guide/spreadskillplot.rst +++ b/docs/Users_Guide/spreadskillplot.rst @@ -1,8 +1,9 @@ +********************** Spread vs. Skill Plots -======================= +********************** Description ------------ +=========== Spread vs. Skill plots are widely used to evaluate the quality of ensemble forecasting systems. One goal of ensemble forecasting is to have the @@ -17,7 +18,7 @@ ratio is 1. How-To -------- +====== Selection of options to produce the spread vs. skill plot proceeds approximately counter-clockwise around the METviewer window. @@ -89,7 +90,7 @@ approximately counter-clockwise around the METviewer window. There are many other options for plots, but these are the basics. Example --------- +======= This example shows the 2-m temperature RMSE and spread for a series of forecast lead times for an ensemble. Plotted are the spread and the skill. diff --git a/docs/Users_Guide/taylordiag.rst b/docs/Users_Guide/taylordiag.rst index 9b1d4e67..b3ff159f 100644 --- a/docs/Users_Guide/taylordiag.rst +++ b/docs/Users_Guide/taylordiag.rst @@ -1,8 +1,9 @@ +*************** Taylor Diagrams -=============== +*************** Description ------------ +=========== Taylor diagrams are used to show a relationship between continuous statistics (:ref:`Taylor, 2001`). This type of plot is used to @@ -32,12 +33,13 @@ So, better forecasts lie closer on the Taylor diagram to observation point, while worse forecasts lie further away. Line Type ---------- +========= + Taylor requires continuous statistics, SL1L2, generated by either Point-Stat or Grid-Stat. How-To -------- +====== Selection of options to produce the Taylor diagram proceeds approximately counter-clockwise around the METviewer window. @@ -90,7 +92,7 @@ There are many other options for plots, but these are the basics. Example -------- +======= The example Taylor diagram below shows the downward longwave radiation flux (DLWRF) correlation and standard deviation for one model and seven diff --git a/docs/Users_Guide/web_service.rst b/docs/Users_Guide/web_service.rst index 1b269694..4d2e8d5b 100644 --- a/docs/Users_Guide/web_service.rst +++ b/docs/Users_Guide/web_service.rst @@ -1,5 +1,6 @@ +********************* METviewer Web Service -===================== +********************* The METviewer web service is a web-server driven API that parses XML requests and returns results in an XML structure. All calls are @@ -33,13 +34,13 @@ loose ordering: #. Plot request for user selected database and plot information API Request/Response Formats ----------------------------- +============================ The following sections each describe a web service API function in terms of the request/response XML structure. List Databases -~~~~~~~~~~~~~~ +-------------- List the METviewer databases that are available on the system for access through the web app. The returned list reflects the contents of the @@ -64,7 +65,7 @@ Response: List Values -~~~~~~~~~~~ +----------- The list_val request is used to conditionally list the distinct values in the stat_header table of the selected database. The stat_field element @@ -148,7 +149,7 @@ vice versa. List Statistics -~~~~~~~~~~~~~~~ +--------------- The list_stat request builds a list of all statistics available in the METviewer database for the specified fcst_var. It is primarily used to @@ -182,7 +183,7 @@ criteria is not supported in list_stat requests. Generate Plot -~~~~~~~~~~~~~ +------------- Once a user has provided all the information for a complete plot specification, the plot request handles the parsing of the plot @@ -210,9 +211,10 @@ element. NAs produced by integer overflow -Open app with predefine database -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Use this url to open METviewer main page with predefine database: +Open App with Predefined Database +--------------------------------- + +Use this url to open METviewer main page with predefined database: http://www.dtcenter.org/met/metviewer/metviewer1.jsp?db=name_of_database diff --git a/docs/conf.py b/docs/conf.py index a198e896..f852d30b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -42,7 +42,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'Contributors_Guide'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # Suppress certain warning messages suppress_warnings = ['ref.citation'] diff --git a/docs/index.rst b/docs/index.rst index f4333c92..a2a4def7 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,12 +1,14 @@ =========================== METviewer version |version| =========================== + Developed by the `Developmental Testbed Center `_, Boulder, CO .. image:: _static/METplus_banner_photo_web.png History ------- + The Model Evaluation Tools (MET) were developed by the Developmental Testbed Center (DTC) and released in January 2008. The goal of the tools was to provide the community with a platform independent and extensible @@ -36,6 +38,7 @@ contributions. METplus Concept --------------- + METplus is the overarching, or umbrella, repository and hence framework for the Unified Forecast System verification capability. It is intended to be extensible through adding additional capability developed by the community. @@ -112,12 +115,9 @@ To cite this documentation in publications, please refer to the METviewer User's :caption: METviewer Users_Guide/index + Contributors_Guide/index Index ===== * :ref:`genindex` - - - - From 8411e5d87d49c1e6f0e9b5d41c5e67dec21f5ddb Mon Sep 17 00:00:00 2001 From: TatianaBurek Date: Thu, 2 Nov 2023 14:50:39 -0600 Subject: [PATCH 3/5] hide/show the legend entries line by line #501 --- java/edu/ucar/metviewer/MVPlotJob.java | 10 ++ java/edu/ucar/metviewer/MVPlotJobParser.java | 3 + .../ucar/metviewer/jobManager/JobManager.java | 13 ++ webapp/metviewer/js/metviewer_common.js | 52 +++++++- webapp/metviewer/js/metviewer_common.min.js | 126 +++++++++--------- 5 files changed, 135 insertions(+), 69 deletions(-) diff --git a/java/edu/ucar/metviewer/MVPlotJob.java b/java/edu/ucar/metviewer/MVPlotJob.java index b3caa333..493bbecd 100644 --- a/java/edu/ucar/metviewer/MVPlotJob.java +++ b/java/edu/ucar/metviewer/MVPlotJob.java @@ -195,6 +195,7 @@ public class MVPlotJob { protected String _strLty = ""; protected String _strLwd = ""; protected String _strConSeries = ""; + protected String showLegend = null; protected String _strLegend = ""; protected String _strY1Lim = ""; protected String _strX1Lim = ""; @@ -414,6 +415,7 @@ public MVPlotJob copy() { job._strLty = _strLty; job._strLwd = _strLwd; job._strConSeries = _strConSeries; + job.showLegend = showLegend; job._strLegend = _strLegend; job._strY1Lim = _strY1Lim; job._strX1Lim = _strX1Lim; @@ -1819,6 +1821,14 @@ public void setConSeries(String conSeries) { _strConSeries = conSeries; } + public String getShowLegend() { + return showLegend; + } + + public void setShowLegend(String showLegend) { + this.showLegend = showLegend; + } + public String getLegend() { return _strLegend; } diff --git a/java/edu/ucar/metviewer/MVPlotJobParser.java b/java/edu/ucar/metviewer/MVPlotJobParser.java index 0a884e2a..e5f6e2a5 100644 --- a/java/edu/ucar/metviewer/MVPlotJobParser.java +++ b/java/edu/ucar/metviewer/MVPlotJobParser.java @@ -242,6 +242,8 @@ public final class MVPlotJobParser { formatToStrValues.put("lwd", MVPlotJob.class.getDeclaredMethod("setLwd", String.class)); formatToStrValues .put("con_series", MVPlotJob.class.getDeclaredMethod("setConSeries", String.class)); + formatToStrValues + .put("show_legend", MVPlotJob.class.getDeclaredMethod("setShowLegend", String.class)); formatToStrValues .put("legend", MVPlotJob.class.getDeclaredMethod("setLegend", String.class)); formatToStrValues.put("y1_lim", MVPlotJob.class.getDeclaredMethod("setY1Lim", String.class)); @@ -1043,6 +1045,7 @@ public static StringBuilder serializeJob(MVPlotJob job, DatabaseInfo databaseInf "" + job.getLty() + "" + "" + job.getLwd() + "" + "" + job.getConSeries() + "" + + "" + job.getShowLegend() + "" + "" + sanitise(job.getLegend()) + "" + "" + job.getY1Lim() + "" + diff --git a/java/edu/ucar/metviewer/jobManager/JobManager.java b/java/edu/ucar/metviewer/jobManager/JobManager.java index 2b77200e..65797586 100644 --- a/java/edu/ucar/metviewer/jobManager/JobManager.java +++ b/java/edu/ucar/metviewer/jobManager/JobManager.java @@ -122,6 +122,14 @@ protected void validateNumDepSeries(MVPlotJob job, int intNumDepSeries) throws V throw new ValidationException("length of con_series differs from number of series (" + intNumDepSeries + ")"); } + if (job.getShowLegend() == null){ + throw new ValidationException("ERROR: show_legend parameter is not provided."); + }else { + if (intNumDepSeries != MVUtil.parseRCol(job.getShowLegend()).length) { + throw new ValidationException("length of show_legend differs from number of series (" + + intNumDepSeries + ")"); + } + } } protected int getNumDepSeries(int intNumDep1Series, int intNumDep2Series, MVPlotJob job) { @@ -295,6 +303,10 @@ protected Map createInfoMap(MVPlotJob job, int intNumDepSeries) MVUtil.rep(1, intNumDepSeries)) : job.getLwd()); info.put("con_series", job.getConSeries().isEmpty() ? MVUtil.printRCol( MVUtil.rep(0, intNumDepSeries)) : job.getConSeries()); + + if(job.getShowLegend() != null){ + info.put("show_legend",MVUtil.printRCol(MVUtil.rep(0, intNumDepSeries))); + } info.put("legend", job.getLegend().isEmpty() ? "c()" : job.getLegend()); info.put("y1_lim", job.getY1Lim().isEmpty() ? "c()" : job.getY1Lim()); info.put("x1_lim", job.getX1Lim().isEmpty() ? "c()" : job.getX1LimR()); @@ -629,6 +641,7 @@ protected Map addPlotConfigs(Map yamlInfo, MVPlo info.put("show_signif", rListToList(job.getShowSignif())); info.put("con_series", rListToListNumeric(job.getConSeries())); + info.put("show_legend", rListToListNumeric(job.getShowLegend())); info.put("plot_ci", rListToList(job.getPlotCI())); diff --git a/webapp/metviewer/js/metviewer_common.js b/webapp/metviewer/js/metviewer_common.js index 8fefb9f2..7557d70c 100644 --- a/webapp/metviewer/js/metviewer_common.js +++ b/webapp/metviewer/js/metviewer_common.js @@ -658,6 +658,7 @@ var firstSeriesFormatting = { lwd: "1", show_signif: "No", con_series: "1", + show_legend: "1", legend: "", id: "1" }; @@ -2515,6 +2516,7 @@ function updateSeriesHist() { var plot_ci = []; var plot_disp = []; var show_signif = []; + var show_legend = []; var colors = []; var pch = []; var lty = []; @@ -2568,6 +2570,7 @@ function updateSeriesHist() { lty = initXML.find("plot").find("lty").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); lwd = initXML.find("plot").find("lwd").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); con_series = initXML.find("plot").find("con_series").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); + show_legend = initXML.find("plot").find("show_legend").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); order_series = initXML.find("plot").find("order_series").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); type = initXML.find("plot").find("type").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); legend = initXML.find("plot").find("legend").text().replace("c(", "").replace(/\)$/, "").replace(/"/g, "").split(","); @@ -2617,6 +2620,7 @@ function updateSeriesHist() { series_formatting.lty = oldSeriesData[i]['lty']; series_formatting.lwd = oldSeriesData[i]['lwd']; series_formatting.con_series = oldSeriesData[i]['con_series']; + series_formatting.show_legend = oldSeriesData[i]['show_legend']; series_formatting.legend = oldSeriesData[i]['legend']; series_formatting.id = number_series + 1; isSeriesOld = true; @@ -2650,6 +2654,7 @@ function updateSeriesHist() { series_formatting.lty = lty[number_series].trim(); series_formatting.lwd = lwd[number_series].trim(); series_formatting.con_series = con_series[number_series].trim(); + series_formatting.show_legend = show_legend[number_series].trim(); series_formatting.legend = legend[number_series].trim(); series_formatting.color = colors[number_series].trim(); series_formatting.id = number_series + 1; @@ -2853,6 +2858,7 @@ function updateSeriesEns() { var lty = []; var lwd = []; var con_series = []; + var show_legend = []; var order_series = []; var legend = []; var type = []; @@ -2882,6 +2888,7 @@ function updateSeriesEns() { lty = initXML.find("plot").find("lty").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); lwd = initXML.find("plot").find("lwd").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); con_series = initXML.find("plot").find("con_series").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); + show_legend = initXML.find("plot").find("show_legend").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); order_series = initXML.find("plot").find("order_series").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); type = initXML.find("plot").find("type").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); legend = initXML.find("plot").find("legend").text().replace("c(", "").replace(/\)$/, "").replace(/"/g, "").split(","); @@ -2937,6 +2944,7 @@ function updateSeriesEns() { series_formatting.lty = oldSeriesData[i]['lty']; series_formatting.lwd = oldSeriesData[i]['lwd']; series_formatting.con_series = oldSeriesData[i]['con_series']; + series_formatting.show_legend = oldSeriesData[i]['show_legend']; series_formatting.legend = oldSeriesData[i]['legend']; series_formatting.id = number_series + 1; isSeriesOld = true; @@ -2970,6 +2978,7 @@ function updateSeriesEns() { series_formatting.lty = lty[number_series].trim(); series_formatting.lwd = lwd[number_series].trim(); series_formatting.con_series = con_series[number_series].trim(); + series_formatting.show_legend = show_legend[number_series].trim(); series_formatting.legend = legend[number_series].trim(); series_formatting.color = colors[number_series].trim(); series_formatting.id = number_series + 1; @@ -3041,6 +3050,7 @@ function updateSeriesPerf() { var lty = []; var lwd = []; var con_series = []; + var show_legend = []; var order_series = []; var legend = []; var type = []; @@ -3070,6 +3080,7 @@ function updateSeriesPerf() { lty = initXML.find("plot").find("lty").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); lwd = initXML.find("plot").find("lwd").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); con_series = initXML.find("plot").find("con_series").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); + show_legend = initXML.find("plot").find("show_legend").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); order_series = initXML.find("plot").find("order_series").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); type = initXML.find("plot").find("type").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); legend = initXML.find("plot").find("legend").text().replace("c(", "").replace(/\)$/, "").replace(/"/g, "").split(","); @@ -3103,6 +3114,7 @@ function updateSeriesPerf() { series_formatting.lty = oldSeriesData[i]['lty']; series_formatting.lwd = oldSeriesData[i]['lwd']; series_formatting.con_series = oldSeriesData[i]['con_series']; + series_formatting.show_legend = oldSeriesData[i]['show_legend']; series_formatting.legend = oldSeriesData[i]['legend']; series_formatting.id = number_series + 1; isSeriesOld = true; @@ -3136,6 +3148,7 @@ function updateSeriesPerf() { series_formatting.lty = lty[number_series].trim(); series_formatting.lwd = lwd[number_series].trim(); series_formatting.con_series = con_series[number_series].trim(); + series_formatting.show_legend = show_legend[number_series].trim(); series_formatting.legend = legend[number_series].trim(); series_formatting.color = colors[number_series].trim(); series_formatting.id = number_series + 1; @@ -3181,7 +3194,12 @@ function updateSeries(isCheckAll) { var series_formatting = {}; var isFixedFormatting = $("#seriesLock").is(':checked'); var newSeriesData = []; - var selected_mode = $("#plot_data").multiselect("getChecked").val(); + var selected_mode; + try { + selected_mode = $("#plot_data").multiselect("getChecked").val(); + } catch (e) { + selected_mode = 'stat'; + } var y_axis; var fcst_var_indexes; var plot_ci = []; @@ -3192,6 +3210,7 @@ function updateSeries(isCheckAll) { var lty = []; var lwd = []; var con_series = []; + var show_legend = []; var order_series = []; var legend = []; var type = []; @@ -3221,6 +3240,7 @@ function updateSeries(isCheckAll) { lty = initXML.find("plot").find("lty").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); lwd = initXML.find("plot").find("lwd").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); con_series = initXML.find("plot").find("con_series").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); + show_legend = initXML.find("plot").find("show_legend").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); var order_series_el = initXML.find("plot").find("order_series").text(); if (order_series_el && order_series_el.length > 0) { order_series = initXML.find("plot").find("order_series").text().replace("c(", "").replace(")", "").replace(/"/g, "").split(","); @@ -3265,7 +3285,6 @@ function updateSeries(isCheckAll) { } } } - series_perm = []; series_perm[0] = ''; } @@ -3315,6 +3334,7 @@ function updateSeries(isCheckAll) { series_formatting.lty = oldSeriesData[i]['lty']; series_formatting.lwd = oldSeriesData[i]['lwd']; series_formatting.con_series = oldSeriesData[i]['con_series']; + series_formatting.show_legend = oldSeriesData[i]['show_legend']; series_formatting.legend = oldSeriesData[i]['legend']; series_formatting.id = number_series + 1; isSeriesOld = true; @@ -3344,6 +3364,7 @@ function updateSeries(isCheckAll) { series_formatting.lty = lty[number_series].trim(); series_formatting.lwd = lwd[number_series].trim(); series_formatting.con_series = con_series[number_series].trim(); + series_formatting.show_legend = show_legend[number_series].trim(); series_formatting.legend = legend[number_series].trim(); series_formatting.color = colors[number_series].trim(); series_formatting.id = number_series + 1; @@ -3416,6 +3437,7 @@ function updateSeries(isCheckAll) { series_formatting.lty = lty[number_series].trim(); series_formatting.lwd = lwd[number_series].trim(); series_formatting.con_series = con_series[number_series].trim(); + series_formatting.show_legend = show_legend[number_series].trim(); series_formatting.legend = legend[number_series].trim(); series_formatting.color = colors[number_series].trim(); series_formatting.id = number_series + 1; @@ -3477,6 +3499,7 @@ function updateSeries(isCheckAll) { series_formatting.lty = lty[number_series].trim(); series_formatting.lwd = lwd[number_series].trim(); series_formatting.con_series = con_series[number_series].trim(); + series_formatting.show_legend = show_legend[number_series].trim(); series_formatting.legend = legend[number_series].trim(); series_formatting.color = colors[number_series].trim(); series_formatting.id = number_series + 1; @@ -4134,8 +4157,12 @@ function createXMLSeries(plot) { } catch (err) { console.log("Can't save row " + lastSelRow); } - var selected_mode = $("#plot_data").multiselect("getChecked").val(); - + var selected_mode; + try { + selected_mode = $("#plot_data").multiselect("getChecked").val(); + } catch (e) { + selected_mode = 'stat'; + } var dep = $(''); dep.append(createDepElementForAxis(1, fcst_var_y1_indexes, selected_mode)); @@ -4389,7 +4416,7 @@ function createXMLCommon(plot) { var allSeries = sortSeries(); - var ciArr = [], dispArr = [], colorsArr = [], pchArr = [], typeArr = [], ltyArr = [], lwdArr = [], conArr = [], + var ciArr = [], dispArr = [], colorsArr = [], pchArr = [], typeArr = [], ltyArr = [], lwdArr = [], conArr = [], showLegendArr=[], orderArr = [], legendArr = [], showSignArr = [], linesArr = []; for (var i = 0; i < allSeries.length; i++) { if (allSeries[i].order !== '') { @@ -4411,6 +4438,7 @@ function createXMLCommon(plot) { ltyArr.push(allSeries[i].lty); lwdArr.push(allSeries[i].lwd); conArr.push(allSeries[i].con_series); + showLegendArr.push(allSeries[i].show_legend); orderArr.push(allSeries[i].order); legendArr.push('"' + allSeries[i].legend + '"'); } else { @@ -4441,6 +4469,7 @@ function createXMLCommon(plot) { plot.append($('').text("c(" + ltyArr.join() + ")")); plot.append($('').text("c(" + lwdArr.join() + ")")); plot.append($('').text("c(" + conArr.join() + ")")); + plot.append($('').text("c(" + showLegendArr.join() + ")")); plot.append($('').text("c(" + orderArr.join() + ")")); plot.append($('').text($('#plot_cmd').val())); plot.append($('').text("c(" + legendArr.join() + ")")); @@ -7502,7 +7531,7 @@ function initPage() { datatype: "local", autowidth: true, shrinkToFit: true, - colNames: ['ID', '#', 'Y axis', 'Hide', 'Title', 'Conf Interval', 'Line Color', 'Point Symbol', 'Series Line Type', 'Line Type', 'Line Width', 'Show Significant', 'Connect Across NA', 'Legend Text'], + colNames: ['ID', '#', 'Y axis', 'Hide', 'Title', 'Conf Interval', 'Line Color', 'Point Symbol', 'Series Line Type', 'Line Type', 'Line Width', 'Show Significant', 'Connect Across NA', 'Show Legend', 'Legend Text'], colModel: [ {name: 'id', index: 'id', hidden: true}, {name: 'order', width: 10, index: 'order', sortable: false}, @@ -7599,6 +7628,17 @@ function initPage() { width: 30, align: "center" }, + { + name: 'show_legend', + index: 'show_legend', + width: 30, + align: "center", + editable: true, + edittype: "select", + formatter: 'select', + editoptions: {value: "0:No;1:Yes"}, + sortable: false, + }, { name: 'legend', index: 'legend', diff --git a/webapp/metviewer/js/metviewer_common.min.js b/webapp/metviewer/js/metviewer_common.min.js index 984b37aa..bfb9daab 100644 --- a/webapp/metviewer/js/metviewer_common.min.js +++ b/webapp/metviewer/js/metviewer_common.min.js @@ -28,7 +28,7 @@ init_hour:"INIT_HOUR",fcst_rad:"FCST_RAD",vx_mask:"VX_MASK"},indy_var_value_to_t valid_hour:"VALID_HOUR",fcst_init_beg:"FCST_INIT_BEG",init_hour:"INIT_HOUR",fcst_lev:"FCST_LEV",obtype:"OBTYPE",vx_mask:"VX_MASK",interp_mthd:"INTERP_MTHD",interp_pnts:"INTERP_PNTS",fcst_thresh:"FCST_THRESH",obs_thresh:"OBS_THRESH",n_bin:"N_BIN",cov_thresh:"COV_THRESH"},rhist_fixed_var_map={fcst_var:"FCST_VAR",model:"MODEL",fcst_lead:"FCST_LEAD",fcst_valid_beg:"FCST_VALID_BEG",valid_hour:"VALID_HOUR",fcst_init_beg:"FCST_INIT_BEG",init_hour:"INIT_HOUR",fcst_lev:"FCST_LEV",obtype:"OBTYPE",vx_mask:"VX_MASK", interp_mthd:"INTERP_MTHD",interp_pnts:"INTERP_PNTS",fcst_thresh:"FCST_THRESH",obs_thresh:"OBS_THRESH",n_rank:"N_RANK",cov_thresh:"COV_THRESH"},relp_fixed_var_map={fcst_var:"FCST_VAR",model:"MODEL",fcst_lead:"FCST_LEAD",fcst_valid_beg:"FCST_VALID_BEG",valid_hour:"VALID_HOUR",fcst_init_beg:"FCST_INIT_BEG",init_hour:"INIT_HOUR",fcst_lev:"FCST_LEV",obtype:"OBTYPE",vx_mask:"VX_MASK",interp_mthd:"INTERP_MTHD",interp_pnts:"INTERP_PNTS",fcst_thresh:"FCST_THRESH",obs_thresh:"OBS_THRESH",n_ens:"N_ENS",cov_thresh:"COV_THRESH"}, perf_fixed_var_map={fcst_var:"FCST_VAR",model:"MODEL",fcst_lead:"FCST_LEAD",fcst_valid_beg:"FCST_VALID_BEG",valid_hour:"VALID_HOUR",fcst_init_beg:"FCST_INIT_BEG",init_hour:"INIT_HOUR",fcst_lev:"FCST_LEV",obtype:"OBTYPE",vx_mask:"VX_MASK",interp_mthd:"INTERP_MTHD",interp_pnts:"INTERP_PNTS",fcst_thresh:"FCST_THRESH",obs_thresh:"OBS_THRESH",cov_thresh:"COV_THRESH"},fcst_var_y1_indexes=[1],series_var_y1_indexes=[1],fcst_var_y2_indexes=[],series_var_y2_indexes=[],fixed_var_indexes=[],date_period_indexes= -[1],firstSeriesFormatting={order:"1",hide:"No",plot_ci:"none",color:"",pch:20,type:"b",lty:"1",lwd:"1",show_signif:"No",con_series:"1",legend:"",id:"1"},seriesDiffY1=[],seriesDiffY2=[],previousIndVarValResponse,fixVarValResponse={},seriesY1VarValResponse={},seriesY2VarValResponse={},xml='',group_name_to_value_map,indy_var_vals_to_attr,fcst_vars=[],fcst_vars_stats=[],lines=[]; +[1],firstSeriesFormatting={order:"1",hide:"No",plot_ci:"none",color:"",pch:20,type:"b",lty:"1",lwd:"1",show_signif:"No",con_series:"1",show_legend:"1",legend:"",id:"1"},seriesDiffY1=[],seriesDiffY2=[],previousIndVarValResponse,fixVarValResponse={},seriesY1VarValResponse={},seriesY2VarValResponse={},xml='',group_name_to_value_map,indy_var_vals_to_attr,fcst_vars=[],fcst_vars_stats=[],lines=[]; function cleanUp(){fcst_var_y1_indexes=[1];series_var_y1_indexes=[1];fcst_var_y2_indexes=[];series_var_y2_indexes=[];fixed_var_indexes=[];date_period_indexes=[1];seriesDiffY1=[];seriesDiffY2=[];previousIndVarValResponse=null;fixVarValResponse={};seriesY1VarValResponse={};seriesY2VarValResponse={};group_name_to_value_map=null;fcst_vars=[];fcst_vars_stats=[];lines=[]} function isModeStat(a){if(0<=$.inArray(a,listStatModeRatio))return!0;a=a.split("_");return 2==a.length?0<=$.inArray(a[0],listStatMode)||"ACOVACOV"==a[0]?!0:!1:!1}function isMtdStat(a){if(0<=$.inArray(a,listStatMtdRatio))return!0;a=a.split("_");for(var b="",d=0;d'+a+"FCST_VAR",error:function(a,b,c){},success:function(a){a=$(a).find("val");for(var b=0;b",">").replace("<", "<"));$.ajax({async:!1,url:"servlet",type:"POST",dataType:"xml",contentType:"application/xml",data:''+g+""+k+"",error:function(){},success:function(a){var b=$(a).find("val");a=[];if(0",{value:h,text:h, -title:value_to_desc_map[g.text()],selected:f});a.push(f)}else 0!=c&&g.text()===$(b[c-1]).text()&&a[a.length-1].text(a[a.length-1].text()+"*")}f=$("input[name='multiselect_database']:checked").length-1;for(c=0;c",{value:"N/A",text:"N/A"}),f.appendTo(e);try{e.multiselect("refresh")}catch(v){}d= +title:value_to_desc_map[g.text()],selected:f});a.push(f)}else 0!=c&&g.text()===$(b[c-1]).text()&&a[a.length-1].text(a[a.length-1].text()+"*")}f=$("input[name='multiselect_database']:checked").length-1;for(c=0;c",{value:"N/A",text:"N/A"}),f.appendTo(e);try{e.multiselect("refresh")}catch(z){}d= []}})}var h=$("#series_var_"+a+"_"+b);h.empty();$.each(series_var_value_to_title_stat_map,function(a,b){h.append('")});try{h.multiselect("refresh")}catch(p){}}} function updateSeriesVarValEns(a,b){$("#listdt").jqGrid("clearGridData");var d=$("#series_var_val_y1_"+a);d.empty();var e=getSelectedDatabases();if(e){try{var c=$("#series_var_y1_"+a).multiselect("getChecked").val()}catch(f){c=$("#series_var_y1_"+a+" option:first-child").val()}$.ajax({async:!1,url:"servlet",type:"POST",contentType:"application/xml",dataType:"xml",processData:!1,data:''+e+""+c+'', error:function(){},success:function(c){seriesY1VarValResponse[a]=c;var e=$(c).find("val");c=[];if(0",{value:h,text:h,selected:p}),c.push(p)):0!=f&&h.text()===$(e[f-1]).text()&&c[c.length-1].text(c[c.length-1].text()+"*")}p=$("input[name='multiselect_database']:checked").length-1;for(f=0;f'+e+"<"+f+"_field>"+c+"NA',error:function(){},success:function(c){seriesY1VarValResponse[a]=c;var e=$(c).find("val");c=[];if(0").replace("<","<").replace("&","&")===b:0<=$.inArray(g.text().replace(">",">").replace("<","<").replace("&","&"),b);0===f||0!==f&&g.text()!==$(e[f-1]).text()?(m=$("