{ "cells": [ { "cell_type": "markdown", "id": "11558668", "metadata": {}, "source": [ "## Magnetostratigraphy" ] }, { "cell_type": "markdown", "id": "7a25bd23", "metadata": {}, "source": [ "**Plots magnetostratigraphic data in a thickness vs dec, inc and VGP latitude.** \n", "*Input data in an excel file with following headers:*\n", "\n", "|header |Description | \n", "|:-----------|:-------------------------------------------------------|\n", "|sample |Sample code (name) |\n", "|level (m) |Stratigraphic thickness in meters |\n", "|Ds |declination in stratigraphic coordinates |\n", "|Is |Inclination in stratigraphic coordinates |\n", "|Q |Quality rank ChRM -->[1,2,3] Secondary components --> 4 |\n", "\n", "The order and number of columns is not predetermined. Extra columns are allowed" ] }, { "cell_type": "code", "execution_count": 1, "id": "14c4efb7", "metadata": {}, "outputs": [], "source": [ "import pmagpy.pmag as pmag\n", "import pmagpy.pmagplotlib as pmagplotlib\n", "import pmagpy.ipmag as ipmag\n", "import matplotlib.pyplot as plt # our plotting buddy\n", "from pmagpy import convert_2_magic as convert\n", "import numpy as np # the fabulous NumPy package\n", "import pandas as pd # and of course Pandas\n", "has_basemap, Basemap = pmag.import_basemap()\n", "has_cartopy, Cartopy = pmag.import_cartopy()\n", "from IPython.display import Image\n", "%matplotlib inline " ] }, { "cell_type": "markdown", "id": "2b4dfb51", "metadata": {}, "source": [ "### Reading input excel file" ] }, { "cell_type": "code", "execution_count": 2, "id": "49fb1f80", "metadata": {}, "outputs": [], "source": [ "#set path to data file. excel file with column headings as \"site\", \"level (m)\", \"Ds\", \"Is\"\n", "#path not required if notebook located in the same folder\"\n", "path = '' # ADD SUBFOLDERS FROM WORKING DIR IF NEEDED. ex: Pobla_Lillet/\n", "site_name = 'MySite'\n", "file = path+'MySite_Dir_VGP.xlsx'" ] }, { "cell_type": "code", "execution_count": 3, "id": "4f3d6817", "metadata": {}, "outputs": [], "source": [ "#reading input data file\n", "xls = pd.ExcelFile(file)\n", "chrm_directions = xls.parse(0) #first sheet (0) of the excel file parsed to variable" ] }, { "cell_type": "code", "execution_count": 4, "id": "60abb939", "metadata": {}, "outputs": [], "source": [ "#shaping data frame\n", "#chrm_directions = chrm_directions.set_index('sample')\n", "# delete rows with directions of Q=4, secondary viscous component\n", "#chrm_directions = chrm_directions[chrm_directions.Q != 4]\n", "# erase rows without stratigraphic level [\"level (m)\"]\n", "chrm_directions = chrm_directions.dropna(subset=['level (m)'])\n", "# sort table by stratigraphic position\n", "chrm_directions = chrm_directions.sort_values(by=['level (m)'])" ] }, { "cell_type": "markdown", "id": "13cb1d39", "metadata": {}, "source": [ "### Magnetic polarity stratigraphy plot" ] }, { "cell_type": "code", "execution_count": 5, "id": "4c831df9", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | sample | \n", "level (m) | \n", "Ds | \n", "Is | \n", "Int(E-6A/m) | \n", "error | \n", "Q | \n", "Temp | \n", "comments | \n", "VGP lat | \n", "
---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "LL-01A | \n", "0.0 | \n", "188.0 | \n", "-20.0 | \n", "162.0 | \n", "10.0 | \n", "2 | \n", "4 | \n", "320-410 tc | \n", "-62.0 | \n", "
1 | \n", "LL-02A | \n", "2.0 | \n", "157.0 | \n", "-24.0 | \n", "1109.0 | \n", "8.0 | \n", "1 | \n", "1 | \n", "* 200-620 tc | \n", "-57.0 | \n", "
2 | \n", "LL-03A | \n", "3.0 | \n", "173.0 | \n", "-33.0 | \n", "801.0 | \n", "6.0 | \n", "1 | \n", "2 | \n", "* 350-590 tc | \n", "-69.0 | \n", "
3 | \n", "LL-04A | \n", "3.0 | \n", "20.0 | \n", "-65.0 | \n", "470.0 | \n", "16.0 | \n", "1 | \n", "2 | \n", "* 350-560 tc | \n", "3.0 | \n", "
4 | \n", "LL-05A | \n", "6.0 | \n", "184.0 | \n", "-53.0 | \n", "189.0 | \n", "9.0 | \n", "1 | \n", "2 | \n", "280-500 tc | \n", "-84.0 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
62 | \n", "LL-64B | \n", "132.0 | \n", "270.0 | \n", "-28.0 | \n", "73.0 | \n", "16.0 | \n", "2 | \n", "4 | \n", "280-350 tc | \n", "-9.0 | \n", "
63 | \n", "LL-66B | \n", "135.0 | \n", "137.0 | \n", "-8.0 | \n", "90.0 | \n", "6.0 | \n", "3 | \n", "4 | \n", "280-320 tc | \n", "-38.0 | \n", "
64 | \n", "LL-67A | \n", "135.0 | \n", "155.0 | \n", "16.0 | \n", "59.0 | \n", "8.0 | \n", "3 | \n", "4 | \n", "280-380 tc | \n", "-39.0 | \n", "
65 | \n", "LL-68A | \n", "137.0 | \n", "150.0 | \n", "-68.0 | \n", "45.0 | \n", "18.0 | \n", "3 | \n", "4 | \n", "350-440 tc | \n", "-65.0 | \n", "
66 | \n", "LL-69 | \n", "157.0 | \n", "41.0 | \n", "37.0 | \n", "305.0 | \n", "9.0 | \n", "3 | \n", "2 | \n", "350-500 tc | \n", "51.0 | \n", "
67 rows × 10 columns
\n", "