.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated/model_applications/medium_range/UserScript_fcstGEFS_Difficulty_Index.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_model_applications_medium_range_UserScript_fcstGEFS_Difficulty_Index.py: UserScript: Calculate the Difficulty Index ========================================== model_applications/medium_range/UserScript_fcstGEFS_Difficulty_Index.conf .. GENERATED FROM PYTHON SOURCE LINES 9-13 .. contents:: :depth: 1 :local: :backlinks: none .. GENERATED FROM PYTHON SOURCE LINES 15-42 Scientific Objective -------------------- This use case calls the UserScript wrapper to run a user provided script that calculates the difficulty index for wind speed. This use case allows for the user to change a variety of variables needed to run the difficulty index (i.e. threshold start and units) so that the user can run the script at different thresholds without needing to alter the code. This script run by the use case uses METcalcpy to provide the difficulty index calculation and METplotpy to provide the plotting capability. The difficulty index was developed by the Naval Research Lab (NRL). The overall aim of the difficulty index is to graphically represent the expected difficulty of a decision based on a set of forecasts (ensemble) of, e.g., wind speed as a function of space and time. There are two basic factors that can make a decision difficult. The first factor is the proximity of the ensemble mean forecast to a decision threshold, e.g. 34 knot winds. If the ensemble mean is either much lower or much higher than the threshold, the decision is easier; if it is closer to the threshold, the decision is harder. The second factor is the forecast precision, or ensemble spread. The greater the spread around the ensemble mean, the more likely it is that there will be ensemble members both above and below the decision threshold, making the decision harder. (A third factor that we will not address here is undiagnosed systematic error, which adds uncertainty in a similar way to ensemble spread.) The challenge is combining these factors into a continuous function that allows the user to assess relative risk. Additional details on the computation of the Difficulty Index can be found in the `METcalcpy documentation `_ and more information on plotting difficulty index can be found in the `METplotpy documentation `_. .. GENERATED FROM PYTHON SOURCE LINES 44-48 Version Added ------------- METplus version 4.1 .. GENERATED FROM PYTHON SOURCE LINES 50-67 Datasets -------- **Forecast:** NOAA Global Ensemble Forecast System (GEFS) **Observation:** None **Climatology:** None **Location:** All of the input data required for this use case can be found in a sample data tarball. Each use case category will have one or more sample data tarballs. It is only necessary to download the tarball with the use case’s dataset and not the entire collection of sample data. Click here to access the METplus releases page and download sample data for the appropriate release: https://github.com/dtcenter/METplus/releases This tarball should be unpacked into the directory that you will set the value of INPUT_BASE. See :ref:`running-metplus` section for more information. .. GENERATED FROM PYTHON SOURCE LINES 69-74 METplus Components ------------------ This use case runs the UserScript wrapper tool to run a user provided script, in this case, wind_difficulty_index.py. .. GENERATED FROM PYTHON SOURCE LINES 76-103 METplus Workflow ---------------- **Beginning time (INIT_BEG):** 2020120812 **End time (INIT_END):** 2020120812 **Increment between beginning and end times (INIT_INCREMENT):** 12H **Sequence of forecast leads to process (LEAD_SEQ):** None This use case loops by process which means that each tool is run for all times before moving to the next tool. The tool order is as follows: UserScript This example loops by initialization time (with begin, end, and increment as specified in the METplus UserScript_fcstGEFS_Difficulty_Index.conf file). 1 initialization time will be run over 1 lead time: **Init:** 20201208_12Z **Forecast lead:** 60 Since the data file used only contains a single lead time, the lead time is implied and not configured anywhere in the use case configuration file. .. GENERATED FROM PYTHON SOURCE LINES 105-115 METplus Configuration --------------------- METplus first loads all of the configuration files found in parm/metplus_config, then it loads any configuration files passed to METplus via the command line, i.e. parm/use_cases/model_applications/medium_range/UserScript_fcstGEFS_Difficulty_Index.conf .. highlight:: bash .. literalinclude:: ../../../../parm/use_cases/model_applications/medium_range/UserScript_fcstGEFS_Difficulty_Index.conf .. GENERATED FROM PYTHON SOURCE LINES 117-122 MET Configuration --------------------- There are no MET tools used in this use case. .. GENERATED FROM PYTHON SOURCE LINES 124-137 Python Embedding ---------------- This use case uses a Python embedding script to read input data. .. dropdown:: parm/use_cases/model_applications/medium_range/UserScript_fcstGEFS_Difficulty_Index/wind_difficulty_index.py .. highlight:: python .. literalinclude:: ../../../../parm/use_cases/model_applications/medium_range/UserScript_fcstGEFS_Difficulty_Index/wind_difficulty_index.py For more information on the basic requirements to utilize Python Embedding in METplus, please refer to the MET User’s Guide section on `Python embedding `_. .. GENERATED FROM PYTHON SOURCE LINES 139-143 User Scripting -------------- [UPDATE CONTENT] .. GENERATED FROM PYTHON SOURCE LINES 145-154 Running METplus --------------- Pass the use case configuration file to the run_metplus.py script along with any user-specific system configuration files if desired:: run_metplus.py /path/to/METplus/parm/use_cases/model_applications/medium_range/UserScript_fcstGEFS_Difficulty_Index.conf /path/to/user_system.conf See :ref:`running-metplus` for more information. .. GENERATED FROM PYTHON SOURCE LINES 156-172 Expected Output --------------- A successful run will output the following both to the screen and to the logfile:: INFO: METplus has successfully finished running. Refer to the value set for **OUTPUT_BASE** to find where the output data was generated. Output for this use case will be found in a directory relative to **OUTPUT_BASE**. There should be a list of files that have the following format: wndspd_GEFS_NorthPac_5dy_30mem_difficulty_indexTHRESH_00_kn.png Where THRESH is a number between DIFF_INDEX_SAVE_THRESH_START and DIFF_INDEX_SAVE_THRESH_STOP which are defined in UserScript_fcstGEFS_Difficulty_Index.conf. .. GENERATED FROM PYTHON SOURCE LINES 174-189 Keywords -------- .. note:: * UserScriptUseCase * MediumRangeAppUseCase * NRLOrgUseCase * METcalcpyUseCase * METplotpyUseCase Navigate to the :ref:`quick-search` page to discover other similar use cases. .. GENERATED FROM PYTHON SOURCE LINES 189-191 .. code-block:: Python # .. _sphx_glr_download_generated_model_applications_medium_range_UserScript_fcstGEFS_Difficulty_Index.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: UserScript_fcstGEFS_Difficulty_Index.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: UserScript_fcstGEFS_Difficulty_Index.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: UserScript_fcstGEFS_Difficulty_Index.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_