{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\nTrack and Intensity Plotter: Generate mean, median and box plots \n======================================================================================\n\nmodel_applications/tc_and_extra_tc/Plotter_fcstGFS\n_obsGFS_RPlotting.conf\n\n\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Scientific Objective\n--------------------\n\nBy maintaining focus of each evaluation time on a user-defined area around a cyclone,\nthe model statistical errors associated with cyclonic physical features (moisture\nflux, stability, strength of upper-level PV anomaly and jet, etc.) can be related\ndirectly to the model forecasts and provide improvement guidance by accurately\ndepicting interactions with significant weather features around and within the cyclone.\nThis is in contrast to the traditional method of regional averaging cyclone observations\nin a fixed grid, which \u201csmooths out\" system features and limits the meaningful metrics\nthat can be gathered. This use case relays the mean and median of forecast lead\ntimes for cyclone position compared to a reference dataset via boxplot.\n\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Datasets\n--------\n\n\n * Forecast dataset: ADeck ATCF tropical cyclone data \n * Observation dataset: BDeck ATCF tropical cyclone \"best track\" cyclone data\n\n\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "METplus Components\n------------------\n\nThis use case first runs TCPairs and then generates the requested\nplot types for statistics of interest. The TCMPRPlotterConfig_customize configuration\nfile is used by the plot_tcmpr.R script to select things such as the size of\nthe plot window that appears on your screen, etc.\n\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "METplus Workflow\n----------------\n\nThe following tools are used for each run time:\n\nTCPairs > plot_tcmpr.R\n\nTo generate TCPairs output, this example loops by initialization time for every 6 hour period that is available\nin the data set for 20141214. The output is then used to generate the mean, median, and box plot for the following:\nthe difference between the MSLP of the Adeck and Bdeck tracks (AMSLP-BMSLP), the difference between the max wind of the Adeck and\nBdeck tracks (AMAX_WIND-BMSLP), and the track err (TK_ERR).\n\n\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "METplus Configuration\n---------------------\n\nMETplus first loads all of the configuration files found in parm/metplus_config,\nthen it loads any configuration files passed to METplus via the command line\nwith the -c option, i.e. -c parm/use_cases/model_applications/tc_and_extra_tc/Plotter_fcstGFS_obsGFS_RPlotting.conf\n\n.. highlight:: bash\n.. literalinclude:: ../../../../parm/use_cases/model_applications/tc_and_extra_tc/Plotter_fcstGFS_obsGFS_RPlotting.conf\n\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "MET Configuration\n-----------------\n\nMETplus sets environment variables based on the values in the METplus configuration file.\nThese variables are referenced in the MET configuration file. **YOU SHOULD NOT SET ANY OF THESE ENVIRONMENT VARIABLES YOURSELF! THEY WILL BE OVERWRITTEN BY METPLUS WHEN IT CALLS THE MET TOOLS!** If there is a setting in the MET configuration file that is not controlled by an environment variable, you can add additional environment variables to be set only within the METplus environment using the [user_env_vars] section of the METplus configuration files. See the 'User Defined Config' section on the 'System Configuration' page of the METplus User's Guide for more information.\n\n.. highlight:: bash\n.. literalinclude:: ../../../../parm/use_cases/model_applications/tc_and_extra_tc/TCPairsETCConfig\n\n\nSee the following files for more information about the environment variables set in these configuration files.\n\nparm/use_cases/met_tool_wrapper/TCPairs/TCPairs.py\n\n\n\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Running METplus\n---------------\n\n**NOTE** - In order for this example to run successfully, ensure that your output folder ({OUTPUT_BASE}/tc_pairs/201412) is\nempty. If there are any files in this directory, the program will fail out and not produce the output for {OUTPUT_BASE}/tcmpr_plots.\n\nThis use case can be run two ways:\n\n1) Passing in Plotter_fcstGFS_obsGFS_RPlotting.conf then a user-specific system configuration file::\n\n       master_metplus.py -c /path/to/METplus/parm/use_cases/model_applications/tc_and_extra_tc/Plotter_fcstGFS_obsGFS_RPlotting.conf -c /path/to/user_system.conf\n\n2) Modifying the configurations in parm/metplus_config, then passing in Plotter_fcstGFS_obsGFS_RPlotting.conf::\n\n       master_metplus.py -c /path/to/METplus/parm/use_cases/model_applications/tc_and_extra_tc/Plotter_fcstGFS_obsGFS_RPlotting.conf\n\nThe former method is recommended. Whether you add them to a user-specific configuration file or modify the metplus_config files, the following variables must be set correctly:\n\n* **INPUT_BASE** - Path to directory where sample data tarballs are unpacked (See Datasets section to obtain tarballs). This is not required to run METplus, but it is required to run the examples in parm/use_cases\n* **OUTPUT_BASE** - Path where METplus output will be written. This must be in a location where you have write permissions\n* **MET_INSTALL_DIR** - Path to location where MET is installed locally\n\nExample User Configuration File::\n\n  [dir]\n  INPUT_BASE = /path/to/sample/input/data\n  OUTPUT_BASE = /path/to/output/dir\n  MET_INSTALL_DIR = /path/to/met-X.Y\n\n**NOTE:** All of these items must be found under the [dir] section.\n\n\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Expected Output\n---------------\n\nA successful run will output the following both to the screen and to the logfile::\n\n  INFO: METplus has successfully finished running.\n\nRefer to the value set for **OUTPUT_BASE** to find where the output data was generated.\nTCPairs output for this use case will be found in tc_pairs/201412 (relative to **OUTPUT_BASE**)\nand will contain files with the following format:\n\n* mlq2014121400.gfso.<*nnnn*>.tcst\n\nwhere *nnnn* is a zero-padded 4-digit number\n\n\nPlots (in .png format) will be found in tcmpr_plots (relative to **OUTPUT_BASE**):\n* AMAX_WIND-BMAX_WIND_boxplot.png\n* AMAX_WIND-BMAX_WIND_boxplot.png\n* AMAX_WIND-BMAX_WIND_boxplot.png\n* AMSLP-BMSLP_boxplot.png\n* AMSLP-BMSLP_boxplot.png\n* AMSLP-BMSLP_boxplot.png\n* TK_ERR_boxplot.png\n* TK_ERR_mean.png\n* TK_ERR_median.png\n\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Keywords\n--------\n\n\n<div class=\"alert alert-info\"><h4>Note</h4><p></p></div>\n `TCPairsToolUseCase <https://dtcenter.github.io/METplus/search.html?q=TCPairsUseCase&check_keywords=yes&area=default>`_,\n `TCandExtraTCAppUseCase <https://dtcenter.github.io/METplus/search.html?q=TCandExtraTCAppUseCase&check_keywords=yes&area=default>`_,\n `FeatureRelativeUseCase  <https://dtcenter.github.io/METplus/search.html?q=FeatureRelativeUseCase&check_keywords=yes&area=default>`_,\n `MediumRangeAppUseCase <https://dtcenter.github.io/METplus/search.html?q=MediumRangeAppUseCase&check_keywords=yes&area=default>`_,\n `SBUOrgUseCase <https://dtcenter.github.io/METplus/search.html?q=SBUOrgUseCase&check_keywords=yes&area=default>`_,\n `DTCOrgUseCase <https://dtcenter.github.io/METplus/search.html?q=DTCOrgUseCase&check_keywords=yes&area=default>`_\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        ""
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.6.12"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}