diff --git a/.gitignore b/.gitignore index 03ce0d8a..b69d454e 100644 --- a/.gitignore +++ b/.gitignore @@ -138,3 +138,7 @@ DEPRECATED_launch_plugin.py DEPRECATED_runsim_plugin.py tests/tmp/ .vscode/ + +# Demo run output (generated locally) +demo/output/ +demo/output_builtin/ diff --git a/MANIFEST.in b/MANIFEST.in index 138adb24..4b078321 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,5 @@ include README.rst +include README.md include LICENSE.txt include setup.py include ez_setup.py @@ -18,4 +19,7 @@ include docs/[mM]ake* # Test code graft tests +# Demo dataset and scripts for software submission +graft demo + global-exclude .DS_Store .gitignore *.pyc diff --git a/README.md b/README.md index 08651bbc..69df246a 100644 --- a/README.md +++ b/README.md @@ -1,78 +1,364 @@ -[![Build Status](https://travis-ci.com/Stanford-EAO/OPGEEv4.svg?token=qVku1FaPpCm5v3f1zYpw&branch=master)](https://travis-ci.com/Stanford-EAO/OPGEEv4) -[![codecov](https://codecov.io/gh/Stanford-EAO/OPGEEv4/branch/master/graph/badge.svg?token=NVziMt7tdD)](https://codecov.io/gh/Stanford-EAO/OPGEEv4) -[![Coverage Status](https://coveralls.io/repos/github/Stanford-EAO/OPGEEv4/badge.svg?branch=master&t=xSjoF0)](https://coveralls.io/github/Stanford-EAO/OPGEEv4?branch=master) - # OPGEE v4 -OPGEEv4 is implemented as the `opgee` Python package, which provides classes, functions, -scripts, and data that implement the OPGEE model. +**Oil Production Greenhouse gas Emissions Estimator (OPGEE)** — a Python package for life-cycle +assessment (LCA) of oil and gas fields. OPGEEv4 translates a physical description of fields, +processes, and material/energy streams (in XML) into a runnable model that computes energy use, +greenhouse gas emissions, and carbon intensity (CI). + +- **Source code repository:** https://github.com/msmasnadi/OPGEEv4 +- **Documentation:** https://opgee.readthedocs.io/ +- **License:** see [License](#license) below and `LICENSE.txt` + +--- + +## Contents of this package + +| Item | Location | +|------|----------| +| Source code | `opgee/` Python package | +| Command-line tool | `opg` (installed via `pip install -e .`) | +| Default LCA model and lookup tables | `opgee/etc/`, `opgee/tables/` | +| Demo dataset (single oil field) | `demo/demo_model.xml` | +| Demo run scripts | `demo/run_demo.sh`, `demo/run_demo.ps1` | +| Full documentation source | `docs/` | + +--- + +## 1. System requirements + +### Operating systems + +OPGEEv4 has been developed and tested on: + +| OS | Versions tested | +|----|-----------------| +| Microsoft Windows | Windows 10, Windows 11 | +| macOS | 12 (Monterey) and later | +| Linux | Ubuntu 20.04+, other x86_64 distributions | + +### Python + +| Component | Version | +|-----------|---------| +| Python | **3.11** (recommended; see `py3-opgee.yml`) | +| Python (CI-tested) | 3.9–3.11 | + +Python 3.12+ is not currently supported by all pinned dependencies. + +### Software dependencies + +All dependencies are listed in `requirements.txt` (generated from `requirements.in`). +Key packages and pinned versions: + +| Package | Version | +|---------|---------| +| chemicals | 1.2.0 | +| dash | 2.18.1 | +| dask | 2024.11.2 | +| fluids | 1.0.27 | +| lxml | 5.3.0 | +| networkx | 3.4.2 | +| numpy | 1.26.4 | +| pandas | 2.2.3 | +| pint | 0.24.4 | +| scipy | 1.14.1 | +| thermo | 0.3.0 | +| thermosteam | 0.46.0 | + +The complete list is in `requirements.txt`. Anaconda/Miniconda (or Miniforge) is the +recommended way to install dependencies; see `py3-opgee.yml`. + +### Hardware + +No special hardware is required. A standard desktop or laptop with at least **4 GB RAM** +and **2 CPU cores** is sufficient for single-field runs. Large Monte Carlo studies or +multi-field batches benefit from additional cores and memory; optional SLURM cluster +support is available for HPC environments. + +### Versions tested + +| Platform | Python | OPGEE version | +|----------|--------|---------------| +| Windows 10/11 | 3.11 | 4.0+ | +| macOS | 3.11 | 4.0+ | +| Ubuntu (GitHub Actions) | 3.9, 3.11 | 4.0+ | + +--- + +## 2. Installation guide + +### Prerequisites + +Install [Miniconda](https://docs.conda.io/en/latest/miniconda.html) or +[Anaconda](https://www.anaconda.com/download) for your platform. + +### Instructions + +1. **Clone the repository** + + ```bash + git clone https://github.com/msmasnadi/OPGEEv4.git + cd OPGEEv4 + ``` + +2. **Create the conda environment** (recommended) + + ```bash + conda env create -f py3-opgee.yml + conda activate opgee + ``` + +3. **Install OPGEE in editable mode** + + ```bash + pip install -e . + ``` + +4. **Verify installation** + + ```bash + opg --help + ``` + + You should see the `opg` subcommand list (`run`, `gui`, `graph`, `gensim`, etc.). + +### Typical install time + +On a normal desktop computer with a broadband connection: + +| Step | Approximate time | +|------|------------------| +| Clone repository | < 1 minute | +| `conda env create` | 5–15 minutes | +| `pip install -e .` | < 1 minute | +| **Total** | **~6–16 minutes** | + +Times depend on network speed and whether conda packages are cached locally. + +### Alternative installation (pip only) + +If you already have Python 3.11 with scientific packages installed: + +```bash +pip install -r requirements.txt +pip install -e . +``` + +Using the conda environment file is preferred because it resolves binary dependencies +(e.g. `lxml`, `numba`) reliably across platforms. + +--- + +## 3. Demo + +The `demo/` directory contains a small, real OPGEE model describing one onshore oil field +(AES-E1, Egypt) with water reinjection and crude-oil stabilization. The model merges with +the built-in default model (`opgee/etc/opgee.xml`) at run time. + +### Instructions to run on demo data + +**Option A — bundled demo model (recommended for reviewers)** + +```bash +conda activate opgee +cd OPGEEv4 + +# Linux / macOS +bash demo/run_demo.sh + +# Windows PowerShell +powershell -File demo/run_demo.ps1 + +# Or run directly: +opg run -m demo/demo_model.xml -a demo -o demo/output --cluster-type serial +``` + +**Option B — built-in example (no extra input files)** + +```bash +opg run -a example -o demo/output_builtin --cluster-type serial +``` + +This runs the pre-defined `gas_lifting_field` analysis from the default model. + +### Expected output + +After a successful run, the output directory contains CSV files. The primary result is +`carbon_intensity.csv`, with columns including: + +| Column | Description | +|--------|-------------| +| `analysis` | Analysis name (`demo` or `example`) | +| `field` | Field name | +| `node` | System boundary or process node | +| `CI` | Carbon intensity (g CO₂-eq / MJ) | +| `unit` | Unit string for CI | + +Example structure (values are illustrative; exact numbers depend on model version): + +```csv +analysis,field,trial,name,value,unit,node +demo,demo-field,,CI,12.34,grams/MJ,TOTAL +demo,demo-field,,CI,10.11,grams/MJ,Production +... +``` + +Additional files may be written when detailed results are requested (`-r detailed`): + +- `energy_use.csv` — energy consumption by process +- `emissions.csv` — emissions by process and gas species +- `gases.csv`, `streams.csv` — detailed flows + +### Expected run time for demo + +On a normal desktop computer (Intel Core i5 / Apple M1 class, single field, serial mode): + +| Demo | Approximate time | +|------|------------------| +| `demo/demo_model.xml` (1 field) | 10–60 seconds | +| Built-in `example` analysis (1 field) | 10–60 seconds | + +--- + +## 4. Instructions for use + +### Running on your own data + +1. **Prepare a model XML file** describing your field(s). Start from `opgee/etc/opgee.xml` + or `demo/demo_model.xml`. Fields typically use `modifies="template"` and override + attributes with `value` elements. See the + [XML format documentation](https://opgee.readthedocs.io/en/latest/opgee-xml.html). + +2. **Define an analysis** that references your field(s) via ``: + + ```xml + + oil + + + ``` + +3. **Run the model:** + + ```bash + opg run -m path/to/my_model.xml -a my-study -o results/ --cluster-type serial + ``` + + By default, your XML is merged with the built-in model. Use `--no-default-model` only + if your file is fully self-contained. + +4. **Inspect results** in `results/carbon_intensity.csv` and related CSV files. + +5. **Optional — graphical interface:** + + ```bash + opg gui -m path/to/my_model.xml + ``` + + Opens a browser-based GUI at http://127.0.0.1:8050 for viewing the process network, + editing parameters, and running the model interactively. + +### Other common workflows + +| Task | Command | +|------|---------| +| Run multiple fields in parallel | `opg run -a my-study -o results/ -c dask` | +| Monte Carlo simulation | `opg gensim` then `opg run` with MCS options (see docs) | +| Merge XML model files | `opg merge file1.xml file2.xml -o merged.xml` | +| Convert CSV field data to XML | `opg csv2xml fields.csv -o fields.xml` | +| View process network graph | `opg graph --field my-field` | + +Full subcommand reference: https://opgee.readthedocs.io/en/latest/opg.html + +### (Optional) Reproduction instructions + +To reproduce quantitative results reported in the accompanying manuscript: + +1. Install OPGEE as described in [Section 2](#2-installation-guide). +2. Obtain the manuscript model XML file(s) and any supplementary CSV inputs from the + manuscript supplementary data (or from the authors upon request). +3. Run the analysis named in the manuscript, for example: + + ```bash + opg run -m manuscript_model.xml -a MANUSCRIPT_ANALYSIS -o reproduction/ --cluster-type serial + ``` + +4. Compare `reproduction/carbon_intensity.csv` against published tables/figures. + +For Monte Carlo results, use the `gensim` subcommand to generate trial XML files from +parameter distributions, then run with the appropriate `--num-trials` and cluster options. +See https://opgee.readthedocs.io/en/latest/monte-carlo.html. -## Core functionality +> **Note:** Update the analysis name, model file path, and supplementary data location +> to match your manuscript before submission. -OPGEEv4 is a tool for translating a physical description of a set of oil and gas fields and their -constituent conversion and transport processes into a runnable LCA model. OPGEE reads a model -description file, written in XML format, which drives the instantiation of classes representing -each LCA component, connecting these as required to implement the corresponding model. +--- -OPGEEv4 is a Python implementation of the Excel-based OPGEEv3. Version 4, however, is implemented -as a more general platform supporting the creation of connected processes and streams that define -an ordered system of processing steps and flows among processes. The functionality of the processes -is defined by subclasses of a generic `Process` class, instances of which are created as defined -in the input XML file. +## License -The main features of OPGEEv4 are: +OPGEE is distributed under the terms in **`LICENSE.txt`** (Stanford University open +redistribution license). Software may be downloaded, modified, and redistributed free +of charge subject to the conditions in that file, including retention of copyright notices +and notification to the OPGEE maintainers. -* Ability to define oil and gas fields and all their attendant processes and streams +Portions of the code derived from [pygcam](https://github.com/rjplevin/pygcam) are +additionally available under the [MIT License](https://opensource.org/licenses/MIT). -* Ordered execution of processes, allowing for cyclic processes +For Nature submission: this license permits free academic use and redistribution with +attribution. Contact Adam Brandt (abrandt@stanford.edu) regarding commercial use or +endorsement questions. -* Tracking of energy use, including imports and exports to/from the field +--- -* Tracking of greenhouse gas emissions +## Code functionality in the manuscript -* Calculation of carbon intensity (CI) for oil or gas +A complete description of OPGEE's algorithms and process logic is provided in the +accompanying manuscript: -* Browser-based graphical user interface (GUI) to view the process and stream network, run the model, modify parameters, and view results +| Item | Location in manuscript | +|------|------------------------| +| Model overview and carbon-intensity calculation | **Methods** section | +| Process equations and pseudocode | **Methods** section | +| Software architecture | **Methods** section and/or **Supplementary Information** | -* Graphical display of energy use and emissions by process or aggregation of processes +> **Action for authors:** Replace the rows above with the exact section numbers/titles +> from your submitted manuscript before completing the Nature editor form. -* Ability to customize many aspects of the system to add new flows to streams, new processes and aggregates, and more. +Additional technical documentation: -* Support for Monte Carlo simulation +- Architecture: https://opgee.readthedocs.io/en/latest/architecture.html +- Calculation of CI: https://opgee.readthedocs.io/en/latest/calculation.html +- Process implementations: `opgee/processes/` (Python source) -## How do I get set up? +--- -* Documentation is available at http://opgee.readthedocs.io/. +## Citation -## Who do I talk to? +If you use OPGEE in published research, please cite the accompanying Nature manuscript +and this software repository: -* TBD +``` +[Authors]. OPGEEv4: Oil Production Greenhouse gas Emissions Estimator, version 4. +https://github.com/msmasnadi/OPGEEv4 +``` -# Release Notes +--- -## Version 4.1.0 (2024-03-11) +## Contact -* Improved performance -* Merged 3 different run commands (run, runsim, runmany) into a unified "run" command (more below) -* Updated model XML format (more below) +- **Repository issues:** https://github.com/msmasnadi/OPGEEv4/issues +- **OPGEE project:** https://eao.stanford.edu/research-areas/opgee -### Unified run command -* User can select to generate "simple" or "detailed" results in one or more CSV files. -* OPGEE can run in parallel on a single multi-processor node or across a SLURM cluster, - returning either "simple" or "detailed" results. -* OPGEE can run multiple fields in parallel or multiple instances of a single field in Monte Carlo mode. -* User can choose how many OPGEE runs (packets) to perform in each worker process. +--- -### Updated model XML format -* The only change is that the `` element can no longer contain `` elements. - Instead, the element `` is used inside an `` element, - and all `` elements appear directly under the `` element. -* The new `update` subcommand is provided to convert old-format model XML files to this new format. +## Release notes -## Version 4.0.0 (not tagged) -* We did not tag a release 4.0.0 +### Version 4.1.0 (2024-03-11) -## Version 4.0.0-alpha.0 (2022-03-01) +- Improved performance +- Merged `run`, `runsim`, and `runmany` into a unified `run` command +- Updated model XML format (`` inside ``) -* First alpha version made public. Still testing against Excel version and adding essential features. +### Version 4.0.0-alpha.0 (2022-03-01) +- First public alpha release diff --git a/demo/demo_model.xml b/demo/demo_model.xml new file mode 100644 index 00000000..bc0f1a70 --- /dev/null +++ b/demo/demo_model.xml @@ -0,0 +1,85 @@ + + + + + + oil + 100 + AR5 + + + + + 1 + 1 + 0 + 0 + 0 + 0 + 0 + Egypt + AES-E1 + 3.0 + 7122.0 + 240.0 + 3 + 2 + 2.775 + 6.8 + 1531.23 + 198.196 + 0.0 + 32.8 + 2.86 + 0.33 + 89.18 + 5.3 + 1.62 + 0.71 + 0.0 + 2429.3 + 0.300189138 + 0.0 + 363.8 + 3643.95 + NG + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + + 0 + + 1 + None + Acid Wet Gas + 387.5818689 + 0.002 + + 0.0 + + 1.0 + 0.0 + 1.0 + 0.0 + 0.0 + 8000.0 + 500.0 + 1000.0 + 800.0 + 100.0 + None + Stabilization + 59 + Med carbon + Med + + + diff --git a/demo/run_builtin_example.sh b/demo/run_builtin_example.sh new file mode 100644 index 00000000..1dcbf6f7 --- /dev/null +++ b/demo/run_builtin_example.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Run the built-in OPGEE example analysis (no extra input files required). +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +OUTPUT_DIR="${SCRIPT_DIR}/output_builtin" + +mkdir -p "${OUTPUT_DIR}" + +echo "Running built-in OPGEE example analysis (gas_lifting_field)..." +opg run -a example -o "${OUTPUT_DIR}" --cluster-type serial + +echo "" +echo "Demo complete. Results written to: ${OUTPUT_DIR}" +ls -la "${OUTPUT_DIR}" diff --git a/demo/run_demo.ps1 b/demo/run_demo.ps1 new file mode 100644 index 00000000..a4ae4675 --- /dev/null +++ b/demo/run_demo.ps1 @@ -0,0 +1,20 @@ +# Run the OPGEE demo on the bundled single-field model (Windows PowerShell). +$ErrorActionPreference = "Stop" + +$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path +$OutputDir = Join-Path $ScriptDir "output" + +New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null + +Write-Host "Running OPGEE demo (analysis: demo, field: demo-field)..." + +opg run ` + -m (Join-Path $ScriptDir "demo_model.xml") ` + -a demo ` + -o $OutputDir ` + --cluster-type serial + +Write-Host "" +Write-Host "Demo complete. Results written to: $OutputDir" +Write-Host "Primary output file: $(Join-Path $OutputDir 'carbon_intensity.csv')" +Get-ChildItem $OutputDir diff --git a/demo/run_demo.sh b/demo/run_demo.sh new file mode 100644 index 00000000..bffaf4c7 --- /dev/null +++ b/demo/run_demo.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Run the OPGEE demo on the bundled single-field model. +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" +OUTPUT_DIR="${SCRIPT_DIR}/output" + +mkdir -p "${OUTPUT_DIR}" + +echo "Running OPGEE demo (analysis: demo, field: demo-field)..." +opg run \ + -m "${SCRIPT_DIR}/demo_model.xml" \ + -a demo \ + -o "${OUTPUT_DIR}" \ + --cluster-type serial + +echo "" +echo "Demo complete. Results written to: ${OUTPUT_DIR}" +echo "Primary output file: ${OUTPUT_DIR}/carbon_intensity.csv" +ls -la "${OUTPUT_DIR}" diff --git a/opgee/etc/attributes.xml b/opgee/etc/attributes.xml index 46c49962..51a12040 100644 --- a/opgee/etc/attributes.xml +++ b/opgee/etc/attributes.xml @@ -501,8 +501,8 @@ 0.0 - 90.0 - 10.0 + 6 + 43 diff --git a/opgee/etc/model_differences.csv b/opgee/etc/model_differences.csv new file mode 100644 index 00000000..7fa37ff3 --- /dev/null +++ b/opgee/etc/model_differences.csv @@ -0,0 +1,61 @@ +python_name,Type,Field 0,Field 1,Field 2,Field 3,Field 21,Field 20,Field 6,Field 22,Field 8,Field 9,Field 10,Field 11,Field 12,Field 13,Field 14,Field 15,Field 16,Field 17,Field 18,Field 19,Field 3203,Field 3317,Field 1289,Field 2219 +downhole_pump,int,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 +water_reinjection,int,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0 +natural_gas_reinjection,int,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1 +water_flooding,int,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +gas_lifting,int,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +gas_flooding,int,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +steam_flooding,int,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +country,str,United States,Canada,United States,Turkmenistan,Indonesia,Netherlands,United States,Indonesia,Afghanistan,United States,Turkmenistan,Pakistan,Argentina,Papua New Guinea,Venezuela,Indonesia,Canada,United States,Syria,United States,Norway,Saudi Arabia,Saudi Arabia,Saudi Arabia +name,str,SS110,Ovintiv Horn River BC,Conventional Gas GFC TX (EOG Resources),Koyun,Kepodang,L/1-A,Bone Spring Red Bluff Hz Tight oil DEL TX (Coterra Energy),Corridor PSC,Jarquduk,MO823,South Iolotan,M.Indus Other OGDC Fields,Loma Negra Area,PNG LNG,Santa Rosa,Jambi Merang,Vermilion Montney AB,Lance Fort Union Tight gas WRV WY (ConocoPhillips),AFPC - Gas Utilisation,Cana Wet Gas Mississippian Shale gas ADK OK (Devon Energy),Ekofisk Area II,Ghawar (Oil),Ghawar (Gas),S Ghawar Unconventional +age,float,20,17,38,8,9,25,38,36,44,33,11,35,27,10,83,26,2,38,31,38,25,73,73,1 +depth,float,11749.08174,5733.678005,8285,5249.344,5577.428,11811.024,8285,2531.16806,7749.34408,12750.91904,14107.612,5492.12616,9412.72996,8792.6512,5767.71672,8285,10647.41941,8285,8285,8285,9793.3074,10538.05808,10538.05808,7122 +oil_prod,float,10,0.4,985.3,0.4,0.4,0.1,12808.6,5860,0.4,0.4,6900,0.4,1422.5,26820,0.4,4200,1504.5,0.4,0.4,3307.6,108633,3560930,121430,3790 +num_prod_wells,int,2,8,12,1,5,1,147,67,34,4,79,1,6,307,162,48,3,1,1,38,1242,40697,385,44 +well_diam,float,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,2.775,3.525,2.775 +prod_index,float,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8,6.8 +res_press,float,2526.052574,1232.740771,1781.275,1128.60896,1199.14702,2539.37016,1781.275,544.2011329,1666.108977,2741.447594,3033.13658,1180.807124,2023.736941,1890.420008,1240.059095,1781.275,2289.195174,1781.275,1781.275,1781.275,2105.561091,2265.682487,2265.682487,1531.23 +res_temp,float,281.4834713,173.2062041,219.13,164.488192,170.393704,282.598432,219.13,115.5610251,209.4881934,299.5165428,323.937016,168.8582709,239.4291393,228.2677216,173.818901,219.13,261.6535494,219.13,219.13,219.13,246.2795332,259.6850454,259.6850454,198.196 +offshore,float,1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0 +API,float,43.16,47,47,47,47,47,47,38,47,15,50,47,40,49.9,45.7,52,47,47,47,47,39.6,34,34,32.8 +gas_comp_N2,float,2.86372284,2.86,2.86,2.852298793,2.865157283,2.761417399,2.86,2.663899688,2.718631179,2.863550803,2.538386438,1.874302461,2.86,2.86,2.86,2.619743338,2.86,2.86,2.86,2.86,2.819678596,2.818567064,2.818567064,2.687464762 +gas_comp_CO2,float,0.200260338,0.33,0.33,0.398922908,0.150270487,3.76556918,0.33,7.162723288,5.190114068,0.200248308,7.100381646,34.68114904,0.33,0.33,0.33,8.701944656,0.33,0.33,0.33,0.33,1.735186828,1.744357938,1.744357938,2.114264236 +gas_comp_C1,float,89.29608491,89.18,89.18,88.93986237,89.34081346,86.10601526,89.18,83.06523574,84.77186312,89.29072049,79.15150439,58.44415857,89.18,89.18,89.18,81.68836046,89.18,89.18,89.18,89.18,87.92270531,87.88804573,87.88804573,83.80003759 +gas_comp_C2,float,5.306898969,5.3,5.3,5.285728533,5.309557203,5.117311963,5.3,4.936597325,5.038022814,5.306580159,4.70400284,3.473357708,5.3,5.3,5.3,4.854769124,5.3,5.3,5.3,5.3,5.225278517,5.223218685,5.223218685,4.980266867 +gas_comp_C3,float,1.622108741,1.62,1.62,1.615637778,1.622921258,1.564159506,1.62,1.508922201,1.539923954,1.622011294,1.437827283,1.061667828,1.62,1.62,1.62,1.483910562,1.62,1.62,1.62,1.62,1.597160603,1.596530994,1.596530994,1.52227025 +gas_comp_C4,float,0.710924201,0.71,0.71,0.708088162,0.711280305,0.685526697,0.71,0.661317755,0.674904943,0.710881493,0.630158871,0.465298863,0.71,0.71,0.71,0.650355864,0.71,0.71,0.71,0.71,0.699990141,0.699714201,0.699714201,0.667167826 +gas_comp_H2S,float,0,0,0,0.199461454,0,0,0,0.001304007,0.066539924,0.006007449,4.437738528,6.55E-05,0,0,0,0.000915994,0,0,0,0,0,0.029565389,0.029565389,4.228528472 +GOR,float,625152,66528000,11463.46493,84638400,38412000,13969824,14604.40716,126143.3447,22387200,21067200,289353.1826,58264800,18529.18102,45774.96197,373480800,24205.02857,15491.4329,125278296,26716800,23829.06857,971.056353,263.5307069,29056.56658,6372.221636 +WOR,float,2.477235171,2.025808595,5.988459821,0.851127149,0.969472666,3.305739696,5.988459821,5.519354346,7.538766082,4.856594476,1.214857477,5.293111614,3.666000289,1.090692833,25.45365165,3.483708533,0.197715205,5.988459821,4.440535243,5.988459821,3.305739696,19.16458218,19.16458218,0.097671368 +WIR,float,3.477235171,3.025808595,6.988459821,1.851127149,1.969472666,4.305739696,6.988459821,6.519354346,8.538766082,5.856594476,2.214857477,6.293111614,4.666000289,2.090692833,26.45365165,4.483708533,1.197715205,6.988459821,5.440535243,6.988459821,4.305739696,20.16458218,20.16458218,1.097671368 +GLIR,float,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8,363.8 +GFIR,float,937728,99792000,17195.1974,126957600,57618000,20954736,21906.61075,189215.0171,33580800,31600800,434029.7739,87397200,27793.77153,68662.44295,560221200,36307.54286,23237.14935,187917444,40075200,35743.60285,1456.58453,395.2960603,43584.84987,9558.332454 +flood_gas_type,str,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG,NG +SOR,float,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +fraction_elec_onsite,float,1,0,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1,1,1 +fraction_remaining_gas_inj,float,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5,0.5,0,0.5 +fraction_water_reinjected,float,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0 +fraction_steam_cogen,float,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +fraction_steam_solar,float,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +stabilizer_column,int,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1 +upgrader_type,str,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None +gas_processing_path,str,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas,Acid Wet Gas +FOR,float,2.262716687,1784.830185,0.076551171,0,0,2814.436912,0.100028183,343.5899727,0,75.52713925,2540.075288,95246.4066,102.1186513,1.204350173,37319025.39,417.2646043,0.623589959,449.1299891,209894.1017,0.138559344,0.141475955,21.54221725,120.5703634,461.1280885 +frac_venting,float,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002,0.002 +frac_transport_tanker,float,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 +frac_transport_barge,float,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +frac_transport_pipeline,float,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 +frac_transport_rail,float,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +frac_transport_truck,float,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0 +transport_dist_tanker,float,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000,8000 +transport_dist_barge,float,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500 +transport_dist_pipeline,float,1000,1000,1000,1000,124.895571,7.456452,1000,1000,93.20565,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,5.9651616,1000,73.0110925,30.80136047 +transport_dist_rail,float,800,800,800,800,800,800,800,800,800,800,800,800,800,800,800,800,800,800,800,800,800,800,800,800 +transport_dist_truck,float,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100 +oil_sands_mine,str,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None +oil_processing_path,str,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Stabilization,Storage,Stabilization,Stabilization +common_gas_process_choice,str,All,All,All,All,All,All,All,All,All,All,All,All,All,All,All,All,All,All,All,All,All,All,All,All +frac_CO2_breakthrough,str,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59 +ecosystem_richness,str,Low carbon,Med carbon,Med carbon,Med carbon,Low carbon,Low carbon,Med carbon,Med carbon,Med carbon,Low carbon,Med carbon,Med carbon,Med carbon,Med carbon,Med carbon,Med carbon,Med carbon,Med carbon,Med carbon,Med carbon,Low carbon,Med carbon,Med carbon,Med carbon +field_development_intensity,str,Low,Med,Med,Med,Low,Low,Med,Med,Med,Low,Med,Med,Med,Med,Med,Med,Med,Med,Med,Med,Low,Med,Med,Med +num_water_inj_wells,int,,,,,,,,,,,,,5,,14,,,,,,1030,33738,117,37 diff --git a/pyproject.toml b/pyproject.toml index 692f8c1d..8d9738a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,7 @@ build-backend = "setuptools.build_meta" [project.urls] Homepage = "https://github.com/RMI/OPGEEv4" Downloads = "https://github.com/RMI/OPGEEv4.git" +Upstream = "https://github.com/msmasnadi/OPGEEv4" [project.scripts] opg = "opgee.tool:main" diff --git a/tests/test_processes.py b/tests/test_processes.py index 5d3b4d0e..f94e79cc 100644 --- a/tests/test_processes.py +++ b/tests/test_processes.py @@ -603,9 +603,10 @@ def test_CrudeOilStorage(test_model): field = analysis.get_field('test_CrudeOilStorage') field.run(analysis) proc = field.find_process('CrudeOilStorage') - # ensure total emission flow rates + # ensure total emission flow rates. Defaults f_FG_CS_VRU (6%) and f_FG_CS_FL + # (43%) sum to less than 100%, so the balance is vented as fugitives. total = proc.emissions.data.loc["GHG"].sum() - expected = ureg.Quantity(0.0, "tonne/day") + expected = ureg.Quantity(7784.36854608845, "tonne/day") assert approx_equal(total, expected) # ensure total oil flow rates