From a9789d714604ab1fc01ffc46c38e5dcd83cefce0 Mon Sep 17 00:00:00 2001 From: Varun Ratnakar Date: Mon, 9 Sep 2024 22:31:26 +0530 Subject: [PATCH] Updated doc --- examples/notebooks/oop_demo.ipynb | 711 +++++++++++++++++++----------- 1 file changed, 450 insertions(+), 261 deletions(-) diff --git a/examples/notebooks/oop_demo.ipynb b/examples/notebooks/oop_demo.ipynb index 6dd39ec..40d2c8c 100644 --- a/examples/notebooks/oop_demo.ipynb +++ b/examples/notebooks/oop_demo.ipynb @@ -44,7 +44,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -58,7 +58,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|██████████| 16/16 [00:00<00:00, 67.10it/s]\n" + "100%|██████████| 16/16 [00:00<00:00, 58.37it/s]\n" ] }, { @@ -70,9 +70,9 @@ "\n", "Ocn-RedSea.Felis.2000\n", "=========================\n", - "Publication: A coral oxygen isotope record from the northern Red Sea documenting NAO, ENSO, and North Pacific teleconnections on Middle East climate variability since the year 1750 by ['Ahmed H. Nawar', 'Maoz Fine', 'Yossi Loya', 'Jürgen Pätzold', 'Thomas Felis', 'Gerold Wefer']\n", - "Publication: Tropical sea surface temperatures for the past four centuries reconstructed from coral archives by ['Jens Zinke', 'Kevin J. Anchukaitis', 'Nerilie J. Abram', 'Casey P. Saenger', 'Henry C. Wu', 'Jessica E. Tierney', 'Cyril Giry', 'K. Halimeda Kilbourne', 'Michael N. Evans']\n", - "Publication: World Data Center for Paleoclimatology by ['T. Felis']\n", + "Publication: A coral oxygen isotope record from the northern Red Sea documenting NAO, ENSO, and North Pacific teleconnections on Middle East climate variability since the year 1750 by ['Jürgen Pätzold', 'Maoz Fine', 'Yossi Loya', 'Thomas Felis', 'Gerold Wefer', 'Ahmed H. Nawar'] at Paleoceanography\n", + "Publication: Tropical sea surface temperatures for the past four centuries reconstructed from coral archives by ['Jessica E. Tierney', 'K. Halimeda Kilbourne', 'Jens Zinke', 'Kevin J. Anchukaitis', 'Nerilie J. Abram', 'Casey P. Saenger', 'Cyril Giry', 'Michael N. Evans', 'Henry C. Wu'] at Paleoceanography\n", + "Publication: World Data Center for Paleoclimatology by ['T. Felis'] at None\n", "- Paleo Table: Ocn-RedSea.Felis.2000.paleo1measurement1.csv\n" ] }, @@ -154,8 +154,8 @@ "\n", "Ant-WAIS-Divide.Severinghaus.2012\n", "=========================\n", - "Publication: This study by ['Severinghaus J.']\n", - "Publication: Little Ice Age cold interval in West Antarctica: Evidence from borehole temperature at the West Antarctic Ice Sheet (WAIS) Divide by ['Bruce D. Cornuelle', 'Anais J. Orsi', 'Jeffrey P. Severinghaus']\n", + "Publication: Little Ice Age cold interval in West Antarctica: Evidence from borehole temperature at the West Antarctic Ice Sheet (WAIS) Divide by ['Bruce D. Cornuelle', 'Anais J. Orsi', 'Jeffrey P. Severinghaus'] at Geophysical Research Letters\n", + "Publication: This study by ['Severinghaus J.'] at None\n", "- Paleo Table: Ant-WAIS-Divide.Severinghaus.2012.paleo1measurement1.csv\n" ] }, @@ -244,8 +244,8 @@ "\n", "Asi-SourthAndMiddleUrals.Demezhko.2007\n", "=========================\n", - "Publication: Climatic changes in the Urals over the past millennium; an analysis of geothermal and meteorological data by ['D. Yu. Demezhko', 'I. V. Golovanova']\n", - "Publication: This study by ['D Demezhko']\n", + "Publication: This study by ['D Demezhko'] at None\n", + "Publication: Climatic changes in the Urals over the past millennium; an analysis of geothermal and meteorological data by ['I. V. Golovanova', 'D. Yu. Demezhko'] at Climate of the Past\n", "- Paleo Table: Asi-SourthAndMiddleUrals.Demezhko.2007.paleo1measurement1.csv\n" ] }, @@ -328,14 +328,14 @@ "Ocn-AlboranSea436B.Nieto-Moreno.2013\n", "=========================\n", "Funding: ['Research Group 0179']\n", - "Funding: ['CTM2009-7715']\n", + "Funding: ['200800050084447 (MARM)']\n", "Funding: ['FP7/2007-2013)/ERC Grant Agreement #226600']\n", + "Funding: ['CTM2009-7715']\n", "Funding: ['CGL2009-07603']\n", - "Funding: ['200800050084447 (MARM)']\n", "Funding: ['Project RNM 05212']\n", - "Publication: PANGAEA by ['V. Nieto-Moreno']\n", - "Publication: Climate conditions in the westernmost Mediterranean over the last two millennia: An integrated biomarker approach by ['P. Masqué', 'J. García-Orellana', 'V. Willmott', 'V. Nieto-Moreno', 'J.S. Sinninghe Damsté', 'F. Martínez-Ruiz']\n", - "Publication: Robust global ocean cooling trend for the pre-industrial Common Era by ['Helen V. McGregor', 'Helena L. Filipsson', 'Steven J. Phipps', 'Marit-Solveig Seidenkrantz', 'Jason A. Addison', 'Hugues Goosse', 'Vasile Ersek', 'Marie-Alexandrine Sicre', 'Belen Martrat', 'Kandasamy Selvaraj', 'P. Graham Mortyn', 'Guillaume Leduc', 'Delia W. Oppo', 'Michael N. Evans', 'Kaustubh Thirumalai']\n", + "Publication: PANGAEA by ['V. Nieto-Moreno'] at None\n", + "Publication: Robust global ocean cooling trend for the pre-industrial Common Era by ['Helen V. McGregor', 'Steven J. Phipps', 'Jason A. Addison', 'Belen Martrat', 'Hugues Goosse', 'Vasile Ersek', 'P. Graham Mortyn', 'Delia W. Oppo', 'Marie-Alexandrine Sicre', 'Michael N. Evans', 'Kaustubh Thirumalai', 'Kandasamy Selvaraj', 'Guillaume Leduc', 'Helena L. Filipsson', 'Marit-Solveig Seidenkrantz'] at Nature Geoscience\n", + "Publication: Climate conditions in the westernmost Mediterranean over the last two millennia: An integrated biomarker approach by ['J. García-Orellana', 'V. Willmott', 'V. Nieto-Moreno', 'F. Martínez-Ruiz', 'P. Masqué', 'J.S. Sinninghe Damsté'] at Organic Geochemistry\n", "- Paleo Table: Ocn-AlboranSea436B.Nieto-Moreno.2013.paleo1measurement1.csv\n" ] }, @@ -417,8 +417,8 @@ "\n", "Eur-SpannagelCave.Mangini.2005\n", "=========================\n", - "Publication: Reconstruction of temperature in the Central Alps during the past 2000 yr from a δ18O stalagmite record by ['P. Verdes', 'A. Mangini', 'C. Spötl']\n", - "Publication: World Data Center for Paleoclimatology by ['A. Mangini']\n", + "Publication: Reconstruction of temperature in the Central Alps during the past 2000 yr from a δ18O stalagmite record by ['A. Mangini', 'P. Verdes', 'C. Spötl'] at Earth and Planetary Science Letters\n", + "Publication: World Data Center for Paleoclimatology by ['A. Mangini'] at None\n", "- Paleo Table: Eur-SpannagelCave.Mangini.2005.paleo1measurement1.csv\n" ] }, @@ -500,9 +500,9 @@ "\n", "Ocn-FeniDrift.Richter.2009\n", "=========================\n", - "Publication: Late Holocene (0–2.4kaBP) surface water temperature and salinity variability, Feni Drift, NE Atlantic Ocean by ['T.C.E. van Weering', 'F.J.C. Peeters', 'T.O. Richter']\n", - "Publication: Robust global ocean cooling trend for the pre-industrial Common Era by ['Hugues Goosse', 'P. Graham Mortyn', 'Marie-Alexandrine Sicre', 'Guillaume Leduc', 'Marit-Solveig Seidenkrantz', 'Jason A. Addison', 'Belen Martrat', 'Vasile Ersek', 'Delia W. Oppo', 'Michael N. Evans', 'Kaustubh Thirumalai', 'Kandasamy Selvaraj', 'Helena L. Filipsson', 'Helen V. McGregor', 'Steven J. Phipps']\n", - "Publication: World Data Center for Paleoclimatology by ['T.O. Richter']\n", + "Publication: Late Holocene (0–2.4kaBP) surface water temperature and salinity variability, Feni Drift, NE Atlantic Ocean by ['F.J.C. Peeters', 'T.O. Richter', 'T.C.E. van Weering'] at Quaternary Science Reviews\n", + "Publication: Robust global ocean cooling trend for the pre-industrial Common Era by ['Helen V. McGregor', 'Guillaume Leduc', 'Steven J. Phipps', 'Marit-Solveig Seidenkrantz', 'Marie-Alexandrine Sicre', 'Jason A. Addison', 'Belen Martrat', 'Delia W. Oppo', 'Michael N. Evans', 'Kaustubh Thirumalai', 'Helena L. Filipsson', 'Vasile Ersek', 'Hugues Goosse', 'Kandasamy Selvaraj', 'P. Graham Mortyn'] at Nature Geoscience\n", + "Publication: World Data Center for Paleoclimatology by ['T.O. Richter'] at None\n", "- Paleo Table: Ocn-FeniDrift.Richter.2009.paleo2measurement1.csv\n" ] }, @@ -696,8 +696,8 @@ "\n", "Eur-LakeSilvaplana.Trachsel.2010\n", "=========================\n", - "Publication: Scanning reflectance spectroscopy (380–730 nm): a novel method for quantitative high-resolution climate reconstructions from minerogenic lake sediments by ['M. Grosjean', 'M. Trachsel', 'C. Kamenik', 'D. Schnyder', 'B. Rein']\n", - "Publication: World Data Center for Paleoclimatology by ['M. Trachsel']\n", + "Publication: Scanning reflectance spectroscopy (380–730 nm): a novel method for quantitative high-resolution climate reconstructions from minerogenic lake sediments by ['M. Grosjean', 'M. Trachsel', 'D. Schnyder', 'C. Kamenik', 'B. Rein'] at Journal of Paleolimnology\n", + "Publication: World Data Center for Paleoclimatology by ['M. Trachsel'] at None\n", "- Paleo Table: Eur-LakeSilvaplana.Trachsel.2010.paleo1measurement1.csv\n" ] }, @@ -779,8 +779,8 @@ "\n", "Ocn-PedradeLume-CapeVerdeIslands.Moses.2006\n", "=========================\n", - "Publication: Evidence of multidecadal salinity variability in the eastern tropical North Atlantic by ['Brad E. Rosenheim', 'Christopher S. Moses', 'Peter K. Swart']\n", - "Publication: World Data Center for Paleoclimatology by ['C.S. Moses']\n", + "Publication: World Data Center for Paleoclimatology by ['C.S. Moses'] at None\n", + "Publication: Evidence of multidecadal salinity variability in the eastern tropical North Atlantic by ['Peter K. Swart', 'Brad E. Rosenheim', 'Christopher S. Moses'] at Paleoceanography\n", "- Paleo Table: Ocn-PedradeLume-CapeVerdeIslands.Moses.2006.paleo1measurement1.csv\n" ] }, @@ -862,9 +862,9 @@ "\n", "Ocn-SinaiPeninsula,RedSea.Moustafa.2000\n", "=========================\n", - "Publication: Mid-Holocene stable isotope record of corals from the northern Red Sea by ['Jürgen Pätzold', 'Yossi Loya', 'Gerold Wefer', 'Yaser Ahmed Moustafa']\n", - "Publication: Tropical sea surface temperatures for the past four centuries reconstructed from coral archives by ['Jens Zinke', 'Henry C. Wu', 'Kevin J. Anchukaitis', 'Nerilie J. Abram', 'Casey P. Saenger', 'Cyril Giry', 'Michael N. Evans', 'Jessica E. Tierney', 'K. Halimeda Kilbourne']\n", - "Publication: PANGAEA by ['Y.A. Moustafa']\n", + "Publication: Tropical sea surface temperatures for the past four centuries reconstructed from coral archives by ['Jens Zinke', 'Kevin J. Anchukaitis', 'Nerilie J. Abram', 'Casey P. Saenger', 'Cyril Giry', 'Michael N. Evans', 'Henry C. Wu', 'Jessica E. Tierney', 'K. Halimeda Kilbourne'] at Paleoceanography\n", + "Publication: PANGAEA by ['Y.A. Moustafa'] at None\n", + "Publication: Mid-Holocene stable isotope record of corals from the northern Red Sea by ['Gerold Wefer', 'Yaser Ahmed Moustafa', 'Jürgen Pätzold', 'Yossi Loya'] at Berichte, Fachbereich Geowissenschaften, Universität Bremen\n", "- Paleo Table: Ocn-SinaiPeninsula,RedSea.Moustafa.2000.paleo1measurement1.csv\n" ] }, @@ -946,8 +946,8 @@ "\n", "Eur-NorthernSpain.Martin-Chivelet.2011\n", "=========================\n", - "Publication: World Data Center for Paleoclimatology by ['J. Martín-Chivelet']\n", - "Publication: Land surface temperature changes in northern Iberia since 4000 yr BP, based on δ13C of speleothems by ['Javier Martín-Chivelet', 'M. Belén Muñoz-García', 'Ana I. Ortega', 'R. Lawrence Edwards', 'María J. Turrero']\n", + "Publication: Land surface temperature changes in northern Iberia since 4000 yr BP, based on δ13C of speleothems by ['Javier Martín-Chivelet', 'M. Belén Muñoz-García', 'Ana I. Ortega', 'R. Lawrence Edwards', 'María J. Turrero'] at Global and Planetary Change\n", + "Publication: World Data Center for Paleoclimatology by ['J. Martín-Chivelet'] at None\n", "- Paleo Table: Eur-NorthernSpain.Martin-Chivelet.2011.paleo1measurement1.csv\n" ] }, @@ -1029,8 +1029,8 @@ "\n", "Arc-Kongressvatnet.D'Andrea.2012\n", "=========================\n", - "Publication: World Data Center for Paleoclimatology by [\"W.J. D'Andrea\"]\n", - "Publication: Mild Little Ice Age and unprecedented recent warmth in an 1800 year lake sediment record from Svalbard by ['S. R. Roof', 'N. L. Balascio', \"W. J. D'Andrea\", 'A. Werner', 'M. Retelle', 'R. S. Bradley', 'D. A. Vaillencourt']\n", + "Publication: World Data Center for Paleoclimatology by [\"W.J. D'Andrea\"] at None\n", + "Publication: Mild Little Ice Age and unprecedented recent warmth in an 1800 year lake sediment record from Svalbard by ['S. R. Roof', \"W. J. D'Andrea\", 'A. Werner', 'M. Retelle', 'N. L. Balascio', 'R. S. Bradley', 'D. A. Vaillencourt'] at Geology\n", "- Paleo Table: Arc-Kongressvatnet.D'Andrea.2012.paleo1measurement1.csv\n" ] }, @@ -1119,8 +1119,8 @@ "\n", "Eur-CoastofPortugal.Abrantes.2011\n", "=========================\n", - "Publication: Climate of the last millennium at the southern pole of the North Atlantic Oscillation: an inner-shelf sediment record of flooding and upwelling by ['L Witt', 'F Abrantes', 'AHL Voelker', 'C Lopes', 'B Montanari', 'C Santos', 'T Rodrigues']\n", - "Publication: PANGAEA by ['F. Abrantes']\n", + "Publication: PANGAEA by ['F. Abrantes'] at None\n", + "Publication: Climate of the last millennium at the southern pole of the North Atlantic Oscillation: an inner-shelf sediment record of flooding and upwelling by ['F Abrantes', 'L Witt', 'AHL Voelker', 'C Lopes', 'C Santos', 'T Rodrigues', 'B Montanari'] at Climate Research\n", "- Paleo Table: Eur-CoastofPortugal.Abrantes.2011.paleo1measurement1.csv\n" ] }, @@ -1202,8 +1202,8 @@ "\n", "Eur-SpanishPyrenees.Dorado-Linan.2012\n", "=========================\n", - "Publication: Estimating 750 years of temperature variations and uncertainties in the Pyrenees by tree-ring reconstructions and climate simulations by ['I. Dorado Liñán', 'E. Gutiérrez', 'J. P. Montávez', 'M. Brunet', 'G. Helle', 'U. Büntgen', 'I. Heinrich', 'E. Zorita', 'J. J. Gómez-Navarro', 'F. González-Rouco']\n", - "Publication: World Data Center for Paleoclimatology by ['I. Dorado-Linan']\n", + "Publication: World Data Center for Paleoclimatology by ['I. Dorado-Linan'] at None\n", + "Publication: Estimating 750 years of temperature variations and uncertainties in the Pyrenees by tree-ring reconstructions and climate simulations by ['M. Brunet', 'G. Helle', 'J. J. Gómez-Navarro', 'U. Büntgen', 'I. Heinrich', 'F. González-Rouco', 'E. Zorita', 'I. Dorado Liñán', 'E. Gutiérrez', 'J. P. Montávez'] at Climate of the Past\n", "- Paleo Table: Eur-SpanishPyrenees.Dorado-Linan.2012.paleo1measurement1.csv\n" ] }, @@ -1285,8 +1285,8 @@ "\n", "Eur-FinnishLakelands.Helama.2014\n", "=========================\n", - "Publication: World Data Center for Paleoclimatology by ['S. Helama']\n", - "Publication: A palaeotemperature record for the Finnish Lakeland based on microdensitometric variations in tree rings by ['Taneli Kolström', 'Samuli Helama', 'Jari Holopainen', 'Matti Vartiainen', 'Hanna Mäkelä', 'Jouko Meriläinen']\n", + "Publication: A palaeotemperature record for the Finnish Lakeland based on microdensitometric variations in tree rings by ['Taneli Kolström', 'Samuli Helama', 'Jari Holopainen', 'Matti Vartiainen', 'Hanna Mäkelä', 'Jouko Meriläinen'] at Geochronometria\n", + "Publication: World Data Center for Paleoclimatology by ['S. Helama'] at None\n", "- Paleo Table: Eur-FinnishLakelands.Helama.2014.paleo1measurement1.csv\n" ] }, @@ -1368,8 +1368,8 @@ "\n", "Eur-NorthernScandinavia.Esper.2012\n", "=========================\n", - "Publication: Orbital forcing of tree-ring data by ['Jürg Luterbacher', 'Jan Esper', 'Eduardo Zorita', 'Daniel Nievergelt', 'Nils Fischer', 'Steffen Holzkämper', 'Mauri Timonen', 'David C. Frank', 'Ulf Büntgen', 'Rob J. S. Wilson', 'Anne Verstege', 'Sebastian Wagner']\n", - "Publication: World Data Center for Paleoclimatology by ['J. Esper']\n", + "Publication: Orbital forcing of tree-ring data by ['Mauri Timonen', 'Steffen Holzkämper', 'David C. Frank', 'Jürg Luterbacher', 'Ulf Büntgen', 'Rob J. S. Wilson', 'Jan Esper', 'Anne Verstege', 'Sebastian Wagner', 'Eduardo Zorita', 'Nils Fischer', 'Daniel Nievergelt'] at Nature Climate Change\n", + "Publication: World Data Center for Paleoclimatology by ['J. Esper'] at None\n", "- Paleo Table: Eur-NorthernScandinavia.Esper.2012.paleo1measurement1.csv\n" ] }, @@ -1451,8 +1451,8 @@ "\n", "Eur-Stockholm.Leijonhufvud.2009\n", "=========================\n", - "Publication: Five centuries of Stockholm winter/spring temperatures reconstructed from documentary evidence and instrumental observations by ['Rob Wilson', 'Anders Moberg', 'Lotta Leijonhufvud', 'Dag Retsö', 'Johan Söderberg', 'Ulrica Söderlind']\n", - "Publication: World Data Center for Paleoclimatology by ['L. Leijonhufvud']\n", + "Publication: Five centuries of Stockholm winter/spring temperatures reconstructed from documentary evidence and instrumental observations by ['Ulrica Söderlind', 'Rob Wilson', 'Lotta Leijonhufvud', 'Anders Moberg', 'Dag Retsö', 'Johan Söderberg'] at Climatic Change\n", + "Publication: World Data Center for Paleoclimatology by ['L. Leijonhufvud'] at None\n", "- Paleo Table: Eur-Stockholm.Leijonhufvud.2009.paleo1measurement1.csv\n" ] }, @@ -1546,7 +1546,9 @@ "D = LiPD()\n", "D.load_from_dir(path)\n", "\n", - "# Convert the LiPD datasets to the PyLiPD OOP \"Dataset\" class. \n", + "# ************************************************************\n", + "# Convert the LiPD datasets to the PyLiPD OOP \"Dataset\" class.\n", + "# ************************************************************\n", "datasets = D.get_datasets()\n", "\n", "for ds in datasets:\n", @@ -1559,7 +1561,7 @@ " print(f\"Funding: {funding.getGrants()}\")\n", " \n", " for pub in ds.getPublications():\n", - " print(f\"Publication: {pub.getTitle()} by {list(map(lambda x: x.getName(), pub.getAuthors()))}\")\n", + " print(f\"Publication: {pub.getTitle()} by {list(map(lambda x: x.getName(), pub.getAuthors()))} at {pub.getJournal()}\")\n", "\n", " for pd in ds.getPaleoData():\n", " for table in pd.getMeasurementTables():\n", @@ -1592,7 +1594,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -1606,7 +1608,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|██████████| 1/1 [00:00<00:00, 1.75it/s]" + "100%|██████████| 1/1 [00:00<00:00, 1.63it/s]\n" ] }, { @@ -1615,14 +1617,34 @@ "text": [ "Loaded..\n" ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\n" - ] - }, + } + ], + "source": [ + "# Dataset is the Main OOP Class\n", + "from pylipd.classes.dataset import Dataset\n", + "\n", + "# LiPD is the LiPD parser/writer\n", + "from pylipd.classes.datatable import DataTable\n", + "from pylipd.lipd import LiPD\n", + "\n", + "# Load LiPD files as usual.\n", + "# - This loads the LiPD data into the internal RDF graph\n", + "path = '../data/ODP846.Lawrence.2006.lpd'\n", + "D = LiPD()\n", + "D.load(path)\n", + "\n", + "# ***********************************************************\n", + "# Convert the LiPD datasets to the PyLiPD OOP \"Dataset\" class\n", + "# ***********************************************************\n", + "datasets = D.get_datasets()\n", + "ds = datasets[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ { "data": { "text/html": [ @@ -1653,38 +1675,38 @@ " \n", " \n", " 0\n", - " -0.303637\n", - " 0.972003\n", - " -0.758921\n", - " -1.924070\n", + " 0.657777\n", + " -1.621179\n", + " -1.174194\n", + " -1.500278\n", " \n", " \n", " 1\n", - " -0.798301\n", - " -0.431769\n", - " 1.342539\n", - " -0.234970\n", + " -0.600126\n", + " -2.597210\n", + " 1.616764\n", + " 1.207618\n", " \n", " \n", " 2\n", - " -0.342608\n", - " -2.168300\n", - " 0.170522\n", - " 0.884602\n", + " 0.405003\n", + " 0.967484\n", + " 1.142314\n", + " 0.162099\n", " \n", " \n", " 3\n", - " -0.127563\n", - " -0.709825\n", - " -0.067036\n", - " 0.747706\n", + " 0.222689\n", + " 0.788937\n", + " -0.078857\n", + " 0.539651\n", " \n", " \n", " 4\n", - " -1.551063\n", - " -1.312118\n", - " -0.047366\n", - " -0.169749\n", + " -1.742610\n", + " -0.316014\n", + " 0.209523\n", + " 0.446639\n", " \n", " \n", "\n", @@ -1692,11 +1714,11 @@ ], "text/plain": [ " site ukprime37 age depth\n", - "0 -0.303637 0.972003 -0.758921 -1.924070\n", - "1 -0.798301 -0.431769 1.342539 -0.234970\n", - "2 -0.342608 -2.168300 0.170522 0.884602\n", - "3 -0.127563 -0.709825 -0.067036 0.747706\n", - "4 -1.551063 -1.312118 -0.047366 -0.169749" + "0 0.657777 -1.621179 -1.174194 -1.500278\n", + "1 -0.600126 -2.597210 1.616764 1.207618\n", + "2 0.405003 0.967484 1.142314 0.162099\n", + "3 0.222689 0.788937 -0.078857 0.539651\n", + "4 -1.742610 -0.316014 0.209523 0.446639" ] }, "metadata": {}, @@ -1704,25 +1726,7 @@ } ], "source": [ - "# Dataset is the Main OOP Class\n", - "from pylipd.classes.dataset import Dataset\n", - "\n", - "# LiPD is the LiPD parser/writer\n", - "from pylipd.classes.datatable import DataTable\n", - "from pylipd.lipd import LiPD\n", "\n", - "# Load LiPD files as usual.\n", - "# - This loads the LiPD data into the internal RDF graph\n", - "path = '../data/ODP846.Lawrence.2006.lpd'\n", - "D = LiPD()\n", - "D.load(path)\n", - "\n", - "# Convert the LiPD datasets to the PyLiPD OOP \"Dataset\" class. \n", - "# - This allows to modify the datasets via OOP calls in memory\n", - "# - To write the LiPD back, we have to call the save function\n", - "datasets = D.get_datasets()\n", - "\n", - "ds = datasets[0]\n", "pdata = ds.getPaleoData()[0]\n", "\n", "# ********************************************\n", @@ -1732,7 +1736,6 @@ " \"site\": {\n", " 'number': 1, \n", " 'variableName': 'site/hole', \n", - " 'hasStandardVariable': 'site', \n", " 'units': 'unitless', \n", " 'TSid': 'PYTJ3PSH0LT', \n", " 'variableType': 'measured', \n", @@ -1773,7 +1776,6 @@ " ], \n", " 'number': 3, \n", " 'variableName': 'age', \n", - " 'hasStandardVariable': 'age', \n", " 'TSid': 'PYTXJB98403', \n", " 'variableType': 'inferred', \n", " 'takenAtDepth': 'depth', \n", @@ -1789,7 +1791,6 @@ " 'hasMedianValue': 2.211999999999989, \n", " 'hasMinValue': 0.06999999999993634\n", " }, \n", - " 'hasStandardVariable': 'depth', \n", " 'units': 'm', \n", " 'TSid': 'PYTKRFVW61B', \n", " 'variableType': 'measured'\n", @@ -1811,6 +1812,9 @@ "pdata.addMeasurementTable(newtable)\n", "\n", "# Create a lipd from the Dataset ds\n", + "# ******************************************\n", + "# Convert the OOP Dataset to the LiPD Object\n", + "# ******************************************\n", "savelipd = LiPD()\n", "savelipd.load_datasets([ds])\n", "savelipd.create_lipd(ds.getName(), \"./ODP846.Lawrence.2006.updated.lpd\")\n", @@ -1819,7 +1823,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 23, "metadata": {}, "outputs": [ { @@ -1833,47 +1837,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|██████████| 1/1 [00:00<00:00, 1.77it/s]" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Loaded..\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\n" - ] - } - ], - "source": [ - "# Try to load the New LiPD File, and check if everything is ok\n", - "D = LiPD()\n", - "D.load(\"./ODP846.Lawrence.2006.updated.lpd\")" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Loading 1 LiPD files\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "100%|██████████| 1/1 [00:00<00:00, 1.86it/s]" + "100%|██████████| 1/1 [00:00<00:00, 1.57it/s]" ] }, { @@ -1988,24 +1952,111 @@ " NaN\n", " 0.43\n", " \n", + " \n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " \n", + " \n", + " 2178\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " \n", + " \n", + " 2179\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " \n", + " \n", + " 2180\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " \n", + " \n", + " 2181\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " \n", + " \n", + " 2182\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " \n", " \n", "\n", + "

2183 rows × 9 columns

\n", "" ], "text/plain": [ - " event depth cr depth c. wuellerstorfi d13c u. peregrina d18o \\\n", - "0 138-846B 0.12 0.12 3.38 0.14 \n", - "1 138-846B 0.23 0.23 3.46 0.01 \n", - "2 138-846B 0.33 0.33 3.65 -0.10 \n", - "3 138-846B 0.33 0.33 3.88 -0.06 \n", - "4 138-846B 0.43 0.43 4.14 -0.17 \n", + " event depth cr depth c. wuellerstorfi d13c u. peregrina d18o \\\n", + "0 138-846B 0.12 0.12 3.38 0.14 \n", + "1 138-846B 0.23 0.23 3.46 0.01 \n", + "2 138-846B 0.33 0.33 3.65 -0.10 \n", + "3 138-846B 0.33 0.33 3.88 -0.06 \n", + "4 138-846B 0.43 0.43 4.14 -0.17 \n", + "... ... ... ... ... ... \n", + "2178 NaN NaN NaN NaN NaN \n", + "2179 NaN NaN NaN NaN NaN \n", + "2180 NaN NaN NaN NaN NaN \n", + "2181 NaN NaN NaN NaN NaN \n", + "2182 NaN NaN NaN NaN NaN \n", + "\n", + " depth comp sampleID u. peregrina d13c c. wuellerstorfi d18o \n", + "0 12.0 138-846B-1H-1 NaN 0.12 \n", + "1 23.0 138-846B-1H-1 NaN 0.23 \n", + "2 33.0 138-846B-1H-1 NaN 0.33 \n", + "3 33.0 138-846B-1H-1 NaN 0.33 \n", + "4 43.0 138-846B-1H-1 NaN 0.43 \n", + "... ... ... ... ... \n", + "2178 NaN NaN NaN NaN \n", + "2179 NaN NaN NaN NaN \n", + "2180 NaN NaN NaN NaN \n", + "2181 NaN NaN NaN NaN \n", + "2182 NaN NaN NaN NaN \n", "\n", - " depth comp sampleID u. peregrina d13c c. wuellerstorfi d18o \n", - "0 12.0 138-846B-1H-1 NaN 0.12 \n", - "1 23.0 138-846B-1H-1 NaN 0.23 \n", - "2 33.0 138-846B-1H-1 NaN 0.33 \n", - "3 33.0 138-846B-1H-1 NaN 0.33 \n", - "4 43.0 138-846B-1H-1 NaN 0.43 " + "[2183 rows x 9 columns]" ] }, "metadata": {}, @@ -2051,57 +2102,108 @@ " \n", " age\n", " ukprime37\n", - " site\n", " depth\n", + " site\n", " \n", " \n", " \n", " \n", " 0\n", - " -0.758921\n", - " 0.972003\n", - " -0.303637\n", - " -1.924070\n", + " -1.174194\n", + " -1.621179\n", + " -1.500278\n", + " 0.657777\n", " \n", " \n", " 1\n", - " 1.342539\n", - " -0.431769\n", - " -0.798301\n", - " -0.234970\n", + " 1.616764\n", + " -2.597210\n", + " 1.207618\n", + " -0.600126\n", " \n", " \n", " 2\n", - " 0.170522\n", - " -2.168300\n", - " -0.342608\n", - " 0.884602\n", + " 1.142314\n", + " 0.967484\n", + " 0.162099\n", + " 0.405003\n", " \n", " \n", " 3\n", - " -0.067036\n", - " -0.709825\n", - " -0.127563\n", - " 0.747706\n", + " -0.078857\n", + " 0.788937\n", + " 0.539651\n", + " 0.222689\n", " \n", " \n", " 4\n", - " -0.047366\n", - " -1.312118\n", - " -1.551063\n", - " -0.169749\n", + " 0.209523\n", + " -0.316014\n", + " 0.446639\n", + " -1.742610\n", + " \n", + " \n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " \n", + " \n", + " 95\n", + " 1.975101\n", + " 0.120740\n", + " -1.195272\n", + " 0.912115\n", + " \n", + " \n", + " 96\n", + " 0.294207\n", + " 0.054346\n", + " -1.671253\n", + " 0.686821\n", + " \n", + " \n", + " 97\n", + " -1.219347\n", + " 0.182344\n", + " 0.602834\n", + " 1.015739\n", + " \n", + " \n", + " 98\n", + " 0.544827\n", + " -1.782732\n", + " -0.805124\n", + " -0.070031\n", + " \n", + " \n", + " 99\n", + " 2.556159\n", + " -0.280002\n", + " 0.357622\n", + " 0.177833\n", " \n", " \n", "\n", + "

100 rows × 4 columns

\n", "" ], "text/plain": [ - " age ukprime37 site depth\n", - "0 -0.758921 0.972003 -0.303637 -1.924070\n", - "1 1.342539 -0.431769 -0.798301 -0.234970\n", - "2 0.170522 -2.168300 -0.342608 0.884602\n", - "3 -0.067036 -0.709825 -0.127563 0.747706\n", - "4 -0.047366 -1.312118 -1.551063 -0.169749" + " age ukprime37 depth site\n", + "0 -1.174194 -1.621179 -1.500278 0.657777\n", + "1 1.616764 -2.597210 1.207618 -0.600126\n", + "2 1.142314 0.967484 0.162099 0.405003\n", + "3 -0.078857 0.788937 0.539651 0.222689\n", + "4 0.209523 -0.316014 0.446639 -1.742610\n", + ".. ... ... ... ...\n", + "95 1.975101 0.120740 -1.195272 0.912115\n", + "96 0.294207 0.054346 -1.671253 0.686821\n", + "97 -1.219347 0.182344 0.602834 1.015739\n", + "98 0.544827 -1.782732 -0.805124 -0.070031\n", + "99 2.556159 -0.280002 0.357622 0.177833\n", + "\n", + "[100 rows x 4 columns]" ] }, "metadata": {}, @@ -2114,8 +2216,8 @@ "Missing Value: NaN\n", "- age\n", "- ukprime37 [unitless]\n", - "- site [unitless]\n", "- depth [m]\n", + "- site/hole [unitless]\n", "- Paleo Table: paleo0measurement0.csv\n" ] }, @@ -2212,24 +2314,111 @@ " 16.502\n", " 0.56\n", " \n", + " \n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " \n", + " \n", + " 2178\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " \n", + " \n", + " 2179\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " \n", + " \n", + " 2180\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " \n", + " \n", + " 2181\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " \n", + " \n", + " 2182\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " NaN\n", + " \n", " \n", "\n", + "

2183 rows × 9 columns

\n", "" ], "text/plain": [ - " c37 total temp muller deleteMe site section temp prahl ukprime37 \\\n", - "0 2.37 23.545 15-16 846B 1H-1 23.0 0.821 \n", - "1 2.10 23.648 25-26 846B 1H-1 23.1 0.824 \n", - "2 1.87 23.752 35-36 846B 1H-1 23.2 0.828 \n", - "3 2.74 22.515 45-46 846B 1H-1 22.0 0.787 \n", - "4 3.75 22.206 55-56 846B 1H-1 21.7 0.777 \n", + " c37 total temp muller deleteMe site section temp prahl ukprime37 \\\n", + "0 2.37 23.545 15-16 846B 1H-1 23.0 0.821 \n", + "1 2.10 23.648 25-26 846B 1H-1 23.1 0.824 \n", + "2 1.87 23.752 35-36 846B 1H-1 23.2 0.828 \n", + "3 2.74 22.515 45-46 846B 1H-1 22.0 0.787 \n", + "4 3.75 22.206 55-56 846B 1H-1 21.7 0.777 \n", + "... ... ... ... ... ... ... ... \n", + "2178 NaN NaN NaN NaN NaN NaN NaN \n", + "2179 NaN NaN NaN NaN NaN NaN NaN \n", + "2180 NaN NaN NaN NaN NaN NaN NaN \n", + "2181 NaN NaN NaN NaN NaN NaN NaN \n", + "2182 NaN NaN NaN NaN NaN NaN NaN \n", + "\n", + " age depth \n", + "0 5.228 0.16 \n", + "1 8.947 0.26 \n", + "2 11.966 0.36 \n", + "3 14.427 0.46 \n", + "4 16.502 0.56 \n", + "... ... ... \n", + "2178 NaN NaN \n", + "2179 NaN NaN \n", + "2180 NaN NaN \n", + "2181 NaN NaN \n", + "2182 NaN NaN \n", "\n", - " age depth \n", - "0 5.228 0.16 \n", - "1 8.947 0.26 \n", - "2 11.966 0.36 \n", - "3 14.427 0.46 \n", - "4 16.502 0.56 " + "[2183 rows x 9 columns]" ] }, "metadata": {}, @@ -2269,7 +2458,7 @@ " \n", " # Can get the dataframe for the whole table\n", " df = table.getDataFrame(use_standard_names=True)\n", - " display(df.head())\n", + " display(df)\n", "\n", " # The returned dataframe also contains the attributes for the variables\n", " for varname in df.attrs:\n", @@ -2294,7 +2483,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -2319,13 +2508,13 @@ "\n", "# Set the name of the dataset\n", "dataset1.setName(\"TestDataset.2024\")\n", - "dataset1.id = dataset1.ns + \"/\" + dataset1.getName()\n", + "dataset1.id = dataset1.ns + \"/\" + dataset1.getName() # ** IMPORTANT **\n", "\n", "# Set collection name\n", "dataset1.setCollectionName(\"TestCollection\")\n", "\n", "# Set the Archive Type (from a list of constants)\n", - "dataset1.setArchiveType(ArchiveTypeConstants.Coral)\n", + "dataset1.setArchiveType(ArchiveTypeConstants.MarineSediment)\n", "\n", "# Add a publication\n", "pub1 = Publication()\n", @@ -2456,7 +2645,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 25, "metadata": {}, "outputs": [ { @@ -2496,28 +2685,28 @@ " \n", " \n", " 0\n", - " 0.561119\n", - " -1.499768\n", + " -0.350192\n", + " 1.732207\n", " \n", " \n", " 1\n", - " -0.929443\n", - " -0.169344\n", + " -0.537965\n", + " -0.315284\n", " \n", " \n", " 2\n", - " 0.414730\n", - " 1.894262\n", + " 0.135352\n", + " 1.279284\n", " \n", " \n", " 3\n", - " -0.651496\n", - " 0.996514\n", + " 0.576491\n", + " -1.297143\n", " \n", " \n", " 4\n", - " -0.263709\n", - " 0.307729\n", + " -0.291135\n", + " -0.338270\n", " \n", " \n", "\n", @@ -2525,11 +2714,11 @@ ], "text/plain": [ " site/hole ukprime37\n", - "0 0.561119 -1.499768\n", - "1 -0.929443 -0.169344\n", - "2 0.414730 1.894262\n", - "3 -0.651496 0.996514\n", - "4 -0.263709 0.307729" + "0 -0.350192 1.732207\n", + "1 -0.537965 -0.315284\n", + "2 0.135352 1.279284\n", + "3 0.576491 -1.297143\n", + "4 -0.291135 -0.338270" ] }, "metadata": {}, @@ -2573,28 +2762,28 @@ " \n", " \n", " 0\n", - " -1.349216\n", - " -1.102813\n", + " 0.915431\n", + " 0.026630\n", " \n", " \n", " 1\n", - " 0.060254\n", - " 1.451194\n", + " -0.131359\n", + " -0.850787\n", " \n", " \n", " 2\n", - " -1.436060\n", - " -0.960168\n", + " -0.467320\n", + " 0.518221\n", " \n", " \n", " 3\n", - " 0.746369\n", - " -2.491131\n", + " 1.762440\n", + " 0.551268\n", " \n", " \n", " 4\n", - " 1.431329\n", - " -0.530799\n", + " -0.281282\n", + " 0.821902\n", " \n", " \n", "\n", @@ -2602,11 +2791,11 @@ ], "text/plain": [ " site Uk37\n", - "0 -1.349216 -1.102813\n", - "1 0.060254 1.451194\n", - "2 -1.436060 -0.960168\n", - "3 0.746369 -2.491131\n", - "4 1.431329 -0.530799" + "0 0.915431 0.026630\n", + "1 -0.131359 -0.850787\n", + "2 -0.467320 0.518221\n", + "3 1.762440 0.551268\n", + "4 -0.281282 0.821902" ] }, "metadata": {}, @@ -2650,7 +2839,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ @@ -2665,7 +2854,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -2679,7 +2868,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|██████████| 1/1 [00:00<00:00, 74.43it/s]" + "100%|██████████| 1/1 [00:00<00:00, 79.55it/s]" ] }, { @@ -2692,7 +2881,7 @@ "TestDataset.2024\n", "=========================\n", "Funding: ['NSF Grant 23423A']\n", - "Publication: Sample Publication Title by ['Deborah Khider', 'Varun Ratnakar']\n", + "Publication: Sample Publication Title by ['Varun Ratnakar', 'Deborah Khider']\n", "- Paleo Table: paleo0measurement1.csv\n" ] }, @@ -2731,28 +2920,28 @@ " \n", " \n", " 0\n", - " -1.499768\n", - " 0.561119\n", + " 1.732207\n", + " -0.350192\n", " \n", " \n", " 1\n", - " -0.169344\n", - " -0.929443\n", + " -0.315284\n", + " -0.537965\n", " \n", " \n", " 2\n", - " 1.894262\n", - " 0.414730\n", + " 1.279284\n", + " 0.135352\n", " \n", " \n", " 3\n", - " 0.996514\n", - " -0.651496\n", + " -1.297143\n", + " 0.576491\n", " \n", " \n", " 4\n", - " 0.307729\n", - " -0.263709\n", + " -0.338270\n", + " -0.291135\n", " \n", " \n", "\n", @@ -2760,11 +2949,11 @@ ], "text/plain": [ " ukprime37 site\n", - "0 -1.499768 0.561119\n", - "1 -0.169344 -0.929443\n", - "2 1.894262 0.414730\n", - "3 0.996514 -0.651496\n", - "4 0.307729 -0.263709" + "0 1.732207 -0.350192\n", + "1 -0.315284 -0.537965\n", + "2 1.279284 0.135352\n", + "3 -1.297143 0.576491\n", + "4 -0.338270 -0.291135" ] }, "metadata": {}, @@ -2808,28 +2997,28 @@ " \n", " \n", " 0\n", - " -1.349216\n", - " -1.102813\n", + " 0.915431\n", + " 0.026630\n", " \n", " \n", " 1\n", - " 0.060254\n", - " 1.451194\n", + " -0.131359\n", + " -0.850787\n", " \n", " \n", " 2\n", - " -1.436060\n", - " -0.960168\n", + " -0.467320\n", + " 0.518221\n", " \n", " \n", " 3\n", - " 0.746369\n", - " -2.491131\n", + " 1.762440\n", + " 0.551268\n", " \n", " \n", " 4\n", - " 1.431329\n", - " -0.530799\n", + " -0.281282\n", + " 0.821902\n", " \n", " \n", "\n", @@ -2837,11 +3026,11 @@ ], "text/plain": [ " site Uk37\n", - "0 -1.349216 -1.102813\n", - "1 0.060254 1.451194\n", - "2 -1.436060 -0.960168\n", - "3 0.746369 -2.491131\n", - "4 1.431329 -0.530799" + "0 0.915431 0.026630\n", + "1 -0.131359 -0.850787\n", + "2 -0.467320 0.518221\n", + "3 1.762440 0.551268\n", + "4 -0.281282 0.821902" ] }, "metadata": {},