"""
UserScript: Python Script to compute cable transport
====================================================

model_applications/marine_and_cryosphere/UserScript_fcstRTOFS_obsAOML_calcTransport.conf

"""

##############################################################################
# .. contents::
#   :depth: 1
#   :local:
#   :backlinks: none

##############################################################################
# Scientific Objective
# --------------------
# The Florida Current flows northward along the eastern Florida coast and feeds to the Gulf Stream. More info can
# be obtained from: https://www.aoml.noaa.gov/phod/floridacurrent/index.php
#
# This use case utilizes a Python script to calculate transport (units Sv) variations of the Florida current
# using a submarine cable and snapshot estimates made by shipboard instruments. The code compares the transport 
# using RTOFS data and compare it with the AOML cable transport data and computes BIAS, RMSE, CORRELATION, and 
# Scatter Index. The operational code utilizes 21 days of data and computes 7 day statistics. 
# For the use case 3 days of data are utilized. The valid date is passed though an argument. The valid date 
# is the last processed day i.e. the code grabs 3 previous days of data.    

##############################################################################
# Version Added
# -------------
#
# METplus version 5.1

##############################################################################
# Datasets
# --------
#
# **Forecast:** NOAA Real-Time Ocean Forecast System (RTOFS) 
# u(3zuio) and v(3zvio) files via Python Embedding script/file
#
# **Observations:** NOAA Atlantic Oceanographic and Meteorological Laboratory (AOML)
# Florida Current data via Python Embedding script/file
#
# **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.

##############################################################################
# External Dependencies
# ---------------------
#
# You will need to use a version of Python 3.6+ that has the following packages installed:
#
# * scikit-learn
# * pyproj
#
# 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

##############################################################################
# METplus Components
# ------------------
#
# This use case utilizes the METplus UserScript wrapper to generate a
# command to run with Python Embedding for the specified valid time. 

##############################################################################
# METplus Workflow
# ----------------
#
# This use case uses UserScript. All the gridded data being pulled from the files via Python Embedding. 
# All of the desired statistics are in the log file.
# It processes the following run time:
#
# **Beginning time (VALID_BEG):** 20211028
#
# **End time (VALID_END):** None
#
# **Increment between beginning and end times (VALID_INCREMENT):** 24H
#
# **Sequence of forecast leads to process (LEAD_SEQ):** None
# 
# The code grabs the 20211028, 20211027, and 20211026 24 hour RTOFS files. 

##############################################################################
# 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/marine_and_cryosphere/UserScript_fcstRTOFS_obsAOML_calcTransport.conf
#
# .. highlight:: bash
# .. literalinclude:: ../../../../parm/use_cases/model_applications/marine_and_cryosphere/UserScript_fcstRTOFS_obsAOML_calcTransport.conf

##############################################################################
# MET Configuration
# -----------------
#
# None. All of the processing is completed in the UserScript.

##############################################################################
# Python Embedding
# ----------------
#
# This use case does not use Python embedding.

##############################################################################
# User Scripting
# --------------
#
# This use case uses one Python script to read forecast and observation data
# as well as processing the desired statistics.
#
# .. dropdown:: parm/use_cases/model_applications/marine_and_cryosphere/UserScript_fcstRTOFS_obsAOML_calcTransport/read_aomlcable_rtofs_transport.py
#
#   .. highlight:: python
#   .. literalinclude:: ../../../../parm/use_cases/model_applications/marine_and_cryosphere/UserScript_fcstRTOFS_obsAOML_calcTransport/read_aomlcable_rtofs_transport.py

##############################################################################
# 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/marine_and_cryosphere/UserScript_fcstRTOFS_obsAOML_calcTransport.conf /path/to/user_system.conf
#
# See :ref:`running-metplus` for more information.
#

##############################################################################
# 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 use case will be found in calc_transport (relative to **OUTPUT_BASE**)
# and will contain the following files:
#
# * calc_transport.log 

##############################################################################
# Keywords
# --------
#
# .. note::
#
#   * UserScriptUseCase
#   * PythonEmbeddingFileUseCase
#   * MarineAndCryosphereAppUseCase
#
#   Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
#
#

# sphinx_gallery_thumbnail_path = '_static/marine_and_cryosphere-UserScript_fcstRTOFS_obsAOML_calcTransport.png'

