komle-witslm-client


Namekomle-witslm-client JSON
Version 0.3.4.1 PyPI version JSON
download
home_pagehttps://github.com/nqtung/komle-witsml-client
SummaryA python library to help with WITSML v1.3.1.1, v1.4.1.0, v1.4.1.1 and v2.0
upload_time2022-12-14 19:09:42
maintainer
docs_urlNone
authorTung Nguyen
requires_python>=3.9
licenseApache-2.0 License
keywords python soap-client witsml
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Komle WITSML Client

komle-witsml-client is forked from [komle-plus](https://github.com/HemersonRafael/komle-plus) with based from [komle](https://github.com/kle043/komle), a python library for WITSML, uses [PyXB-E](https://github.com/renalreg/PyXB-X) to marshal/unmarshal xml files according to the schemas.

What is this fork for?:

At work I use some closed source tools that use Komle - some of which I keep. This repository has the necessary patches for komle to work for me. Intend to have a published copy of PyPI available and an automated test pipeline.

Some of the features are:

* WITSML data model bindings for schema v1.3.1.1, v1.4.1.0, v1.4.1.1 and v2.0
    - **Note** just one version can be used in the same runtime, due to namespace collision
* WITSML to dict, for use in a pandas dataframe or json
* Unit converter based on [witsmlUnitDict](http://w3.energistics.org/schema/WITSML_v1.4.1.1_Data_Schema/witsml_v1.4.1.1_data/ancillary/witsmlUnitDict.xml)
* Soap client to request data from a witsml server, according to the [webservice description](http://w3.energistics.org/schema/witsml_v1.4.0_api/WMLS.WSDL)
* Validation that xml files conforms to the WITSML schema
* Support for the generated write schemas, to be used for WMLS_AddToStore
    - **Note** that write_bindings can not be imported at the same time as read_bindings. See below for details.

## Instalation by GitHub
### Pre-requisites:
  * [poetry >= 1.0](https://python-poetry.org/docs/managing-environments/)

  * [python >= 3.9](https://www.python.org/)

  * [GNU Make >= 4.3](https://www.gnu.org/software/make/)

``` bash
git clone https://github.com/nqtung/komle-witsml-client/
```

if the repo is cloned

``` bash
make install
```
## Instalation by PyPI
``` bash
pip install komle-witslm-client
```
## Getting started

``` bash
from komle.bindings.v1411.read import witsml
from komle import utils as ku
import pandas as pd # Not part of komle setup

with open('log.xml', 'r') as log_file:
    # logs is a regular python object according to the witsml schema
    logs = witsml.CreateFromDocument(log_file.read())

# Print the witsml documentation for logs
print(logs._element().documentation())

# Print the schema location for logCurveInfo, nice to have for reference
print(logs.log[0].logCurveInfo[0]._element().xsdLocation().locationBase)

print([l.name for l in logs.log])

# Convert logdata to a dict
log = logs.log[0]

data_dict = ku.logdata_dict(log)

# Create a dataframe, if you have installed pandas
df_data = pd.DataFrame(data_dict)

# Do the same for the plural logCurveInfo element
df_curve = pd.DataFrame(ku.plural_dict(log.logCurveInfo))
```

`witsml.CreateFromDocument` works on any witsml object, like trajectorys, mudLogs, tubulars etc, and returns a python representation according to 
the schema. Nodes are converted to there corresponding python types and accessed like any other python object, the exception is leaf nodes with attributes where one must call `value()` since primitive types in python does not have custom attributes. For example `mdTop.value()` where mdTop also has the attribute `mdTop.uom`, also see [examples/hello_witsml.py](examples/hello_witsml.py).

## Usage of different schemas

 The difference between the schemas is described [here](http://w3.energistics.org/schema/WITSML_v1.4.1.1_Data_Schema/witsml_v1.4.1.1_data/index_witsml_schema.html). In summary,

* _Read Schemas_: [...] a copy of the normative files except that all choices, elements and attributes are optional. [...] these schema files must represent the XMLout response from the WITSML WMLS_GetFromStore method.
* _Write Schemas_: [...] a copy of the normative files except that some unique identifier attributes have had their optionality changed. [...] these schema files must represent the XMLin input to the WITSML WMLS_AddToStore method.
* _Update Schemas_ (not currently supported): [...] a copy of the normative files with all elements and attributes optional except that all unique identifier attributes and uom attributes are mandatory. [...] these schema files must represent the XMLin input to the WITSML WMLS_UpdateInStore method.
* _Delete Schemas_ (not currently supported): [...] a copy of the normative files with all elements and attributes optional except for all object uids and parentage-pointers which are mandatory. [...] these schema files must represent the QueryIn input to the WITSML WMLS_DeleteFromStore method.

As a practical matter, any program needing to work on both read and write (and update/delete) should only import the **read** bindings, since they have the least restrictions. The read bindings will be valid also for write/update/delete, as long as the mandatory elements and attributes are present. For validation of the write schema, a separate test program which only imports the write bindings must be used. (Note that the multiprocessing module can not easily be used for this purpose, since the child processes will inherit the parent process' imports.)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nqtung/komle-witsml-client",
    "name": "komle-witslm-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "python,soap-client,witsml",
    "author": "Tung Nguyen",
    "author_email": "tungnq@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c8/e0/cb6e66e07052b8bfdfbdc2bf8a5f46e9a21f08de57efad343e0b129b4d55/komle-witslm-client-0.3.4.1.tar.gz",
    "platform": null,
    "description": "# Komle WITSML Client\n\nkomle-witsml-client is forked from [komle-plus](https://github.com/HemersonRafael/komle-plus) with based from [komle](https://github.com/kle043/komle), a python library for WITSML, uses [PyXB-E](https://github.com/renalreg/PyXB-X) to marshal/unmarshal xml files according to the schemas.\n\nWhat is this fork for?:\n\nAt work I use some closed source tools that use Komle - some of which I keep. This repository has the necessary patches for komle to work for me. Intend to have a published copy of PyPI available and an automated test pipeline.\n\nSome of the features are:\n\n* WITSML data model bindings for schema v1.3.1.1, v1.4.1.0, v1.4.1.1 and v2.0\n    - **Note** just one version can be used in the same runtime, due to namespace collision\n* WITSML to dict, for use in a pandas dataframe or json\n* Unit converter based on [witsmlUnitDict](http://w3.energistics.org/schema/WITSML_v1.4.1.1_Data_Schema/witsml_v1.4.1.1_data/ancillary/witsmlUnitDict.xml)\n* Soap client to request data from a witsml server, according to the [webservice description](http://w3.energistics.org/schema/witsml_v1.4.0_api/WMLS.WSDL)\n* Validation that xml files conforms to the WITSML schema\n* Support for the generated write schemas, to be used for WMLS_AddToStore\n    - **Note** that write_bindings can not be imported at the same time as read_bindings. See below for details.\n\n## Instalation by GitHub\n### Pre-requisites:\n  * [poetry >= 1.0](https://python-poetry.org/docs/managing-environments/)\n\n  * [python >= 3.9](https://www.python.org/)\n\n  * [GNU Make >= 4.3](https://www.gnu.org/software/make/)\n\n``` bash\ngit clone https://github.com/nqtung/komle-witsml-client/\n```\n\nif the repo is cloned\n\n``` bash\nmake install\n```\n## Instalation by PyPI\n``` bash\npip install komle-witslm-client\n```\n## Getting started\n\n``` bash\nfrom komle.bindings.v1411.read import witsml\nfrom komle import utils as ku\nimport pandas as pd # Not part of komle setup\n\nwith open('log.xml', 'r') as log_file:\n    # logs is a regular python object according to the witsml schema\n    logs = witsml.CreateFromDocument(log_file.read())\n\n# Print the witsml documentation for logs\nprint(logs._element().documentation())\n\n# Print the schema location for logCurveInfo, nice to have for reference\nprint(logs.log[0].logCurveInfo[0]._element().xsdLocation().locationBase)\n\nprint([l.name for l in logs.log])\n\n# Convert logdata to a dict\nlog = logs.log[0]\n\ndata_dict = ku.logdata_dict(log)\n\n# Create a dataframe, if you have installed pandas\ndf_data = pd.DataFrame(data_dict)\n\n# Do the same for the plural logCurveInfo element\ndf_curve = pd.DataFrame(ku.plural_dict(log.logCurveInfo))\n```\n\n`witsml.CreateFromDocument` works on any witsml object, like trajectorys, mudLogs, tubulars etc, and returns a python representation according to \nthe schema. Nodes are converted to there corresponding python types and accessed like any other python object, the exception is leaf nodes with attributes where one must call `value()` since primitive types in python does not have custom attributes. For example `mdTop.value()` where mdTop also has the attribute `mdTop.uom`, also see [examples/hello_witsml.py](examples/hello_witsml.py).\n\n## Usage of different schemas\n\n The difference between the schemas is described [here](http://w3.energistics.org/schema/WITSML_v1.4.1.1_Data_Schema/witsml_v1.4.1.1_data/index_witsml_schema.html). In summary,\n\n* _Read Schemas_: [...] a copy of the normative files except that all choices, elements and attributes are optional. [...] these schema files must represent the XMLout response from the WITSML WMLS_GetFromStore method.\n* _Write Schemas_: [...] a copy of the normative files except that some unique identifier attributes have had their optionality changed. [...] these schema files must represent the XMLin input to the WITSML WMLS_AddToStore method.\n* _Update Schemas_ (not currently supported): [...] a copy of the normative files with all elements and attributes optional except that all unique identifier attributes and uom attributes are mandatory. [...] these schema files must represent the XMLin input to the WITSML WMLS_UpdateInStore method.\n* _Delete Schemas_ (not currently supported): [...] a copy of the normative files with all elements and attributes optional except for all object uids and parentage-pointers which are mandatory. [...] these schema files must represent the QueryIn input to the WITSML WMLS_DeleteFromStore method.\n\nAs a practical matter, any program needing to work on both read and write (and update/delete) should only import the **read** bindings, since they have the least restrictions. The read bindings will be valid also for write/update/delete, as long as the mandatory elements and attributes are present. For validation of the write schema, a separate test program which only imports the write bindings must be used. (Note that the multiprocessing module can not easily be used for this purpose, since the child processes will inherit the parent process' imports.)\n",
    "bugtrack_url": null,
    "license": "Apache-2.0 License",
    "summary": "A python library to help with WITSML v1.3.1.1, v1.4.1.0, v1.4.1.1 and v2.0",
    "version": "0.3.4.1",
    "split_keywords": [
        "python",
        "soap-client",
        "witsml"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "159f048a362ca2e96db7e55d0fbb6d78",
                "sha256": "34ce90ff86062d3a11101990c43f98918c9bf4e8ee4a44f124b6cd1aaa44b9ca"
            },
            "downloads": -1,
            "filename": "komle_witslm_client-0.3.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "159f048a362ca2e96db7e55d0fbb6d78",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 12665767,
            "upload_time": "2022-12-14T19:09:39",
            "upload_time_iso_8601": "2022-12-14T19:09:39.906748Z",
            "url": "https://files.pythonhosted.org/packages/16/33/7266d1bea073a1dbb9c17f0579ceeb0a064f701dc9ac1f8a0965d7ea79b2/komle_witslm_client-0.3.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "8dddbd1b2fabf6f291dbd042f54990de",
                "sha256": "4d70130c9841b2bc6b6d679800bb5c8b0006226b8e8a014d6e872da77de3312c"
            },
            "downloads": -1,
            "filename": "komle-witslm-client-0.3.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8dddbd1b2fabf6f291dbd042f54990de",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 12120541,
            "upload_time": "2022-12-14T19:09:42",
            "upload_time_iso_8601": "2022-12-14T19:09:42.644785Z",
            "url": "https://files.pythonhosted.org/packages/c8/e0/cb6e66e07052b8bfdfbdc2bf8a5f46e9a21f08de57efad343e0b129b4d55/komle-witslm-client-0.3.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-14 19:09:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "nqtung",
    "github_project": "komle-witsml-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "komle-witslm-client"
}
        
Elapsed time: 0.02177s