.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated/model_applications/clouds/GridStat_fcstGFS_obsGFS_cloudFracLayer.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_clouds_GridStat_fcstGFS_obsGFS_cloudFracLayer.py: Grid-Stat, MODE, Stat-Analysis, UserScript, Gen-Vx-Mask: GFS Cloud Statistics by Type ===================================================================================== model_applications/clouds/GridStat_fcstGFS_obsGFS_cloudFracLayer.conf .. GENERATED FROM PYTHON SOURCE LINES 9-13 .. contents:: :depth: 1 :local: :backlinks: none .. GENERATED FROM PYTHON SOURCE LINES 15-23 Scientific Objective -------------------- This use case evaluates clouds classified into low, mid, and high levels. The evaluation covers multiple types of statistics including contingency table statistics, neighborhood statistics, distance maps, and an object based evaluation. Additionally, plots are created to demonstrate how to reformat and visualize GSS, CSI, and frequency bias from the command line. .. GENERATED FROM PYTHON SOURCE LINES 25-29 Version Added ------------- METplus version 6.1 .. GENERATED FROM PYTHON SOURCE LINES 31-48 Datasets -------- **Forecast**: GFS 0.25 degree model **Observation**: GFS Analysis **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 50-73 METplus Components ------------------ This use case calls GenVxMask once, GridStat once, MODE three times, StatAnalysis once, and UserScript twice. MODE has three entries to facilitate calling MODE for three separate variables without invoking Muli-variate MODE, while GridStat is able to run for three separate variables with only one process list entry. Additionally, METcalcpy, METplotpy, and METdataio are required to run this use case. The METcalcpy scripts accessed include the following: * metcalcpy/util/read_env_vars_in_config.py The METplopty scrips accessed include the following: * metplotpy/plots/line/line.py The METdataio scripts accessed include the following: * METdbLoad/ush/read_data_files.py * METdbLoad/ush/read_load_xml.py * METreformat/write_stat_ascii.py .. GENERATED FROM PYTHON SOURCE LINES 76-106 METplus Workflow ---------------- **Beginning time (INIT_BEG):** 2024030700 **End time (INIT_END):** 2024030700 **Increment between beginning and end times (INIT_INCREMENT):** 6 hours **Sequence of forecast leads to process (LEAD_SEQ):** 0, 6, 12, 18 GenVxMask is run once. The Grid-Stat, MODE, and Stat-Analysis tools run for each time. This example loops by model initialization time. It processes one initialization time and three lead times for a total of 3 valid times, listed below. | **Valid:** 2024-03-07_00Z | **Forecast lead:** 00 | **Valid:** 2024-03-07_06Z | **Forecast lead:** 06 | **Init:** 2024-03-07_12Z | **Forecast lead:** 12 | **Init:** 2024-03-07_18Z | **Forecast lead:** 18 Both UserScripts are each run once. The first UserScript reformats the GridStat CTS output so that it can be used to create a plot. The second UserScript creates three plots. .. GENERATED FROM PYTHON SOURCE LINES 108-117 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/clouds/GridStat_fcstGFS_obsGFS_cloudFracLayer.conf .. highlight:: bash .. literalinclude:: ../../../../parm/use_cases/model_applications/clouds/GridStat_fcstGFS_obsGFS_cloudFracLayer.conf .. GENERATED FROM PYTHON SOURCE LINES 119-143 MET Configuration --------------------- METplus sets environment variables based on user settings in the METplus configuration file. See :ref:`How METplus controls MET config file settings` for more details. **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 currently not supported by METplus you’d like to control, please refer to: :ref:`Overriding Unsupported MET config file settings` .. dropdown:: GridStatConfig_wrapped .. literalinclude:: ../../../../parm/met_config/GridStatConfig_wrapped .. dropdown:: MODEConfig_wrapped .. highlight:: bash .. literalinclude:: ../../../../parm/met_config/MODEConfig_wrapped .. dropdown:: StatAnalysisConfig_wrapped .. literalinclude:: ../../../../parm/met_config/STATAnalysisConfig_wrapped .. GENERATED FROM PYTHON SOURCE LINES 145-149 Python Embedding ---------------- This use case does not use Python embedding. .. GENERATED FROM PYTHON SOURCE LINES 151-189 User Scripting -------------- There are two Python scripts used in this use case, called using the "UserScript" keyword in the METplus wrappers PROCESS_LIST configuration item. These scripts provide an interface to the functions in the METdataio, METcalcpy, and METplotpy Python modules of METplus. The functions used in these scripts demonstrate reformatting aggregated StatAnalysis output to meet the format required by METcalcpy and METplotpy, and then plotting that reformatted output using functions from METcalcpy and METplotpy. The first Python script is called reformat_CTS_linetype.py. This script takes the aggregated output CTS linetype from Stat Analysis and reformats it so that the data can be plotted. The script takes an input .yaml file, reformat_CTS.yaml. Environment variables in the yaml file are specified in the [user_env_vars] section of the GridStat_fcstGFS_obsGFS_cloudFracLayer.conf METplus configuration file. The second Python script is plot_line_stats.py. This script creates line plots for low and high clouds for GSS, CSI, and Frequency bias with lead time, using the YAML files custom_line_CSI.yaml, custom_line_FBIAS.yaml, and custom_line_GSS.yaml Input variables to both scripts are set in the [user_env_vars] section of the GridStat_fcstGFS_obsGFS_cloudFracLayer.conf file. For more information about YAML configuration options for the line plots shown here, see the METplotpy `line plot documentation `_. Both Python scripts are located at:: parm/use_cases/model_applications/clouds/GridStat_fcstGFS_obsGFS_cloudFracLayer .. dropdown:: reformat_CTS_linetype.py .. highlight:: python .. literalinclude:: ../../../../parm/use_cases/model_applications/clouds/GridStat_fcstGFS_obsGFS_cloudFracLayer/reformat_CTS_linetype.py .. dropdown:: plot_line_stats.py .. highlight:: python .. literalinclude:: ../../../../parm/use_cases/model_applications/clouds/GridStat_fcstGFS_obsGFS_cloudFracLayer/plot_line_stats.py .. GENERATED FROM PYTHON SOURCE LINES 191-200 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/clouds/GridStat_fcstGFS_obsGFS_cloudFracLayer.conf /path/to/user_system.conf See :ref:`running-metplus` for more information. .. GENERATED FROM PYTHON SOURCE LINES 202-327 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 {OUTPUT_BASE}/model_applications/clouds/GridStat_fcstGFS_obsGFS_cloudFracLayer. There will be 6 directories with output data, masks, grid_stat, mode, stat_analysis, reformatted, and plots. The mask directory will contain an input mask and the following output mask file:: * West_Pacific.nc The grid_stat directory will contain 4 .stat file sand 4 .nc files:: * grid_stat_GFS_cloud_000000L_20240307_000000V_pairs.nc * grid_stat_GFS_cloud_000000L_20240307_000000V.stat * grid_stat_GFS_cloud_060000L_20240307_060000V_pairs.nc * grid_stat_GFS_cloud_060000L_20240307_060000V.stat * grid_stat_GFS_cloud_120000L_20240307_120000V_pairs.nc * grid_stat_GFS_cloud_120000L_20240307_120000V.stat * grid_stat_GFS_cloud_180000L_20240307_180000V_pairs.nc * grid_stat_GFS_cloud_180000L_20240307_180000V.stat The mode directory will contain the following files:: * mode_GFS_high_cloud_000000L_20240307_000000V_000000A_cts.txt * mode_GFS_high_cloud_000000L_20240307_000000V_000000A_obj.nc * mode_GFS_high_cloud_000000L_20240307_000000V_000000A_obj.txt * mode_GFS_high_cloud_000000L_20240307_000000V_000000A.ps * mode_GFS_high_cloud_060000L_20240307_060000V_000000A_cts.txt * mode_GFS_high_cloud_060000L_20240307_060000V_000000A_obj.nc * mode_GFS_high_cloud_060000L_20240307_060000V_000000A_obj.txt * mode_GFS_high_cloud_060000L_20240307_060000V_000000A.ps * mode_GFS_high_cloud_120000L_20240307_120000V_000000A_cts.txt * mode_GFS_high_cloud_120000L_20240307_120000V_000000A_obj.nc * mode_GFS_high_cloud_120000L_20240307_120000V_000000A_obj.txt * mode_GFS_high_cloud_120000L_20240307_120000V_000000A.ps * mode_GFS_high_cloud_180000L_20240307_180000V_000000A_cts.txt * mode_GFS_high_cloud_180000L_20240307_180000V_000000A_obj.nc * mode_GFS_high_cloud_180000L_20240307_180000V_000000A_obj.txt * mode_GFS_high_cloud_180000L_20240307_180000V_000000A.ps * mode_GFS_low_cloud_000000L_20240307_000000V_000000A_cts.txt * mode_GFS_low_cloud_000000L_20240307_000000V_000000A_obj.nc * mode_GFS_low_cloud_000000L_20240307_000000V_000000A_obj.txt * mode_GFS_low_cloud_000000L_20240307_000000V_000000A.ps * mode_GFS_low_cloud_060000L_20240307_060000V_000000A_cts.txt * mode_GFS_low_cloud_060000L_20240307_060000V_000000A_obj.nc * mode_GFS_low_cloud_060000L_20240307_060000V_000000A_obj.txt * mode_GFS_low_cloud_060000L_20240307_060000V_000000A.ps * mode_GFS_low_cloud_120000L_20240307_120000V_000000A_cts.txt * mode_GFS_low_cloud_120000L_20240307_120000V_000000A_obj.nc * mode_GFS_low_cloud_120000L_20240307_120000V_000000A_obj.txt * mode_GFS_low_cloud_120000L_20240307_120000V_000000A.ps * mode_GFS_low_cloud_180000L_20240307_180000V_000000A_cts.txt * mode_GFS_low_cloud_180000L_20240307_180000V_000000A_obj.nc * mode_GFS_low_cloud_180000L_20240307_180000V_000000A_obj.txt * mode_GFS_low_cloud_180000L_20240307_180000V_000000A.ps * mode_GFS_mid_cloud_000000L_20240307_000000V_000000A_cts.txt * mode_GFS_mid_cloud_000000L_20240307_000000V_000000A_obj.nc * mode_GFS_mid_cloud_000000L_20240307_000000V_000000A_obj.txt * mode_GFS_mid_cloud_000000L_20240307_000000V_000000A.ps * mode_GFS_mid_cloud_060000L_20240307_060000V_000000A_cts.txt * mode_GFS_mid_cloud_060000L_20240307_060000V_000000A_obj.nc * mode_GFS_mid_cloud_060000L_20240307_060000V_000000A_obj.txt * mode_GFS_mid_cloud_060000L_20240307_060000V_000000A.ps * mode_GFS_mid_cloud_120000L_20240307_120000V_000000A_cts.txt * mode_GFS_mid_cloud_120000L_20240307_120000V_000000A_obj.nc * mode_GFS_mid_cloud_120000L_20240307_120000V_000000A_obj.txt * mode_GFS_mid_cloud_120000L_20240307_120000V_000000A.ps * mode_GFS_mid_cloud_180000L_20240307_180000V_000000A_cts.txt * mode_GFS_mid_cloud_180000L_20240307_180000V_000000A_obj.nc * mode_GFS_mid_cloud_180000L_20240307_180000V_000000A_obj.txt * mode_GFS_mid_cloud_180000L_20240307_180000V_000000A.ps The stat_analysis directory will contain the following files:: * stat_analysis_GFS_ANAL_West_Pacific_000000L_CTS.stat * stat_analysis_GFS_ANAL_West_Pacific_060000L_CTS.stat * stat_analysis_GFS_ANAL_West_Pacific_120000L_CTS.stat * stat_analysis_GFS_ANAL_West_Pacific_180000L_CTS.stat The reformatted directory will contain the following files:: * reformat_CTS.data The plots directory will contain the following files:: * High_low_cloud_CSI.png * High_low_cloud_FBIAS.png * High_low_cloud_GSS.png For the Grid-Stat netCDF files, 6 variable fields are present (not including the lat/lon fields). Those variables are:: * FCST_DMAP_ge50_LCDC_L0_FULL(lat, lon) * OBS_DMAP_ge50_LCDC_L0_FULL(lat, lon) * FCST_DMAP_ge50_MCDC_L0_FULL(lat, lon) * OBS_DMAP_ge50_MCDC_L0_FULL(lat, lon) * FCST_DMAP_ge50_HCDC_L0_FULL(lat, lon) * OBS_DMAP_ge50_HCDC_L0_FULL(lat, lon) For the MODE netCDF files, 18 variable fields are present (not including the lat/lon fields). Those variables are:: * fcst_raw(lat, lon) * fcst_obj_raw(lat, lon) * fcst_obj_id(lat, lon) * fcst_clus_id(lat, lon) * obs_raw(lat, lon) * obs_obj_raw(lat, lon) * obs_obj_id(lat, lon) * obs_clus_id(lat, lon) * fcst_conv_radius * obs_conv_radius * fcst_conv_threshold(fcst_thresh_length) * obs_conv_threshold(obs_thresh_length) * fcst_variable(fcst_variable_length) * obs_variable(obs_variable_length) * fcst_level(fcst_level_length) * obs_level(obs_level_length) * fcst_units(fcst_units_length) * obs_units(obs_units_length) .. GENERATED FROM PYTHON SOURCE LINES 329-347 Keywords --------- .. note:: * GridStatToolUseCase * MODEToolUseCase * StatAnalysisToolUseCase * UserScriptUseCase * ShortRangeAppUseCase * METdataioUseCase * METcalcpyUseCase * METplotpyUseCase * GRIB2FileUseCase Navigate to the :ref:`quick-search` page to discover other similar use cases. .. _sphx_glr_download_generated_model_applications_clouds_GridStat_fcstGFS_obsGFS_cloudFracLayer.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: GridStat_fcstGFS_obsGFS_cloudFracLayer.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: GridStat_fcstGFS_obsGFS_cloudFracLayer.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: GridStat_fcstGFS_obsGFS_cloudFracLayer.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_