.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_RMM.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_s2s_mjo_UserScript_obsERA_obsOnly_RMM.py: UserScript: Make ERA RMM plots from calculated MJO indices ========================================================== model_applications/s2s_mjo/UserScript_obsERA_obsOnly_RMM.py .. GENERATED FROM PYTHON SOURCE LINES 9-13 .. contents:: :depth: 1 :local: :backlinks: none .. GENERATED FROM PYTHON SOURCE LINES 15-29 Scientific Objective -------------------- The Madden-Julian Oscillation (MJO) is the largest element of intraseasonal variability in the tropics and is characterized by eastward moving regions of enhanced and suppressed rainfall. These phases are typically grouped into numbers 1 - 8 based on the geographic location of the enhanced and suppressed rainfall. The MJO affects global weather including summer monsoons, tropical cyclone development, and sudden stratospheric warming events, and has teleconnections to mid latitude weather systems. This use case uses anomalies of outgoing longwave radiation (OLR), 850 hPa wind (U850), and 200 hPa wind (U200) to compute the Real-time Multivariate MJO Index (RMM). In contrast to OMI, which is a convective index of MJO, RMM is a dynamical index. The code for computing RMM came from Maria Gehne at the NOAA Physical Sciences Laboratory (PSL). .. GENERATED FROM PYTHON SOURCE LINES 31-35 Version Added ------------- METplus version 4.1.0 .. GENERATED FROM PYTHON SOURCE LINES 37-56 Datasets -------- **Forecast:** None **Observation:** ERA Reanlaysis Outgoing Longwave Radiation, 850 hPa wind and 200 hPa wind, 2000 - 2002 **Climatology:** **EOFs:** EOF patterns for OLR, U850, and U200 from Matthew Wheeler **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 58-76 METplus Components ------------------ This use case calls UserScript 5 times and Regrid-Data-Plane three times. The UserScript calls run the harmonic pre-processing on all three variables, create a filelist, and run the RMM calculation. There are four optional pre-processing steps. This use case requires METcalcpy, METplotpy, and METdataio to run. The METcalcpy scripts accessed include the following: * metcalcpy/contributed/rmm_omi/compute_mjo_indices.py The METplotpy scripts accessed include the following: * metplotpy/contributed/mjo_rmm_omi/plot_mjo_indioces.py The METdataio scripts accessed include the following: * METreadnc/util/read_netcdf.py .. GENERATED FROM PYTHON SOURCE LINES 78-112 METplus Workflow ---------------- **Beginning time (VALID_BEG):** 01-01-2000 **End time (VALID_END):** 12-30-2002 **Increment between beginning and end times (INIT_INCREMENT):** 1 day **Sequence of forecast leads to process (LEAD_SEQ):** 0 hour The UserScript calls do not loop, but are each run once. The first call creates a list of the mean daily annual data files for OLR, U850, and U200. It is done separately since the mean daily annual files span across all years whereas the RMM calculation can proceed on a different time frame. The second, third, and fourth calls to UserScript run the pre-processing to compute anomalies OLR, U850, and U200 using a harmonic analysis program in python. Then, RegridDataPlane is run for all valid times for the 3 variables. This step cuts the grid to only include -15 to 15 latitude. Finally, the last (fifth) call to UserScript runs the RMM calculation once on the observations. There are four optional pre-processing steps loop by valid time with different timing settings needed for the different steps. These steps are turned off due to data size and processing time. Two of the steps are calls to Pcp-Combine to compute the mean daily annual data for OLR, wind (U850 and U200). The other two steps also call Pcp-Combine but these compute daily means for OLR and wind. These omitted steps can be turned back on by using the PROCESS_LIST that is commented out in the file: PROCESS_LIST = PcpCombine(mean_daily_annual_cycle_obs_wind), PcpCombine(mean_daily_annual_cycle_obs_olr), PcpCombine(daily_mean_obs_wind), PcpCombine(daily_mean_obs_olr), UserScript(create_mda_filelist), UserScript(harmonic_anomalies_olr), UserScript(harmonic_anomalies_u850), UserScript(harmonic_anomalies_u200), RegridDataPlane(regrid_obs_olr), RegridDataPlane(regrid_obs_u850), RegridDataPlane(regrid_obs_u200), UserScript(script_rmm) Settings for the optional pre-processing steps can be found in the respective sections of the configuration, mean_daily_annual_cycle_obs_wind, mean_daily_annual_cycle_obs_olr, daily_mean_obs_wind, and daily_mean_obs_olr. Data is not provided in the tarball to run these steps, but the configurations is provided for reference on how to set up these calculations. The Phase diagram and timeseries plots are created over a different time frame, 01-01-2002 to 12-30-2002 for both plots. .. GENERATED FROM PYTHON SOURCE LINES 114-123 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/s2s_mjo/UserScript_obsERA_obsOnly_RMM.conf. .. highlight:: bash .. literalinclude:: ../../../../parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_RMM.conf .. GENERATED FROM PYTHON SOURCE LINES 125-129 MET Configuration ----------------- There are no MET configuration files used in this use case. .. GENERATED FROM PYTHON SOURCE LINES 131-135 Python Embedding ---------------- This use case does not use Python embedding. .. GENERATED FROM PYTHON SOURCE LINES 137-164 User Scripting -------------- There are two Python scripts used in this use case. The RMM driver script (RMM_driver.py) orchestrates the calculation of the MJO indices and the generation of three RMM plots. The calculation proceeds using OLR, U850, and U200 data between 15N and 15S. The 120 day mean is first removed and the data are normalized by normalization factors (generally the square root of the average variance). The anomalies are projected onto Empirical Orthogonal Function (EOF) data. The OLR is then filtered for 20 - 96 days, and regressed onto the daily EOFs. Finally, it's normalized and these normalized components are plotted on a phase diagram and timeseries plot. The anomalies are created using a harmonic analysis for OLR, U850, and U200 with the Python script compute_harmonic_anomalies.py. Input to the harmonic analysis script include a text file containing the list of input files, the daily mean variable name, mean daily average varable name, output directory and output file basename. These are defined in the [harmonic_anomalies_olr], [harmonic_anomalies_u850], and harmonic_anomalies_u200] sections of the configuration file. Additional variables for the RMM calculation and harmonic analysis are set in the [user_env_vars] section of the .conf file. .. dropdown:: parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_RMM/RMM_driver.py .. highlight:: python .. literalinclude:: ../../../../parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_RMM/RMM_driver.py .. dropdown:: parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_RMM/compute_harmonic_anomalies.py .. highlight:: python .. literalinclude:: ../../../../parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_RMM/compute_harmonic_anomalies.py .. GENERATED FROM PYTHON SOURCE LINES 166-176 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/s2s_stratosphere/UserScript_obsERA_obsOnly_RMM.conf /path/to/user_system.conf See :ref:`running-metplus` for more information. .. GENERATED FROM PYTHON SOURCE LINES 178-219 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/s2s_mjo/UserScript_obsERA_obsOnly_RMM/plots. The output may include the regridded data and daily averaged files if those steps are turned on. Three output plots will be generated, a phase diagram, time series, and EOF plot:: * obs_RMM_comp_phase.png * obs_RMM_time_series.png * RMM_EOFs.png Output from the Harmonic analysis pre-processing includes multiple files, one for each variable and day in the following format:: * ERA_OLR_anom_000000L_YYYYMMDD_000000V.nc * ERA_U200_anom_000000L_YYYYMMDD_000000V.nc * ERA_U850_anom_000000L_YYYYMMDD_000000V.nc One variabe is output in each of the above files (not including the lat/lon fields). Those variables are:: * olr_anom(lat, lon) * U_P200_mean_anom(lat, lon) * U_P850_mean_anom(lat, lon) Output from the regridding also includes one file for each day and variable with the following format:: * ERA_OLR_YYYYMMDD.nc * ERA_U200_YYYYMMDD.nc * ERA_U850_YYYYMMDD.nc One variabe is output in each of the regriddwed files (not including the lat/lon fields). Those variables are:: * OLR_anom(lat, lon) * U_P200_anom(lat, lon) * U_P850_anom(lat, lon) .. GENERATED FROM PYTHON SOURCE LINES 221-238 Keywords -------- .. note:: * S2SAppUseCase * S2SMJOAppUseCase * UserScriptUseCase * NetCDFFileUseCase * RegridDataPlaneUseCase * PCPCombineUseCase * METdataioUseCase * METcalcpyUseCase * METplotpyUseCase Navigate to :ref:`quick-search` to discover other similar use cases. .. _sphx_glr_download_generated_model_applications_s2s_mjo_UserScript_obsERA_obsOnly_RMM.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: UserScript_obsERA_obsOnly_RMM.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: UserScript_obsERA_obsOnly_RMM.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: UserScript_obsERA_obsOnly_RMM.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_