.. _pybacktrack_overview: Overview ======== This document gives a brief overview of the scripts inside the ``pybacktrack`` package. .. contents:: :local: :depth: 2 Running pyBacktrack ------------------- Once :ref:`installed `, the ``pybacktrack`` Python package is available to: #. :ref:`run built-in scripts ` (inside ``pybacktrack``), or #. ``import pybacktrack`` :ref:`into your own script `. It is generally easier to run the built-in scripts since you only need to specify parameters on the command-line. However you may need to create your own script if you want to combine ``pybacktrack`` functionality with other research functionality. In this case it is generally better to ``import pybacktrack``, along with the other modules, into your own script. This also gives a finer granularity of control compared to the command-line. The following two sections give an overview of both approaches. .. note:: | The input files used in the examples below (except :ref:`interpolate `) are available in the example data. | Please ensure you have :ref:`installed the example data ` before running any of these examples. .. _pybacktrack_running_the_scripts_built_into_pybacktrack: Running the scripts built into pyBacktrack ------------------------------------------ PyBacktrack is a Python package containing modules. And each module can be run as a script using ``python -m pybacktrack._cli`` followed by command line options that are specific to that module. For example, the ``backtrack`` module can be run as ``python -m pybacktrack.backtrack_cli ...``, or the ``backstrip`` module can be run as ``python -m pybacktrack.backstrip_cli ...``, with ``...`` replaced by command-line options. The following sections give an introduction to each module. .. note:: In each module you can use the ``--help`` option to see all available command-line options for that specific module. For example, ``python -m pybacktrack.backtrack_cli --help`` describes all options available to the ``backtrack`` module. .. _pybacktrack_running_the_backtrack_script: backtrack ^^^^^^^^^ The ``backtrack`` module is used to find paleo water depths from a tectonic subsidence model (such as an age-to-depth curve in ocean basins, or rifting near continental passive margins) and sediment decompaction over time. This example takes an ocean drill site as input and outputs a file containing a backtracked water depth for each age in the drill site: .. code-block:: python python -m pybacktrack.backtrack_cli -w pybacktrack_examples/example_data/ODP-114-699-Lithology.txt -d age water_depth -- ODP-114-699_backtrack_decompacted.txt ...where the ``-w`` option specifies the input drill site file ``pybacktrack_examples/example_data/ODP-114-699-Lithology.txt``, the ``-d`` option specifies the desired columns (``age`` and ``water_depth``) of the output file, and ``ODP-114-699_backtrack_decompacted.txt`` is the output file. There are other command-line options available to the ``backtrack`` module (use the ``--help`` option to list them) but they all have default values and hence only need to be specified if the default does not suit. .. seealso:: :ref:`pybacktrack_backtrack` .. _pybacktrack_running_the_backstrip_script: backstrip ^^^^^^^^^ The ``backstrip`` module is used to find tectonic subsidence (typically due to lithospheric stretching) from paleo water depths and sediment decompaction over time. This example takes a passive margin site as input and outputs a file containing a backstripped tectonic subsidence for each age in the drill site: .. code-block:: python python -m pybacktrack.backstrip_cli -w pybacktrack_examples/example_data/sunrise_lithology.txt -l primary extended -d age average_tectonic_subsidence -- sunrise_backstrip_decompacted.txt ...where the ``-w`` option specifies the input drill site file ``pybacktrack_examples/example_data/sunrise_lithology.txt``, the ``-l`` option specifies the lithology definitions, the ``-d`` option specifies the desired columns (``age`` and ``average_tectonic_subsidence``) of the output file, and ``sunrise_backstrip_decompacted.txt`` is the output file. .. note:: It is necessary to specify the bundled ``primary`` and ``extended`` lithology definitions, with ``-l primary extended``, because the input drill site references lithologies in both lithology definition files. See :ref:`pybacktrack_bundled_lithology_definitions`. This is unlike the :ref:`backtracking example ` above that only references the ``primary`` lithologies, and hence does not need to specify lithology definitions because ``primary`` is the default (when ``-l`` is not specified). .. note:: ``average_tectonic_subsidence`` is an *average* of the minimum and maximum tectonic subsidences, that are in turn a result of the minimum and maximum water depths specified in the drill site file. There are other command-line options available to the ``backstrip`` module (use the ``--help`` option to list them) but they all have default values and hence only need to be specified if the default does not suit. .. seealso:: :ref:`pybacktrack_backstrip` .. _pybacktrack_running_the_paleo_bathymetry_script: paleo_bathymetry ^^^^^^^^^^^^^^^^ The ``paleo_bathymetry`` module is used to generate paleo bathymetry grids by reconstructing and backtracking present-day sediment-covered crust through time. This example generates paleobathymetry grids at 12 minute resolution from 0Ma to 240Ma in 1Myr increments using the ``M7`` :ref:`dynamic topography model ` and the ``GDH1`` :ref:`oceanic subsidence model `: .. code-block:: python python -m pybacktrack.paleo_bathymetry_cli -gm 12 -ym M7 -m GDH1 --use_all_cpus -- 240 paleo_bathymetry_12m_M7_GDH1 ...where the ``-gm`` option specifies the grid spacing (in minutes), the ``-ym`` specifies the dynamic topography model, the ``-m`` option specifies the oceanic subsidence model, the ``--use_all_cpus`` option uses all CPUs (it also accepts an optional number of CPUs) and the generated paleobathymetry grid files are named ``paleo_bathymetry_12m_M7_GDH1_