Skip to content
Snippets Groups Projects
Commit 73863c70 authored by Christoph Knote's avatar Christoph Knote
Browse files

Fix circular dependency issue

parent c476f733
Branches
Tags
No related merge requests found
...@@ -3,27 +3,16 @@ ...@@ -3,27 +3,16 @@
``boxmox`` is the Python wrapper for the chemical box model BOXMOX (a standalone ``boxmox`` is the Python wrapper for the chemical box model BOXMOX (a standalone
C/Fortran executable). C/Fortran executable).
## Contributing
We are looking forward to receiving your [new issue report](https://mbees.med.uni-augsburg.de/gitlab/mbees/boxmox_pypackage/-/issues/new).
If you'd like to contribute source code directly, please [create a fork](https://mbees.med.uni-augsburg.de/gitlab/mbees/boxmox_pypackage),
make your changes and then [submit a merge request](https://mbees.med.uni-augsburg.de/gitlab/mbees/boxmox_pypackage/-/merge_requests/new) to the original project.
## Installation ## Installation
### BOXMOX model needs to be installed ### BOXMOX model needs to be installed
The BOXMOX chemical box model needs to be installed and usable, The BOXMOX chemical box model needs to be installed and the ``KPP_HOME`` environment variable has to be set. Download and instructions are our website at https://mbees.med.uni-augsburg.de/boxmodeling.
and the KPP_HOME environment variable has to be set.
You can download it from our website at https://mbees.med.uni-augsburg.de/boxmodeling.
### Environment variable needs to be set ### Environment variable needs to be set
Additionally, boxmox needs a path to write temporary model results Additionally, ``boxmox`` needs a path to write temporary model results
to. This directory needs to be accessible and writeable by the to, given through the environment variable ``BOXMOX_WORK_PATH``. This directory needs to be accessible and writeable by the user. Set it in your environment, e.g., through:
user. Set it in your environment, e.g., through:
``` ```
export BOXMOX_WORK_PATH=/where/you/want/boxmox/to/write/stuff/to/ export BOXMOX_WORK_PATH=/where/you/want/boxmox/to/write/stuff/to/
...@@ -31,9 +20,20 @@ export BOXMOX_WORK_PATH=/where/you/want/boxmox/to/write/stuff/to/ ...@@ -31,9 +20,20 @@ export BOXMOX_WORK_PATH=/where/you/want/boxmox/to/write/stuff/to/
Remember to close the shell and log in again for these changes to take effect. Remember to close the shell and log in again for these changes to take effect.
## Contributing
We are looking forward to receiving your [new issue report](https://mbees.med.uni-augsburg.de/gitlab/mbees/boxmox_pypackage/-/issues/new).
If you'd like to contribute source code directly, please [create a fork](https://mbees.med.uni-augsburg.de/gitlab/mbees/boxmox_pypackage),
make your changes and then [submit a merge request](https://mbees.med.uni-augsburg.de/gitlab/mbees/boxmox_pypackage/-/merge_requests/new) to the original project.
# Changelog # Changelog
## 1.2.0 (2022-03-08) ## 1.2.4 (2022-03-14)
- Release on PyPI
## 1.2.0 (2022-03-08) (not released)
- Updates to be compatible with BOXMOX 1.8 - Updates to be compatible with BOXMOX 1.8
......
[tool.poetry] [tool.poetry]
name = "boxmox" name = "boxmox"
version = "1.2.2" version = "1.2.4"
description = "BOXMOX python interface" description = "BOXMOX python interface"
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
authors = ["Christoph Knote <christoph.knote@med.uni-augsburg.de>"] authors = ["Christoph Knote <christoph.knote@med.uni-augsburg.de>"]
......
...@@ -28,7 +28,7 @@ if not os.path.isdir(work_path): ...@@ -28,7 +28,7 @@ if not os.path.isdir(work_path):
else: else:
from .experiment import Experiment, ExperimentFromExample, ExperimentFromExistingRun, Namelist, examples, compiledMechs from .experiment import Experiment, ExperimentFromExample, ExperimentFromExistingRun, Namelist, examples, compiledMechs
from .data import InputFile, InputFileOrig, InputFile17, Output, ConcentrationOutput, RatesOutput, AdjointOutput, JacobianOutput, HessianOutput from .data import InputFile, Output, ConcentrationOutput, RatesOutput, AdjointOutput, JacobianOutput, HessianOutput
from .fluxes import FluxParser from .fluxes import FluxParser
try: try:
......
...@@ -3,18 +3,15 @@ import subprocess as s ...@@ -3,18 +3,15 @@ import subprocess as s
import threading import threading
import shutil import shutil
import fnmatch import fnmatch
import numpy as np
import datetime import datetime
import f90nml import f90nml
from . import _installation from .data import InputFile, Output, ConcentrationOutput, RatesOutput, AdjointOutput, JacobianOutput, HessianOutput
from . import InputFile, Output, ConcentrationOutput, RatesOutput, AdjointOutput, JacobianOutput, HessianOutput
try: try:
import matplotlib
from .plotter import ExperimentPlotter from .plotter import ExperimentPlotter
except: except:
pass pass
from . import FluxParser from .fluxes import FluxParser
workPath=os.environ['BOXMOX_WORK_PATH'] workPath=os.environ['BOXMOX_WORK_PATH']
examplesPath=os.path.join(os.environ['KPP_HOME'], "case_studies") examplesPath=os.path.join(os.environ['KPP_HOME'], "case_studies")
...@@ -205,7 +202,7 @@ class Experiment: ...@@ -205,7 +202,7 @@ class Experiment:
def _run(self, dumbOutput=False): def _run(self, dumbOutput=False):
try: try:
self.pid = s.Popen([ "./" + self.mechanism + ".exe" ], stdout=s.PIPE, bufsize=1, cwd=self.path) self.pid = s.Popen([ "./" + self.mechanism + ".exe" ], stdout=s.PIPE, cwd=self.path)
self.pid.wait() self.pid.wait()
self._pp_run(dumbOutput=dumbOutput) self._pp_run(dumbOutput=dumbOutput)
except Exception as e: except Exception as e:
...@@ -229,7 +226,7 @@ class Experiment: ...@@ -229,7 +226,7 @@ class Experiment:
for type in self.input: for type in self.input:
with open( os.path.join(self.path, type + '.csv'), 'w') as f: with open( os.path.join(self.path, type + '.csv'), 'w') as f:
self.input[type].write(f, version=self.version) self.input[type].write(f)
pwd = os.getcwd() pwd = os.getcwd()
os.chdir(self.path) os.chdir(self.path)
......
...@@ -3,8 +3,8 @@ import boxmox ...@@ -3,8 +3,8 @@ import boxmox
import numpy as np import numpy as np
# evaluate differences in run with different NO2 initial conditions # evaluate differences in run with different NO2 initial conditions
no2_ics = np.linspace(0.01, 0.3, 20) no2_ics = np.linspace(0.01, 0.3, 10)
c2h4_ics = np.linspace(0.1, 2.000, 20) c2h4_ics = np.linspace(0.1, 2.000, 10)
X,Y = np.meshgrid(no2_ics, c2h4_ics) X,Y = np.meshgrid(no2_ics, c2h4_ics)
Z = np.zeros_like(X) Z = np.zeros_like(X)
......
export KPP_HOME=/Users/lechriso/git/boxmox/boxmox/
export PATH="$KPP_HOME/bin:$KPP_HOME/boxmox/bin:$PATH"
export BOXMOX_WORK_PATH=/tmp/
echo " - - - - "
echo "PYTHON 2"
echo
echo "simple.py"
echo
python2 simple.py
echo
echo "intermediate.py"
echo
python2 intermediate.py
echo
echo " - - - - "
echo "PYTHON 3"
echo
echo "simple.py"
echo
python3 simple.py
echo
echo "intermediate.py"
echo
python3 intermediate.py
echo
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment