From 8aa9a25b0e1c557ddab89b755352e545871b2cf1 Mon Sep 17 00:00:00 2001 From: AlexanderJuestel Date: Thu, 28 Sep 2023 09:20:11 +0200 Subject: [PATCH 1/3] EditParser --- notebooks/boreholeml_parsers.ipynb | 419 ++++++++++++++++++ .../inspectionProfiles/profiles_settings.xml | 6 - pybore/.idea/misc.xml | 4 - pybore/.idea/modules.xml | 8 - pybore/.idea/pybore.iml | 11 - pybore/.idea/vcs.xml | 6 - pybore/.idea/workspace.xml | 69 --- pybore/boreholeml_parser.py | 85 ++++ 8 files changed, 504 insertions(+), 104 deletions(-) create mode 100644 notebooks/boreholeml_parsers.ipynb delete mode 100644 pybore/.idea/inspectionProfiles/profiles_settings.xml delete mode 100644 pybore/.idea/misc.xml delete mode 100644 pybore/.idea/modules.xml delete mode 100644 pybore/.idea/pybore.iml delete mode 100644 pybore/.idea/vcs.xml delete mode 100644 pybore/.idea/workspace.xml create mode 100644 pybore/boreholeml_parser.py diff --git a/notebooks/boreholeml_parsers.ipynb b/notebooks/boreholeml_parsers.ipynb new file mode 100644 index 0000000..ec065ef --- /dev/null +++ b/notebooks/boreholeml_parsers.ipynb @@ -0,0 +1,419 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "3f1a7e81-5a50-450b-b7d7-2905dbfdd17b", + "metadata": {}, + "source": [ + "# BoreholeML Parsers" + ] + }, + { + "cell_type": "markdown", + "id": "f4b5a604-b000-4ef7-ac08-cdf99ca5eb52", + "metadata": {}, + "source": [ + "## Importing Libraries" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "5673dd35-8946-4d37-b8e2-6f10fc8e726b", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\ale93371\\Anaconda3\\envs\\pygeomechanical\\lib\\site-packages\\numpy\\_distributor_init.py:30: UserWarning: loaded more than 1 DLL from .libs:\n", + "C:\\Users\\ale93371\\Anaconda3\\envs\\pygeomechanical\\lib\\site-packages\\numpy\\.libs\\libopenblas.FB5AE2TYXYH2IJRDKGDGQ3XBKLKTF43H.gfortran-win_amd64.dll\n", + "C:\\Users\\ale93371\\Anaconda3\\envs\\pygeomechanical\\lib\\site-packages\\numpy\\.libs\\libopenblas64__v0.3.23-246-g3d31191b-gcc_10_3_0.dll\n", + " warnings.warn(\"loaded more than 1 DLL from .libs:\"\n" + ] + } + ], + "source": [ + "import xml.etree.ElementTree as ET\n", + "import pandas as pd\n", + "import sys\n", + "\n", + "sys.path.insert(0,'../pybore/')\n", + "from boreholeml_parser import parse_languagecode, parse_databasesourcelist" + ] + }, + { + "cell_type": "markdown", + "id": "02bbeac8-945c-4ac8-b2bf-4f23ca54fc98", + "metadata": {}, + "source": [ + "## Loading LanguageCode XML" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "e6cb12af-44a2-4c76-87fb-b022e8c0987a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
DescriptionIdentifier
0Englisheng
1Germandeu
\n", + "
" + ], + "text/plain": [ + " Description Identifier\n", + "0 English eng\n", + "1 German deu" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "languagecodes = parse_languagecode('../data/BoreholeML/LanguageCode.xml')\n", + "languagecodes" + ] + }, + { + "cell_type": "markdown", + "id": "41a157e8-1589-4bca-aa40-754ff1ba6ef6", + "metadata": {}, + "source": [ + "## Loading DataBaseSourceList XML" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "98f47199-4566-42d4-ba7c-d9ffaa450151", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
DescriptionIdentifierNameKeyIDAlternative IdentifierAlternative Name
0Kohlenwasserstoff-Datenbank DeutschlandKWDBKohlenwasserstoff-Datenbank Deutschland1KWDBhydrocarbon database Germany
1Datenbank der Bohrungen in Nordrhein-WestfalenDABODatenbank der Bohrungen in Nordrhein-Westfalen2DABOborehole database of Northrhine-Westfalia
2Bohrdatenbank NiedersachsenBDNBohrdatenbank Niedersachsen3BDNborehole database of Lower Saxony
3Bohrdatenbank SachsenBDSNBohrdatenbank Sachsen4BDSNborehole database of Saxony
4Bohrdatenbank Sachsen-AnhaltSABISBohrdatenbank Sachsen-Anhalt5SABISborehole database of Saxony-Anhalt
5Bohrdatenbank BrandenburgBDBBBohrdatenbank Brandenburg6BDBBborehole database of Brandenburg
6Bohrdatenbank Mecklenburg-VorpommernLDBSBohrdatenbank Mecklenburg-Vorpommern7LDBSborehole database of Mecklenburg-West Pomerania
7Bohrdatenbank Schleswig-HolsteinBDSHBohrdatenbank Schleswig-Holstein8BDSHborehole database of Schleswig-Holstein
8Bohrdatenbank der Hansestadt HamburgBDHHBohrdatenbank der Hansestadt Hamburg9BDHHborehole database of Hamburg
9Bohrdatenbank Rheinland-PfalzBDRPBohrdatenbank Rheinland-Pfalz10BDRPborehole database of Rhineland-Palatinate
10Bohrdatenbank HessenBDHEBohrdatenbank Hessen11BDHEborehole database of Hessia
11Bohrdatenbank ThüringenBDTHBohrdatenbank Thüringen12BDTHborehole database of Thuringia
12Bodeninformationssystem BayernBIS-BYBodeninformationssystem Bayern13BIS-BYsoil information system of Bavaria
13Bohrdatenbank Baden-WürttembergADBBohrdatenbank Baden-Württemberg14ADBborehole database of Baden-Wuerttemberg
14Bundesanstalt für Wasserbau - BohrdatenbankBAWBDBBundesanstalt für Wasserbau - Bohrdatenbank15BAWBDBFederal Waterways Engineering and Research Ins...
15Bohrdatenbank BerlinBDBEBohrdatenbank Berlin16BDBEborehole database of Berlin
16Bohrdatenbank BremenBDHBBohrdatenbank Bremen17BDHBborehole database of Bremen
17Bohrdatenbank SaarlandBDSLBohrdatenbank Saarland18BDSLborehole database of Saarland
\n", + "
" + ], + "text/plain": [ + " Description Identifier \n", + "0 Kohlenwasserstoff-Datenbank Deutschland KWDB \\\n", + "1 Datenbank der Bohrungen in Nordrhein-Westfalen DABO \n", + "2 Bohrdatenbank Niedersachsen BDN \n", + "3 Bohrdatenbank Sachsen BDSN \n", + "4 Bohrdatenbank Sachsen-Anhalt SABIS \n", + "5 Bohrdatenbank Brandenburg BDBB \n", + "6 Bohrdatenbank Mecklenburg-Vorpommern LDBS \n", + "7 Bohrdatenbank Schleswig-Holstein BDSH \n", + "8 Bohrdatenbank der Hansestadt Hamburg BDHH \n", + "9 Bohrdatenbank Rheinland-Pfalz BDRP \n", + "10 Bohrdatenbank Hessen BDHE \n", + "11 Bohrdatenbank Thüringen BDTH \n", + "12 Bodeninformationssystem Bayern BIS-BY \n", + "13 Bohrdatenbank Baden-Württemberg ADB \n", + "14 Bundesanstalt für Wasserbau - Bohrdatenbank BAWBDB \n", + "15 Bohrdatenbank Berlin BDBE \n", + "16 Bohrdatenbank Bremen BDHB \n", + "17 Bohrdatenbank Saarland BDSL \n", + "\n", + " Name KeyID \n", + "0 Kohlenwasserstoff-Datenbank Deutschland 1 \\\n", + "1 Datenbank der Bohrungen in Nordrhein-Westfalen 2 \n", + "2 Bohrdatenbank Niedersachsen 3 \n", + "3 Bohrdatenbank Sachsen 4 \n", + "4 Bohrdatenbank Sachsen-Anhalt 5 \n", + "5 Bohrdatenbank Brandenburg 6 \n", + "6 Bohrdatenbank Mecklenburg-Vorpommern 7 \n", + "7 Bohrdatenbank Schleswig-Holstein 8 \n", + "8 Bohrdatenbank der Hansestadt Hamburg 9 \n", + "9 Bohrdatenbank Rheinland-Pfalz 10 \n", + "10 Bohrdatenbank Hessen 11 \n", + "11 Bohrdatenbank Thüringen 12 \n", + "12 Bodeninformationssystem Bayern 13 \n", + "13 Bohrdatenbank Baden-Württemberg 14 \n", + "14 Bundesanstalt für Wasserbau - Bohrdatenbank 15 \n", + "15 Bohrdatenbank Berlin 16 \n", + "16 Bohrdatenbank Bremen 17 \n", + "17 Bohrdatenbank Saarland 18 \n", + "\n", + " Alternative Identifier Alternative Name \n", + "0 KWDB hydrocarbon database Germany \n", + "1 DABO borehole database of Northrhine-Westfalia \n", + "2 BDN borehole database of Lower Saxony \n", + "3 BDSN borehole database of Saxony \n", + "4 SABIS borehole database of Saxony-Anhalt \n", + "5 BDBB borehole database of Brandenburg \n", + "6 LDBS borehole database of Mecklenburg-West Pomerania \n", + "7 BDSH borehole database of Schleswig-Holstein \n", + "8 BDHH borehole database of Hamburg \n", + "9 BDRP borehole database of Rhineland-Palatinate \n", + "10 BDHE borehole database of Hessia \n", + "11 BDTH borehole database of Thuringia \n", + "12 BIS-BY soil information system of Bavaria \n", + "13 ADB borehole database of Baden-Wuerttemberg \n", + "14 BAWBDB Federal Waterways Engineering and Research Ins... \n", + "15 BDBE borehole database of Berlin \n", + "16 BDHB borehole database of Bremen \n", + "17 BDSL borehole database of Saarland " + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "databases = parse_databasesourcelist('../data/BoreholeML/DatabaseSourceList.xml')\n", + "databases" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/pybore/.idea/inspectionProfiles/profiles_settings.xml b/pybore/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/pybore/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/pybore/.idea/misc.xml b/pybore/.idea/misc.xml deleted file mode 100644 index c3334de..0000000 --- a/pybore/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/pybore/.idea/modules.xml b/pybore/.idea/modules.xml deleted file mode 100644 index 0101609..0000000 --- a/pybore/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/pybore/.idea/pybore.iml b/pybore/.idea/pybore.iml deleted file mode 100644 index 8dc09e5..0000000 --- a/pybore/.idea/pybore.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/pybore/.idea/vcs.xml b/pybore/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/pybore/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/pybore/.idea/workspace.xml b/pybore/.idea/workspace.xml deleted file mode 100644 index a7be0cf..0000000 --- a/pybore/.idea/workspace.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - -