.. 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_obsCFSR_obsOnly_MJO_ENSO.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_obsCFSR_obsOnly_MJO_ENSO.py: UserScript: Make MaKE-MaKI plot from calculated MaKE and MaKI indices ===================================================================== model_applications/s2s_mjo/UserScript_obsCFSR_obsOnly_MJO_ENSO.py .. GENERATED FROM PYTHON SOURCE LINES 9-13 .. contents:: :depth: 1 :local: :backlinks: none .. GENERATED FROM PYTHON SOURCE LINES 15-21 Scientific Objective -------------------- To compute the MJO-Kelvin wave-ENSO (MaKE) and MJO-Kelvin wave-Influence (MaKI) indices* using the zonal and meridional components of winds tress (TAUX,TAUY), zonal and meridional components of surface ocean currents (UCUR,VCUR), and sea surface temperature (SST). Specifically, MaKE and MaKI indices are computed using TAUX, TAUY, UCUR, VCUR and SST data between 30S and 30N and 125E and 80W. Daily anomalies of wind stress components are filtered for 30-90 days using a Convolutional Neural Network (CNN)-based filter. The weights of the filter are computed offline. The bandpass filtered wind stress components are projected onto 4 Empirical Orthogonal Functions (EOFs) data. The obtained timeseries (PCs) are standardized and combined with the EOFs to obtain the MJO component of the surface wind stress (TAUX_MJO,TAUY_MJO). UCUR and VCUR daily anomalies are multiplied by the meridional structure of Kelvin wave (UCUR_K,VCUR_K). Windpower due to the MJO component of the wind stress and oceanic Kelvin waves (W_MJO,K) is then computed as TAUX_MJO*UCUR_K+TAUY_MJO*VCUR_K. The standardized windpower and SST are projected onto the first two multivariate EOFs of W_MJO,K and SST. The resulting daily time series (PCs) are normalized and used to compute monthly values of MaKE and MaKI. Monthly values of MaKE and MaKI are saved into a text (.csv) file and plotted as time series. * Lybarger, N.D., C.-S. Shin, and C. Stan, 2020: MJO Wind energy and prediction of El Nino, Journal of Geophysical Research - Oceans, 125, e2020JC016732. doi:10.1029/2020JC016732 .. GENERATED FROM PYTHON SOURCE LINES 23-27 Version Added ------------- METplus version 5.0 .. GENERATED FROM PYTHON SOURCE LINES 29-46 Datasets -------- **Forecast:** None **Observation:** Climate Forecast System Reanalysis (CFSR) Reanalysis **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 48-67 External Dependencies --------------------- You will need to use a version of Python 3.6+ that has the following packages installed:: * numpy * netCDF4 * datetime * xarray * matplotlib * pandas If the version of Python used to compile MET did not have these libraries at the time of compilation, you will need to add these packages or create a new Python environment with these packages. If this is the case, you will need to set the MET_PYTHON_EXE environment variable to the path of the version of Python you want to use. If you want this version of Python to only apply to this use case, set it in the [user_env_vars] section of a METplus configuration file.: [user_env_vars] MET_PYTHON_EXE = /path/to/python/with/required/packages/bin/python .. GENERATED FROM PYTHON SOURCE LINES 69-73 METplus Components ------------------ This use case runs the MJO-ENSO driver, which first computes the MJO components of taux and tauy, then the MJO wind power, the MJO-ENSO indices, their plot. Inputs to the MJO-ENSO driver include netCDF files that are in MET's netCDF version. In addition, a text file containing the listing of these input netCDF files for taux, tauy, u, v, and SST is required. Some optional pre-processing steps include RegridDataPlane for regridding the data. .. GENERATED FROM PYTHON SOURCE LINES 75-87 METplus Workflow ---------------- **Beginning time (VALID_BEG):** 19900101 **End time (VALID_END):** 20211231 **Increment between beginning and end times (VALID_INCREMENT):** 86400 **Sequence of forecast leads to process (LEAD_SEQ):** 0 The MJO-ENSO driver script python code is run for each lead time on the forecast and observations data. This example loops by valid time for the model pre-processing, and valid time for the other steps. This version is set to only process the regridding, and MaKE and MaKI calculation, omitting the caluclation of the mean daily annucal cycle and daily anomalies pre-processing steps. However, the configurations for pre-processing are available for user reference. .. GENERATED FROM PYTHON SOURCE LINES 89-100 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_obsCFSR_obsOnly_MJO_ENSO.conf. The file UserScript_obsCFSR_obsOnly_MJO_ENSO/mjo_enso_driver.py runs the python program and UserScript_obsCFSR_obsOnly_MJO_ENSO.conf sets the variables for all steps of the MJO-ENSO use case. .. highlight:: bash .. literalinclude:: ../../../../parm/use_cases/model_applications/s2s_mjo/UserScript_obsCFSR_obsOnly_MJO_ENSO.conf .. GENERATED FROM PYTHON SOURCE LINES 102-106 MET Configuration ----------------- There are no MET tools used in this use case. .. GENERATED FROM PYTHON SOURCE LINES 108-112 Python Embedding ---------------- Python Embedding is not used in this use case. .. GENERATED FROM PYTHON SOURCE LINES 114-124 User Scripting -------------- The MJO-ENSO driver script orchestrates the calculation of the MaKE and MaKI indices and the generation of a text file and a plot for the indices: .. dropdown:: parm/use_cases/model_applications/s2s_mjo/UserScript_obsCFSR_obsOnly_MJO_ENSO/mjo_enso_driver.py .. highlight:: python .. literalinclude:: ../../../../parm/use_cases/model_applications/s2s_mjo/UserScript_obsCFSR_obsOnly_MJO_ENSO/mjo_enso_driver.py .. GENERATED FROM PYTHON SOURCE LINES 126-135 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_mjo/UserScript_obsCFSR_obsOnly_MJO_ENSO.conf /path/to/user_system.conf See :ref:`running-metplus` for more information. .. GENERATED FROM PYTHON SOURCE LINES 137-142 Expected Output --------------- 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 model_applications/s2s_mjo/UserScript_obsCFSR_obsOnly_MJO_ENSO. This may include the regridded data. In addition, a text (.csv) file will be generated and a time serie plot. The name of the text file can be specified as MAKE_MAKI_OUTPUT_TEXT_FILE. The output location can be specified as PLOT_OUTPUT_DIR. If it is not specified, plot will be sent to model_applications/s2s_mjo/UserScript_obsCFSR_obsOnly_MJO_ENSO/plots (relative to **OUTPUT_BASE**). The name of the plot file can be specified as OBS_PLOT_OUTPUT_NAME. .. GENERATED FROM PYTHON SOURCE LINES 144-160 Keywords -------- .. note:: * S2SAppUseCase * S2SMJOAppUseCase * NetCDFFileUseCase * RegridDataPlaneUseCase * PCPCombineUseCase * METcalcpyUseCase * METplotpyUseCase Navigate to :ref:`quick-search` to discover other similar use cases. .. GENERATED FROM PYTHON SOURCE LINES 160-162 .. code-block:: Python # .. _sphx_glr_download_generated_model_applications_s2s_mjo_UserScript_obsCFSR_obsOnly_MJO_ENSO.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: UserScript_obsCFSR_obsOnly_MJO_ENSO.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: UserScript_obsCFSR_obsOnly_MJO_ENSO.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: UserScript_obsCFSR_obsOnly_MJO_ENSO.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_