.. 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_obsERA5_lowAndTotalCloudFrac.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_obsERA5_lowAndTotalCloudFrac.py: GridStat: Cloud Fractions Using GFS and ERA5 Data ================================================= model_applications/clouds/GridStat_fcstGFS_obsERA5_lowAndTotalCloudFrac.conf .. GENERATED FROM PYTHON SOURCE LINES 9-13 .. contents:: :depth: 1 :local: :backlinks: none .. GENERATED FROM PYTHON SOURCE LINES 15-21 Scientific Objective -------------------- This use case captures various statistical measures of two model comparisons for low and total cloud fractions with different neighborhood settings for internal model metrics and to aid in future model updates .. GENERATED FROM PYTHON SOURCE LINES 23-27 Version Added ------------- METplus version 5.1 .. GENERATED FROM PYTHON SOURCE LINES 29-48 Datasets -------- **Forecast:** Global Forecast System (GFS) **Observation:** ECMWF Reanalysis, Version 5 (ERA5) **Climatology:** None **Grid:** GPP 17km masking region **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-59 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 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 observation dataset is passed back to GridStat for evaluation. .. GENERATED FROM PYTHON SOURCE LINES 61-85 METplus Workflow ---------------- **Beginning time (INIT_BEG):** 2022070312 **End time (INIT_END):** 2022070312 **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 3 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, total cloud cover fraction and low cloud cover fraction are verified at 10 separate thresholds. The observation dataset is 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 variables are 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. Finally, the prob GridStat instance updates the thresholds for the two variable fields to range from 0 to 1 and changes the forecast field to probabilistic space via the FCST_IS_PROB setting. Neighborhoods using the same definitions from the nbr instance are used, and the respective line types are requested with a new output prefix for output files from this instance. .. GENERATED FROM PYTHON SOURCE LINES 88-97 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_fcstGFS_obsERA5_lowAndTotalCloudFrac.conf .. highlight:: bash .. literalinclude:: ../../../../parm/use_cases/model_applications/clouds/GridStat_fcstGFS_obsERA5_lowAndTotalCloudFrac.conf .. GENERATED FROM PYTHON SOURCE LINES 99-113 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 .. GENERATED FROM PYTHON SOURCE LINES 115-139 Python Embedding ---------------- This use case utilizes one Python script to read and process the observation 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 file variable field name (in combination with the name of the model) from the verifVariables dictionary. These are 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. A Total cloud fraction call results in the field being extracted and set to a 0-100 range with a similar behavior for low cloud cover. 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 141-145 User Scripting -------------- User Scripting is not used in this use case. .. GENERATED FROM PYTHON SOURCE LINES 147-156 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_obsERA5_lowAndTotalCloudFrac.conf /path/to/user_system.conf See :ref:`running-metplus` for more information. .. GENERATED FROM PYTHON SOURCE LINES 158-185 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_obsERA5_lowAndTotalCloudFrac and will contain the following files:: * grid_stat_GFS_to_ERA5_F36_CloudFracs_360000L_20220705_000000V_pairs.nc * grid_stat_GFS_to_ERA5_F36_CloudFracs_360000L_20220705_000000V.stat * grid_stat_GFS_to_ERA5_F36_CloudFracs_NBR_360000L_20220705_000000V_pairs.nc * grid_stat_GFS_to_ERA5_F36_CloudFracs_NBR_360000L_20220705_000000V.stat * grid_stat_GFS_to_ERA5_F36_CloudFracs_PROB_360000L_20220705_000000V_pairs.nc * grid_stat_GFS_to_ERA5_F36_CloudFracs_PROB_360000L_20220705_000000V.stat The netCDF files from the first GridStat instance and prob instance will contain the raw fields, difference fields, and gradient fields using the supplied masking area. For the nbr instance, there will be additional fields 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, PROB for prob, 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). Finally, the prob GridStat instance will contain probabilistic line types only (PCT, PSTD, PJC, and PRC). .. GENERATED FROM PYTHON SOURCE LINES 187-199 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_fcstGFS_obsERA5_lowAndTotalCloudFrac.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_obsERA5_lowAndTotalCloudFrac.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: GridStat_fcstGFS_obsERA5_lowAndTotalCloudFrac.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: GridStat_fcstGFS_obsERA5_lowAndTotalCloudFrac.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_