{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Environment :: Console", "Intended Audience :: Science/Research", "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", "Programming Language :: Python :: 3.6", "Topic :: Utilities" ], "description": "olca-ipc.py\n===========\n\nopenLCA provides an `implementation `_\nof an `JSON-RPC `_ based protocol for\ninter-process communication (IPC). With this, it is possible to call functions\nin openLCA and processing their results outside of openLCA. The ``olca-ipc``\npackage provides a convenience API for using this IPC protocol from standard\nPython (Cpython v3.6+) so that it is possible to use openLCA as a data storage\nand calculation engine and combine it with the libraries from the Python\necosystem (numpy, pandas and friends).\n\nThe openLCA IPC protocol is based on the openLCA data exchange format which is\nspecified in the `olca-schema `_\nrepository. The ``olca-ipc`` package provides a class based implementation of\nthe openLCA data exchange format and an API for communicating with an openLCA\nIPC server via instances of these classes.\n\nThe current stable version of ``olca-ipc`` is available via the\n`Python Package Index `_. Thus, in order to\nuse it, you can just install (and uninstall) it with pip:\n\n.. code-block:: bash\n\n pip install -U olca-ipc\n\nIn order to communicate with openLCA, you first need to start an openLCA IPC\nserver. You can do this via the user interface in openLCA under\n``Window > Developer Tools > IPC Server``. The IPC server runs on a specific\nport, e.g. ``8080``, to which you connect from an IPC client:\n\n.. code-block:: python\n\n import olca\n client = olca.Client(8080)\n\nAn instance of the ``olca.Client`` class is then a convenient entry point for\ncalling functions of openLCA and processing their results. The following\nexamples show some typical uses cases (note that these are just examples\nwithout input checks, error handling, code structuring, and all the things you\nwould normally do).\n\n\nCreate and link data\n~~~~~~~~~~~~~~~~~~~~\n\nThe ``olca`` package contains a class model with type annotations for the\n`olca-schema `_ model that is used\nfor exchanging data with openLCA. With the type annotations you should get good\neditor support (type checks and IntelliSense). You can create, update\nand link data models as defined in the openLCA schema (e.g. as for\n`processes `_,\n`flows `_, or\n`product systems `_).\n(Note that we convert camelCase names like ``calculationType`` of attributes and\nfunctions to lower_case_names_with_underscores like ``calculation_type`` when\ngenerating the Python API).\n\nThe ``olca.Client`` class provides methods like ``get``, ``find``, ``insert``,\n``update``, and ``delete`` to work with data. The following example shows how to\ncreate a new flow and link it to an existing flow property with the name `Mass`:\n\n\n.. code-block:: python\n\n import olca\n import uuid\n\n client = olca.Client(8080)\n\n # find the flow property 'Mass' from the database\n mass = client.find(olca.FlowProperty, 'Mass')\n\n # create a flow that has 'Mass' as reference flow property\n steel = olca.Flow()\n steel.id = str(uuid.uuid4())\n steel.flow_type = olca.FlowType.PRODUCT_FLOW\n steel.name = \"Steel\"\n steel.description = \"Added from the olca-ipc python API...\"\n # in openLCA, conversion factors between different\n # properties/quantities of a flow are stored in\n # FlowPropertyFactor objects. Every flow needs at\n # least one flow property factor for its reference\n # flow property.\n mass_factor = olca.FlowPropertyFactor()\n mass_factor.conversion_factor = 1.0\n mass_factor.flow_property = mass\n mass_factor.reference_flow_property = True\n steel.flow_properties = [mass_factor]\n\n # save it in openLCA, you may have to refresh\n # (close & reopen the database to see the new flow)\n client.insert(steel)\n\n\nRunning calculations\n~~~~~~~~~~~~~~~~~~~~\n\nopenLCA provides different types of calculations which can be selected via the\n``calculation_type`` in a\n`calculation setup `_.\nIn the following example, a calculation setup with a product system and impact\nassessment method is created, calculated, and finally exported to Excel:\n\n\n.. code-block:: python\n\n import olca\n\n client = olca.Client(8080)\n\n # create the calculation setup\n setup = olca.CalculationSetup()\n\n # define the calculation type here\n # see http://greendelta.github.io/olca-schema/html/CalculationType.html\n setup.calculation_type = olca.CalculationType.CONTRIBUTION_ANALYSIS\n\n # select the product system and LCIA method\n setup.impact_method = client.find(olca.ImpactMethod, 'TRACI 2.1')\n setup.product_system = client.find(olca.ProductSystem, 'compost plant, open')\n\n # amount is the amount of the functional unit (fu) of the system that\n # should be used in the calculation; unit, flow property, etc. of the fu\n # can be also defined; by default openLCA will take the settings of the\n # reference flow of the product system\n setup.amount = 1.0\n\n # calculate the result and export it to an Excel file\n result = client.calculate(setup)\n client.excel_export(result, 'result.xlsx')\n\n # the result remains accessible (for exports etc.) until\n # you dispose it, which you should always do when you do\n # not need it anymore\n client.dispose(result)\n\n\nParameterized calculation setups\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nIn order to calculate a product system with different parameter sets, you can\npass a set of parameter redefinitions directly with a calculation setup into\na calculation. With this, you do not need to modify a product system or the\nparameters in a database in order to calculate it with different parameter\nvalues:\n\n.. code-block:: python\n\n # ... same steps as above\n setup = olca.CalculationSetup()\n # ...\n for something in your.parameter_data:\n redef = olca.ParameterRedef()\n redef.name = the_parameter_name\n redef.value = the_parameter_value\n # redef.context = ... you can also redefine process and LCIA method\n # parameters by providing a parameter context which\n # is a Ref (reference) to the respective process or\n # LCIA method; with no context a global parameter is\n # redefined\n setup.parameter_redefs.append(redef)\n\n\nAs the name says, a parameter redefinition redefines the value of an existing\nglobal, process, or LCIA method parameter.\n\n\nMonte-Carlo simulations\n~~~~~~~~~~~~~~~~~~~~~~~\nRunning Monte-Carlo simulations is similar to normal calculations but instead\nof ``calculate`` you call the ``simulator`` method which will return a reference\nto a simulator which you then use to run calculations (where in each calculation\nthe simulator generates new values for the uncertainty distributions in the\nsystem). You get the result for each iteration and can also export the result of\nall iterations later to Excel. As for the results of the normal calculation, the\nthe simulator should be disposed when it is not used anymore:\n\n\n.. code-block:: python\n\n import olca\n\n client = olca.Client(8080)\n\n # creating the calculation setup\n setup = olca.CalculationSetup()\n setup.calculation_type = olca.CalculationType.MONTE_CARLO_SIMULATION\n setup.impact_method = client.find(olca.ImpactMethod, 'TRACI 2.1')\n setup.product_system = client.find(olca.ProductSystem, 'compost plant')\n setup.amount = 1.0\n\n # create the simulator\n simulator = client.simulator(setup)\n\n for i in range(0, 10):\n result = client.next_simulation(simulator)\n first_impact = result.impact_results[0]\n print('iteration %i: result for %s = %4.4f' %\n (i, first_impact.impact_category.name, first_impact.value))\n # we do not have to dispose the result here (it is not cached\n # in openLCA); but we need to dispose the simulator later (see below)\n\n # export the complete result of all simulations\n client.excel_export(simulator, 'simulation_result.xlsx')\n\n # the result remains accessible (for exports etc.) until\n # you dispose it, which you should always do when you do\n # not need it anymore\n client.dispose(simulator)\n\n\nFor more information and examples see the\n`package documentation `_\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/GreenDelta/olca-ipc.py", "keywords": "openLCA,life cycle assessment,LCA", "license": "", "maintainer": "", "maintainer_email": "", "name": "olca-ipc", "package_url": "https://pypi.org/project/olca-ipc/", "platform": "", "project_url": "https://pypi.org/project/olca-ipc/", "project_urls": { "Homepage": "https://github.com/GreenDelta/olca-ipc.py" }, "release_url": "https://pypi.org/project/olca-ipc/0.0.8/", "requires_dist": [ "requests" ], "requires_python": "", "summary": "A Python package for calling openLCA functions from Python.", "version": "0.0.8" }, "last_serial": 5291981, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "20a859e2a6425b69e5d82fb13a8730d3", "sha256": "236ce645a67761996081247eaff53c6f2e1f9f89ee9f6ea605f4f2157007ed22" }, "downloads": -1, "filename": "olca_ipc-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "20a859e2a6425b69e5d82fb13a8730d3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10287, "upload_time": "2018-05-29T13:59:02", "url": "https://files.pythonhosted.org/packages/ca/f2/9f12fe59a8791f75349f88fa3e843122d194068806dd567885e464fc2f21/olca_ipc-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "35186b4e2408b5543abf3a447f0021ec", "sha256": "d14d37d18c7f2f7195198e02df1e309b34b46099f09fe52309b32408bb2b3716" }, "downloads": -1, "filename": "olca-ipc-0.0.1.tar.gz", "has_sig": false, "md5_digest": "35186b4e2408b5543abf3a447f0021ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9956, "upload_time": "2018-05-29T13:59:03", "url": "https://files.pythonhosted.org/packages/1b/5c/eeee11027384e161b93eb4608f216e11b379a9fe7c99627a20f41e78c8e4/olca-ipc-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "76c17e2cf0f730772729b737f7f25b3a", "sha256": "80865e15f0c13c589944a45a06bf96e08f5775d458133e65a13d1adc680f1403" }, "downloads": -1, "filename": "olca-ipc-0.0.2.tar.gz", "has_sig": false, "md5_digest": "76c17e2cf0f730772729b737f7f25b3a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14663, "upload_time": "2018-07-17T15:57:24", "url": "https://files.pythonhosted.org/packages/6e/b9/01a391e9f9c4b284a366492020bf803c1a20cd41410b6174269f4e9af7fd/olca-ipc-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "80e18d56d817244f359a951ea8a87eda", "sha256": "2e4bacdda217610f06124f4378427be8cb95046cc2e08d33cd558bb8dd2f597f" }, "downloads": -1, "filename": "olca_ipc-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "80e18d56d817244f359a951ea8a87eda", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16252, "upload_time": "2018-08-30T10:29:30", "url": "https://files.pythonhosted.org/packages/e9/23/dc2c0b0b5a3c393148f58fbe025bfe65c444a8cee35a0124c00cf6293986/olca_ipc-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1646bd013148fe96e5255d5cc0680f94", "sha256": "8f00450632dd36e5a0fba6fe8e1f0171cd5852bf5527fb96fcecb5b01dee8cae" }, "downloads": -1, "filename": "olca-ipc-0.0.3.tar.gz", "has_sig": false, "md5_digest": "1646bd013148fe96e5255d5cc0680f94", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15582, "upload_time": "2018-08-30T10:29:31", "url": "https://files.pythonhosted.org/packages/59/59/a78647a41db42476d2da385ef494702e086222d7b297aa089126e1018ef6/olca-ipc-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "6a743519b4d1437c252308104ee1c560", "sha256": "4a67c31cafb337c275cfbb015b8ff4e8e0767256c8fc6824a4d40b811546f916" }, "downloads": -1, "filename": "olca_ipc-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "6a743519b4d1437c252308104ee1c560", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16830, "upload_time": "2018-08-30T19:59:41", "url": "https://files.pythonhosted.org/packages/f5/24/b0be88dff0a30f46afd64f1764edb86de048f270948b3884019f001b3231/olca_ipc-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "69f29f81beaf2481b938bd9b17b0bbb6", "sha256": "a9628e5ef5c785c7ef7f1526d22d8c2e1a3e8698e507a47eda0d5b43a7acb181" }, "downloads": -1, "filename": "olca-ipc-0.0.4.tar.gz", "has_sig": false, "md5_digest": "69f29f81beaf2481b938bd9b17b0bbb6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16120, "upload_time": "2018-08-30T19:59:42", "url": "https://files.pythonhosted.org/packages/3e/3e/4ce4444968f2c14ec60fc1a557901f097fbbabddc35845b4858ea820354c/olca-ipc-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "86e6338aa9e682e2c7075bc5d8d6b0a4", "sha256": "aa8780a31494756a07c43976ae461c02112725ffa079ffed49a840cb913aaa09" }, "downloads": -1, "filename": "olca_ipc-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "86e6338aa9e682e2c7075bc5d8d6b0a4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16815, "upload_time": "2018-09-06T18:08:59", "url": "https://files.pythonhosted.org/packages/99/77/7fb17b6e9e316645be18ef7ab393b4859f57d36f27d9bfce71761fa4870b/olca_ipc-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "56a40314bca69a1cdf4482bf5afdfbb4", "sha256": "0cfd0b0f6e1f87b178f1adc442e1c380f274da988206317a392556b0f046d027" }, "downloads": -1, "filename": "olca-ipc-0.0.5.tar.gz", "has_sig": false, "md5_digest": "56a40314bca69a1cdf4482bf5afdfbb4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16104, "upload_time": "2018-09-06T18:09:00", "url": "https://files.pythonhosted.org/packages/d7/53/74a2889f2f2c9f699bce76a164d8e6bbc4b678802fe9871a2e61270d8c56/olca-ipc-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "1357bf7bddaf11ea967b4001a7e3876e", "sha256": "a564b3e8f4fda8915bb5b224e53651c46efd14e67510434fa95f2c5966045dc7" }, "downloads": -1, "filename": "olca_ipc-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "1357bf7bddaf11ea967b4001a7e3876e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16993, "upload_time": "2018-09-06T18:50:02", "url": "https://files.pythonhosted.org/packages/9d/f5/a283f5e9a267f0756b0f14b666bbe44de6addcc34a8ddbe2c44bb9976e2d/olca_ipc-0.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "214937fb38dc75fb866bdecc0a3148a8", "sha256": "81df048eb6b9333329e808fd43c792c06b4b7ec4ecd86a43282a521a15dc7ca0" }, "downloads": -1, "filename": "olca-ipc-0.0.6.tar.gz", "has_sig": false, "md5_digest": "214937fb38dc75fb866bdecc0a3148a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16279, "upload_time": "2018-09-06T18:50:03", "url": "https://files.pythonhosted.org/packages/35/3a/449c18949f798e9f8da7c77bf62ab6645a601a01f4c6fa60ef007626d0cd/olca-ipc-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "40085f91061ca784852a732321d3f35b", "sha256": "df504553a0a9e61da522c70f81c95cec8497a95f2ea0d0313b4e028983601f29" }, "downloads": -1, "filename": "olca_ipc-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "40085f91061ca784852a732321d3f35b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19498, "upload_time": "2018-09-25T08:34:47", "url": "https://files.pythonhosted.org/packages/0a/89/db33e5d16f070d04e0250cf546711eccde612d17e12c51df3fdfcc212670/olca_ipc-0.0.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "847a9a648b03c4f6588d1145d5db14c5", "sha256": "6877aac95cbafcafbb6521c254c65a8e860421d47910eb5f4e2767d97948a3b8" }, "downloads": -1, "filename": "olca-ipc-0.0.7.tar.gz", "has_sig": false, "md5_digest": "847a9a648b03c4f6588d1145d5db14c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19279, "upload_time": "2018-09-25T08:34:49", "url": "https://files.pythonhosted.org/packages/50/21/64e76258a8a03db66e319d4147114311f663ed1ab583ddd6db7f538fcbdb/olca-ipc-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "c74fa05c64055f3e5841cd0d66c593ef", "sha256": "92457f9aa271af136b8289b5bae0afe5edf0bca23e77f04e2f35c24bad9b0f08" }, "downloads": -1, "filename": "olca_ipc-0.0.8-py3-none-any.whl", "has_sig": false, "md5_digest": "c74fa05c64055f3e5841cd0d66c593ef", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 33466, "upload_time": "2019-05-20T12:04:02", "url": "https://files.pythonhosted.org/packages/03/4c/9ddbec0a44f8a0e48332c5f40e49fd807a58e5fc8a75e64673a50327c863/olca_ipc-0.0.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8e8afecf9cdfbe51896c049aec704fca", "sha256": "e7688576ef74598e3e2b9ec85fd4ecb23386b98069967978af35bfe63eb4522e" }, "downloads": -1, "filename": "olca-ipc-0.0.8.tar.gz", "has_sig": false, "md5_digest": "8e8afecf9cdfbe51896c049aec704fca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31388, "upload_time": "2019-05-20T12:04:04", "url": "https://files.pythonhosted.org/packages/3b/82/2d56634170774d716c8aed1ee3aa1c9a756a4a055373cefbeb4600f41730/olca-ipc-0.0.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c74fa05c64055f3e5841cd0d66c593ef", "sha256": "92457f9aa271af136b8289b5bae0afe5edf0bca23e77f04e2f35c24bad9b0f08" }, "downloads": -1, "filename": "olca_ipc-0.0.8-py3-none-any.whl", "has_sig": false, "md5_digest": "c74fa05c64055f3e5841cd0d66c593ef", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 33466, "upload_time": "2019-05-20T12:04:02", "url": "https://files.pythonhosted.org/packages/03/4c/9ddbec0a44f8a0e48332c5f40e49fd807a58e5fc8a75e64673a50327c863/olca_ipc-0.0.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8e8afecf9cdfbe51896c049aec704fca", "sha256": "e7688576ef74598e3e2b9ec85fd4ecb23386b98069967978af35bfe63eb4522e" }, "downloads": -1, "filename": "olca-ipc-0.0.8.tar.gz", "has_sig": false, "md5_digest": "8e8afecf9cdfbe51896c049aec704fca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31388, "upload_time": "2019-05-20T12:04:04", "url": "https://files.pythonhosted.org/packages/3b/82/2d56634170774d716c8aed1ee3aa1c9a756a4a055373cefbeb4600f41730/olca-ipc-0.0.8.tar.gz" } ] }