Skip to content

Commit 294bf41

Browse files
authored
Merge pull request #11 from GeoStat-Framework/develop
Release v1.0.3
2 parents e24d7d1 + 5bdf033 commit 294bf41

File tree

9 files changed

+231
-164
lines changed

9 files changed

+231
-164
lines changed

.github/workflows/main.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
- "develop"
8+
tags:
9+
- "*"
10+
pull_request:
11+
branches:
12+
- "develop"
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
env:
17+
# needed by coveralls
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
20+
jobs:
21+
build_sdist:
22+
name: sdist on ${{ matrix.os }} with py ${{ matrix.python-version }}
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
os: [ubuntu-latest, windows-latest, macos-latest]
28+
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
29+
30+
steps:
31+
- uses: actions/checkout@v2
32+
with:
33+
fetch-depth: '0'
34+
35+
- name: Set up Python ${{ matrix.python-version }}
36+
uses: actions\setup-python@v2
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
40+
- name: Install dependencies
41+
run: |
42+
python -m pip install --upgrade pip
43+
pip install -U wheel
44+
pip install -r requirements_setup.txt
45+
pip install -r requirements.txt
46+
pip install -r requirements_test.txt
47+
pip install coveralls>=3.0.0
48+
49+
- name: Build sdist
50+
run: |
51+
python setup.py sdist --formats=gztar bdist_wheel -d dist
52+
53+
- name: Run tests
54+
run: |
55+
python -m pytest --cov welltestpy --cov-report term-missing -v tests/
56+
python -m coveralls --service=github
57+
58+
- uses: actions/upload-artifact@v2
59+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
60+
with:
61+
path: dist
62+
63+
upload_to_pypi:
64+
needs: [build_sdist]
65+
runs-on: ubuntu-latest
66+
67+
steps:
68+
- uses: actions/download-artifact@v2
69+
with:
70+
name: artifact
71+
path: dist
72+
73+
- name: Publish to Test PyPI
74+
# only if working on develop
75+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
76+
uses: pypa/gh-action-pypi-publish@master
77+
with:
78+
user: __token__
79+
password: ${{ secrets.test_pypi_password }}
80+
repository_url: https://test.pypi.org/legacy/
81+
skip_existing: true
82+
83+
- name: Publish to PyPI
84+
# only if tagged
85+
if: startsWith(github.ref, 'refs/tags')
86+
uses: pypa/gh-action-pypi-publish@master
87+
with:
88+
user: __token__
89+
password: ${{ secrets.pypi_password }}

.travis.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
All notable changes to **welltestpy** will be documented in this file.
44

5+
## [1.0.3] - 2021-02
6+
7+
### Enhancements
8+
- Estimations: run method now provides `plot_style` keyword to control plotting
9+
10+
### Changes
11+
- Fit plot style for transient pumping tests was updated
12+
13+
### Bugfixes
14+
- Estimations: run method was throwing an Error when setting `run=False`
15+
- Plotter: all plotting routines now respect setted font-type from matplotlib
16+
17+
518
## [1.0.2] - 2020-09-03
619

720
### Bugfixes
@@ -78,6 +91,7 @@ All notable changes to **welltestpy** will be documented in this file.
7891

7992
First alpha release of welltespy.
8093

94+
[1.0.3]: https://github.com/GeoStat-Framework/welltestpy/compare/v1.0.2...v1.0.3
8195
[1.0.2]: https://github.com/GeoStat-Framework/welltestpy/compare/v1.0.1...v1.0.2
8296
[1.0.1]: https://github.com/GeoStat-Framework/welltestpy/compare/v1.0.0...v1.0.1
8397
[1.0.0]: https://github.com/GeoStat-Framework/welltestpy/compare/v0.3.2...v1.0.0

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2020 Sebastian Mueller
3+
Copyright (c) 2021 Sebastian Mueller
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1229051.svg)](https://doi.org/10.5281/zenodo.1229051)
44
[![PyPI version](https://badge.fury.io/py/welltestpy.svg)](https://badge.fury.io/py/welltestpy)
5-
[![Build Status](https://travis-ci.com/GeoStat-Framework/welltestpy.svg?branch=master)](https://travis-ci.com/GeoStat-Framework/welltestpy)
6-
[![Coverage Status](https://coveralls.io/repos/github/GeoStat-Framework/welltestpy/badge.svg?branch=master)](https://coveralls.io/github/GeoStat-Framework/welltestpy?branch=master)
7-
[![Documentation Status](https://readthedocs.org/projects/welltestpy/badge/?version=stable)](https://geostat-framework.readthedocs.io/projects/welltestpy/en/stable/?badge=stable)
5+
[![Build Status](https://github.com/GeoStat-Framework/welltestpy/workflows/Continuous%20Integration/badge.svg?branch=develop)](https://github.com/GeoStat-Framework/welltestpy/actions)
6+
[![Coverage Status](https://coveralls.io/repos/github/GeoStat-Framework/welltestpy/badge.svg?branch=develop)](https://coveralls.io/github/GeoStat-Framework/welltestpy?branch=develop)
7+
[![Documentation Status](https://readthedocs.org/projects/welltestpy/badge/?version=latest)](https://geostat-framework.readthedocs.io/projects/welltestpy/en/latest/?badge=latest)
88
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
99

1010
<p align="center">
@@ -25,7 +25,7 @@ You can install the latest version with the following command:
2525

2626
## Documentation for welltestpy
2727

28-
You can find the documentation under [geostat-framework.readthedocs.io][doc_link].
28+
You can find the documentation under [https://welltestpy.readthedocs.io][doc_link].
2929

3030

3131
### Example 1: A campaign containing a pumping test
@@ -121,7 +121,7 @@ You can contact us via <[email protected]>.
121121

122122
## License
123123

124-
[MIT][license_link] © 2018-2020
124+
[MIT][license_link] © 2018-2021
125125

126126
[license_link]: https://github.com/GeoStat-Framework/welltestpy/blob/master/LICENSE
127127
[doc_link]: https://welltestpy.readthedocs.io

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,9 @@ def setup(app):
263263
# only show "print" output as output
264264
"capture_repr": (),
265265
# path to your examples scripts
266-
"examples_dirs": ["../../examples",],
266+
"examples_dirs": ["../../examples"],
267267
# path where to save gallery generated examples
268-
"gallery_dirs": ["examples",],
268+
"gallery_dirs": ["examples"],
269269
# Pattern to search for example files
270270
"filename_pattern": "/.*.py",
271271
"ignore_pattern": r"03_estimate_hetero\.py",

welltestpy/estimate/steady_lib.py

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ def run(
300300
fittingplotname=None,
301301
interactplotname=None,
302302
estname=None,
303+
plot_style="WTP",
303304
):
304305
"""Run the estimation.
305306
@@ -348,11 +349,13 @@ def run(
348349
If ``None``, it will be the current time +
349350
``"_estimate"``.
350351
Default: ``None``
352+
plot_style : str, optional
353+
Plot stlye. The default is "WTP".
351354
"""
352355
if self.setup.dummy:
353356
raise ValueError(
354357
"Estimate: for parameter estimation"
355-
+ " you can't use a dummy paramter."
358+
" you can't use a dummy paramter."
356359
)
357360
act_time = timemodule.strftime("%Y-%m-%d_%H-%M-%S")
358361

@@ -405,42 +408,45 @@ def run(
405408
else:
406409
rank = 0
407410

411+
# initialize the sampler
412+
sampler = spotpy.algorithms.sceua(
413+
self.setup,
414+
dbname=dbname,
415+
dbformat="csv",
416+
parallel=parallel,
417+
save_sim=True,
418+
db_precision=np.float64,
419+
)
420+
# start the estimation with the sce-ua algorithm
408421
if run:
409-
# initialize the sampler
410-
sampler = spotpy.algorithms.sceua(
411-
self.setup,
412-
dbname=dbname,
413-
dbformat="csv",
414-
parallel=parallel,
415-
save_sim=True,
416-
db_precision=np.float64,
417-
)
418-
# start the estimation with the sce-ua algorithm
419422
sampler.sample(rep, ngs=10, kstop=100, pcento=1e-4, peps=1e-3)
420423

421-
if rank == 0:
422-
# save best parameter-set
424+
if rank == 0:
425+
if run:
423426
self.result = sampler.getdata()
424-
para_opt = spotpy.analyser.get_best_parameterset(
425-
self.result, maximize=False
427+
else:
428+
self.result = np.genfromtxt(
429+
dbname + ".csv", delimiter=",", names=True
426430
)
427-
void_names = para_opt.dtype.names
428-
para = []
429-
header = []
430-
for name in void_names:
431-
para.append(para_opt[0][name])
432-
header.append(name[3:])
433-
self.estimated_para[header[-1]] = para[-1]
434-
np.savetxt(paraname, para, header=" ".join(header))
435-
436-
if rank == 0:
431+
para_opt = spotpy.analyser.get_best_parameterset(
432+
self.result, maximize=False
433+
)
434+
void_names = para_opt.dtype.names
435+
para = []
436+
header = []
437+
for name in void_names:
438+
para.append(para_opt[0][name])
439+
header.append(name[3:])
440+
self.estimated_para[header[-1]] = para[-1]
441+
np.savetxt(paraname, para, header=" ".join(header))
437442
# plot the estimation-results
438443
plotter.plotparatrace(
439444
result=self.result,
440445
parameternames=paranames,
441446
parameterlabels=paralabels,
442447
stdvalues=self.estimated_para,
443448
plotname=traceplotname,
449+
style=plot_style,
444450
)
445451
plotter.plotfit_steady(
446452
setup=self.setup,
@@ -450,8 +456,11 @@ def run(
450456
radnames=self.radnames,
451457
extra=self.extra_kw_names,
452458
plotname=fittingplotname,
459+
style=plot_style,
460+
)
461+
plotter.plotparainteract(
462+
self.result, paralabels, interactplotname, style=plot_style
453463
)
454-
plotter.plotparainteract(self.result, paralabels, interactplotname)
455464

456465
def sensitivity(
457466
self,
@@ -462,6 +471,7 @@ def sensitivity(
462471
plotname=None,
463472
traceplotname=None,
464473
sensname=None,
474+
plot_style="WTP",
465475
):
466476
"""Run the sensitivity analysis.
467477
@@ -501,11 +511,13 @@ def sensitivity(
501511
If ``None``, it will be the current time +
502512
``"_estimate"``.
503513
Default: ``None``
514+
plot_style : str, optional
515+
Plot stlye. The default is "WTP".
504516
"""
505517
if len(self.setup.para_names) == 1 and not self.setup.dummy:
506518
raise ValueError(
507519
"Sensitivity: for estimation with only one parameter"
508-
+ " you have to use a dummy paramter."
520+
" you have to use a dummy paramter."
509521
)
510522
if rep is None:
511523
rep = spotpylib.fast_rep(
@@ -592,11 +604,14 @@ def sensitivity(
592604
header = " ".join(paranames)
593605
np.savetxt(sensname, sens_est["ST"], header=header)
594606
np.savetxt(sensname1, sens_est["S1"], header=header)
595-
plotter.plotsensitivity(paralabels, sens_est, plotname)
607+
plotter.plotsensitivity(
608+
paralabels, sens_est, plotname, style=plot_style
609+
)
596610
plotter.plotparatrace(
597611
data,
598612
parameternames=paranames,
599613
parameterlabels=paralabels,
600614
stdvalues=None,
601615
plotname=traceplotname,
616+
style=plot_style,
602617
)

0 commit comments

Comments
 (0)