Skip to main content

stea - calculate economic analysis

Project description

Actions Status Code Style: black

Stea

Stea is a HTTP client for Stea calculations, some documentation can be found in the stea/init.py file. The source code in this project is a Python package, to actually use it you will need to write your own executable script.

The main way to configure the stea client is through a yaml file, an example configuration file is shown here:

# The id of the project, which must already exist and be available in
# the stea database. In the Stea documentation this is called "AlternativeId".
project-id: 4782
project-version: 1


# All information in stea is versioned with a timestamp. When we request a
# calculation we must specify wich date we wish to use to fetch configuration
# information for assumptions like e.g. the oil price.
config-date: 2018-07-01 12:00:00


# The stea web client works by *adjusting* the profiles in an existing
# stea project which has already been defined. That implies that all
# profiles added in this configuration file should already be part of
# the project. To match the profiles specified here with the profiles in
# the project we must give a id for the profiles.

# The profiles keyword is used to enter profile data explicitly in the
# configuration file. Each profile is identified with an id from the
# existing stea project, a start date and the actual data.

profiles:
    23fc0639-453f-42ee-876c-1e7b94a4f2bb:
       start-date: 2018-01-01
       data: [100, 200, 300]

# Profiles which are calculated directly from an eclipse simulation are
# listed with the ecl-profiles key. Each profile is identified with an id
# from the stea project and an eclipe key like 'FOPT'. By default the stea
# client will calculate a profile from the full time range of the simulated
# data, but you can optionally use the keywords start-date and end-year to
# limit the time range. All data in the end-year is included.
ecl-profiles:
  bf063de9-453f-42ee-876c-1e7b94a4f2bb:
     ecl-key: FOPT

  91e7b94a4f2bb-453f-42ee-876c-bf063de:
     ecl-key: FGPT
     start-date: 2020-01-01
     end-year: 2030

  profile_comment_in_stea:
     ecl-key: FWPT
     glob_mult: 1.1

  another_profile_comment_in_stea:
     ecl-key: FWPT
     mult: [ 1.1, 2, 0 ]

# When you use the ecl-profiles keyword to update profiles feteched directly
# from an eclipse simulation you also need to set the ecl-case keyword to
# point to an existing eclipse summary case on disk
ecl-case: models/eclipse/ECL_CASE_016

# What do you want stea to calculate
results:
   - NPV

An minimal example script using the stea package could be:

#!/usr/bin/env python
import sys
import stea

def main(argv):
    if len(argv) == 2:
       fname = argv[1]
    else:
        raise AttributeError('Need yaml formatted configuration file as first commandline argument')

    stea_input = stea.SteaInput([fname])
    res = stea.calculate(stea_input)
    for res, value in res.results(stea.SteaKeys.CORPORATE).items():
        print("{res} : {value}".format(res=res, value=value))


if __name__ == "__main__":
   main(sys.argv)

Installation and usage

stea is available on pypi and can be installed using pip install stea.

# Install
pip install stea

Run tests

tox is used as the test facilitator, to run the full test suite:

# Test
pip install tox
tox

or to run it for a particular Python version (in this case Python 3.7):

# Test
pip install tox
tox -e py37

or to run it for a the current Python version:

# Test
pip install tox
tox -e py

pytest is used as the test runner, so for quicker iteration it is possible to run:

# Test
pytest

this requires that the test dependencies from test_requirements.txt are installed.

# Install test requirements
pip install -r test_requirements.txt

black is used as the code formatter, to run the style test:

pip install tox
tox -e style

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fmu-steaclient-0.7.6.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

fmu_steaclient-0.7.6-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file fmu-steaclient-0.7.6.tar.gz.

File metadata

  • Download URL: fmu-steaclient-0.7.6.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for fmu-steaclient-0.7.6.tar.gz
Algorithm Hash digest
SHA256 d3ac234457ff69578fe5edd3b2ddd0ee7bd2cb0c1864a5c57b077aa3233dfcd9
MD5 80b7037d8dd98a7782bfc938294bf1a1
BLAKE2b-256 dd5def007881d9029d7731c7feb9286d8b12fc0efd44c63b5923a1959775a684

See more details on using hashes here.

File details

Details for the file fmu_steaclient-0.7.6-py3-none-any.whl.

File metadata

File hashes

Hashes for fmu_steaclient-0.7.6-py3-none-any.whl
Algorithm Hash digest
SHA256 05372698d09d112371c3ceef384918aa00c8b47fe5065fca3ed9d7d2dbaeb45b
MD5 4baa4cfe338ab315e02b2a273f734bcb
BLAKE2b-256 7425bc0af7b8a914e805c3860a5bdb580f1c742d28f43c5fc1051453c4190ee8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page