.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated/model_applications/clouds/GridStat_fcstMPAS_obsERA5_cloudBaseHgt.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_fcstMPAS_obsERA5_cloudBaseHgt.py: GridStat: Cloud Height with Neighborhood and Probabilities ========================================================== model_applications/clouds/GridStat_fcstMPAS_obsERA5_cloudBaseHgt.conf .. GENERATED FROM PYTHON SOURCE LINES 9-13 .. contents:: :depth: 1 :local: :backlinks: none .. GENERATED FROM PYTHON SOURCE LINES 15-22 Scientific Objective -------------------- This use case captures various statistical measures of two model comparisons for cloud base height with different neighborhood settings for internal model metrics and to aid in future model updates. .. GENERATED FROM PYTHON SOURCE LINES 24-28 Version Added ------------- METplus version 5.1 .. GENERATED FROM PYTHON SOURCE LINES 30-49 Datasets -------- **Forecast:** Model for Prediction Across Scales (MPAS) **Observation:** ECMWF Reanalysis, Version 5 (ERA5) **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. **Grid:** GPP 17km masking region .. GENERATED FROM PYTHON SOURCE LINES 51-60 METplus Components ------------------ GridStat is the only MET tool called in this use case. This use case utilizes Python Embedding, which is called using the PYTHON_NUMPY keyword in the observation and forecast input template settings. The Python script is passed an input file, model name, variable field name being analyzed, the initialization and valid times, and a flag to indicate if the field passed is observation or forecast. After a successful call, a MET-readable gridded dataset is passed back to GridStat for evaluation. .. GENERATED FROM PYTHON SOURCE LINES 62-82 METplus Workflow ---------------- **Beginning time (INIT_BEG):** 2020072300 **End time (INIT_END):** 2020072300 **Increment between beginning and end times (INIT_INCREMENT):** 12H **Sequence of forecast leads to process (LEAD_SEQ):** 36 Because instance names are used, GridStat will run 2 times for this 1 initalization time. Each of the instance names correspond to different regridding, neighborhood evaluations, thresholding, output line types, and output prefix names. For the first GridStat instance, cloud base height is verified at 10 separate thresholds. The observation and forecast datasets are provided via Python Embedding. Various output line types are requested and placed in stat files, with a unique output prefix indicating which output are from which GridStat instance. All of the evaluation takes place within the masked region, read in via a poly line file. For the nbr GridStat instance, the same variable is verified, but the thresholds are expanded to include forecast and observation percentiles, ranging from 20 to 80. This instance also creates 4 neighborhoods of varying width using a circle definition. The related neighborhood line types are requested as output and a new ouput prefix is used. .. GENERATED FROM PYTHON SOURCE LINES 84-93 METplus Configuration --------------------- METplus first loads the default configuration file 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_fcstMPAS_obsERA5_cloudBaseHgt.conf .. highlight:: bash .. literalinclude:: ../../../../parm/use_cases/model_applications/clouds/GridStat_fcstMPAS_obsERA5_cloudBaseHgt.conf .. GENERATED FROM PYTHON SOURCE LINES 95-111 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 .. highlight:: bash .. literalinclude:: ../../../../parm/met_config/GridStatConfig_wrapped .. GENERATED FROM PYTHON SOURCE LINES 113-137 Python Embedding ---------------- This use case utilizes one Python script to read and process the observation and forecast fields to become METplus usable. From the configuration file it collects an input file, model name, variable field name being analyzed, the initialization and valid times, and a flag to indicate if the field passed is observation or forecast. Once the script runs, it uses the model name to extract the correct grid definition from the griddedDatasets dictionary, and the variable field name is used to extract the correct observation file variable field name (in combination with the name of the model) from the verifVariables dictionary and the correct forecast file variable name from the verifVariablesModel dictionary. This information is combined into a dictionary filled with values and keys used by the rest of the code, specifically set for the model and field being used. The grid type associated with each model (determined by the griddedDatasets dictionary) helps the script create the grid's corresponding latitude and longitude arrays. Finally, the valid and initialization times that were passed at runtime are used to finalize the attrs dictionary and the dataset is passed back to METplus for evaluation. .. dropdown:: parm/use_cases/model_applications/clouds/common/read_input_data.py .. highlight:: bash .. literalinclude:: ../../../../parm/use_cases/model_applications/clouds/common/read_input_data.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 -------------- User Scripting is not used in this use case. .. 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/clouds/GridStat_fcstMPAS_obsERA5_cloudBaseHgt.conf /path/to/user_system.conf See :ref:`running-metplus` for more information. .. GENERATED FROM PYTHON SOURCE LINES 156-180 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_fcstMPAS_obsERA5_cloudBaseHgt and will contain the following files:: * grid_stat_MPAS_to_ERA5_F36_CloudBaseHgt_360000L_20200724_120000V_pairs.nc * grid_stat_MPAS_to_ERA5_F36_CloudBaseHgt_360000L_20200724_120000V.stat * grid_stat_MPAS_to_ERA5_F36_CloudBaseHgt_NBR_360000L_20200724_120000V_pairs.nc * grid_stat_MPAS_to_ERA5_F36_CloudBaseHgt_NBR_360000L_20200724_120000V.stat The netCDF files from the first GridStat instance will contain the raw fields, difference fields, and gradient fields using the supplied masking area. For the nbr instance, there will be additional file variables for the fractional coverage fields. Each of the instance's output can be identified by an additional tag in the file name (NBR for nbr and none for the first GridStat instance). For the accompanying stat files, the first GridStat instance contains FHO, CTC, CTS, CNT, SL1L2, and GRAD line types. The nbr instance will contain only the neighborhood-related line types (NBRCTC, NBRCTS, and NBRCNT). .. GENERATED FROM PYTHON SOURCE LINES 182-194 Keywords -------- .. note:: * GridStatToolUseCase * NetCDFFileUseCase * CloudsAppUseCase * PythonEmbeddingFileUseCase Navigate to the :ref:`quick-search` page to discover other similar use cases. .. _sphx_glr_download_generated_model_applications_clouds_GridStat_fcstMPAS_obsERA5_cloudBaseHgt.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: GridStat_fcstMPAS_obsERA5_cloudBaseHgt.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: GridStat_fcstMPAS_obsERA5_cloudBaseHgt.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: GridStat_fcstMPAS_obsERA5_cloudBaseHgt.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_