diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..9515fc3 --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,11 @@ +# ogs6py + +ogs6py is available on [GitHub](https://github.com/joergbuchwald/ogs5py) +and was created by following people. + + +## Main Authors + +- [Jörg Buchwald](https://github.com/joergbuchwald), Email: +- [Tom Fischer](https://github.com/TomFischer) +- [Dmitry Yu. Naumov](https://github.com/endJunction) diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4665484 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog + +All notable changes to **ogs6py** will be documented in this file. + + +## [Unreleased] + +### Bugfixes + +### Additions + +### Changes + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..fb9398c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,34 @@ +# How to Contribute to ogs6py + +We are happy about all contributions! :thumbsup: + + +## Did you find a bug? + +- Ensure that the bug was not already reported under +[GitHub issues](https://github.com/joergbuchwald/ogs6py/issues) +- If the bug wasn't already reported, open a +[new issue](https://github.com/joergbuchwald/ogs6py/issues) with a clear +description of the problem and if possible with a +[minimal working example](https://en.wikipedia.org/wiki/Minimal_working_example). +- please add the version number to the issue: + +```python +import ogs6py +print(ogs6py.__version__) +``` + + +## Do you have suggestions for new features? + +Open a [new issue](https://github.com/joergbuchwald/ogs6py/issues) +with your idea or suggestion and we'd love to discuss about it. + + +## Do you want to enhance ogs6py or fix something? + +- Fork the repo on [GitHub](https://github.com/joergbuchwald/ogs6py). +- Add yourself to AUTHORS.md (if you want to). +- Add some tests if possible. +- Push to your fork and submit a pull request. + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..18fddbd --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019-2021 Joerg Buchwald + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..15782c9 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include MANIFEST.in +include setup.py +recursive-include ogs6py *.py +include LICENSE diff --git a/README.md b/README.md index ad4f2b2..bdbbb36 100644 --- a/README.md +++ b/README.md @@ -7,32 +7,20 @@ The package allows to streamline OGS-workflows with python or Julia entirely in [![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/eihNKjK-I-s/0.jpg)](https://www.youtube.com/watch?v=eihNKjK-I-s) +*Please note: due to changes in the file structure ogs6py is now imported by `from ogs6py.ogs import OGS`* + To alter and execute OGS input, e.g., for looping over parameter ranges, two approaches exist: 1. creating a new input file using python method calls 2. altering existing input files -### 0. Installation - -clone the repository and use pip to install the package - -```shell -# git clone https://github.com/joergbuchwald/ogs6py.git -# cd ogs6py -# pip install --user . -``` -or with root permissions: -```shell -# pip install . -``` - ### 1. Creating a new input file The following example consists of a simle mechanics problem. The names of the method calls are based on the corresponing XML tags. The `MKL=True` option executes `source /opt/intel/mkl/bin/mklvars.sh intel64` before the ogs call. ```python -from ogs import * +from ogs6py.ogs import OGS model = OGS(PROJECT_FILE="simple_mechanics.prj", MKL=True) model.geo.addGeom(filename="square_1x1.gml") @@ -132,7 +120,8 @@ model.writeInput() model.runModel(path="~/github/ogs/build_mkl/bin") ``` - OGS finished + OGS finished with project file simple_mechanics.prj. + Execution took 0.0639185905456543 s An example using the MPL can be find in example_THM.py. @@ -153,9 +142,12 @@ for E in Es: model.runModel(path="~/github/ogs/build_mkl/bin") ``` - OGS finished - OGS finished - OGS finished + OGS finished with project file simple_mechanics.prj. + Execution took 0.06496095657348633 s + OGS finished with project file simple_mechanics.prj. + Execution took 0.05861473083496094 s + OGS finished with project file simple_mechanics.prj. + Execution took 0.056302547454833984 s Instead of the `replaceParameter` method, the more general `replaceTxt` method can be used @@ -193,7 +185,7 @@ To parse the output that is piped into a file named `out.log` you can simply do: ```python -df = model.parseOut("out.log") +df = model.parseOut("out_thm.log") ``` @@ -201,6 +193,23 @@ df = model.parseOut("out.log") df ``` + + + +
+ @@ -225,93 +234,93 @@ df - - - - - - + + + + + + - - - - + + + + - - - + + + - - - - - - + - - - - + + + + - - - + + + + + + + + - - - - - - + + + + + + + + + + + - - - - - - - - + + + - - - - - - - - - - - + - - - + + + + + + + + + + + + + - - - - - - + - - - - + + + + + + + + + - - - + + + @@ -332,97 +341,128 @@ df - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
0None00.0NaN0.3098360.03780825.278111.01.02.4789900.013315 10.0741550.0048710.1011030.1834310.0358830.0041130.0914690.132779 01.055600e-012.448300e+044.311400e-061.884600e+042.091500e+049.010800e-01
1None00.0NaN0.3098360.03780825.2781 10.0741550.0048710.1011030.1834311.01.02.4789900.013315 19.003300e+045.112200e+091.761100e-050.0358830.0041130.0914690.13277918.858200e+098.858200e+091.000000e+00
2None00.0NaN0.3098360.03780825.278111.01.02.4789900.01331510.0358830.0041130.0914690.132779 20.0666550.0038660.0767660.15064901.793800e-092.448300e+047.327000e-144.439300e-044.439300e-041.000000e+00
3None00.0NaN0.3098360.03780820.0666550.0038660.0767660.15064925.2781 11.354300e+025.112200e+092.649100e-081.01.02.4789900.01331510.0358830.0041130.0914690.13277934.579000e-044.579000e-041.000000e+00
4None00.0NaN0.3098360.03780825.2781 10.0650190.0038250.0740510.1461531.01.02.4789900.01331520.0337630.0035310.0641170.102725 01.007800e-012.448300e+044.116300e-064.063800e+032.458900e+041.652700e-01
......
1105None13312476400.0226448.00.6398500.04235720.0667620.0031080.0796350.15288612.171600e+066.487700e+093.347300e-0499525.27813150000.04514.00.5810430.01426650.0351330.0029440.0550490.09454233.180600e-177.074400e-034.496000e-15
1106None13312476400.0226448.00.6398500.04235730.0686050.0032320.0804620.15569899625.27813150000.04514.00.5810430.01426660.0362520.0032040.0557540.096534 03.006000e-022.672600e+041.124700e-066.841200e-124.005500e+041.708000e-16
1107None13312476400.0226448.00.6398500.04235730.0686050.0032320.0804620.15569899725.27813150000.04514.00.5810430.01426660.0362520.0032040.0557540.096534 11.116500e+056.487600e+091.721000e-058.289800e-075.261000e+081.575700e-15
1108None13312476400.0226448.00.6398500.04235740.0696140.0032890.0807680.15706302.538300e-032.672600e+049.497500e-0899825.27813150000.04514.00.5810430.01426660.0362520.0032040.0557540.09653424.418700e-187.150300e-036.179700e-16
1109None13312476400.0226448.00.6398500.04235740.0696140.0032890.0807680.15706316.094500e+036.487600e+099.394000e-0799925.27813150000.04514.00.5810430.01426660.0362520.0032040.0557540.09653434.490900e-187.074400e-036.348100e-16
+

1000 rows × 15 columns

+
+ +```python +import matplotlib.pyplot as plt +``` + + +```python +plt.plot(df["time_step/iteration/number"]) +plt.xlabel("iterations") +plt.ylabel("iterations per time step") +``` + + + + + Text(0, 0.5, 'iterations per time step') + + + + + +![png](output_19_1.png) + + + + +```python + +``` diff --git a/example.py b/examples/example.py similarity index 98% rename from example.py rename to examples/example.py index 27363c8..e2bc5b8 100644 --- a/example.py +++ b/examples/example.py @@ -1,6 +1,6 @@ -from ogs import * +from ogs6py import ogs -model = OGS(PROJECT_FILE="test.prj", MKL=True) +model = ogs.OGS(PROJECT_FILE="test.prj", MKL=True) model.geo.addGeom(filename="square_1x1.gml") model.mesh.addMesh(filename="square_1x1_quad_1e2.vtu") model.processes.setProcess(name="SD", diff --git a/example_THM.py b/examples/example_THM.py similarity index 97% rename from example_THM.py rename to examples/example_THM.py index 6120be8..3b0ebb7 100644 --- a/example_THM.py +++ b/examples/example_THM.py @@ -1,7 +1,7 @@ -from ogs import * +from ogs6py.ogs import OGS -model = OGS(PROJECT_FILE="thm_test/test.prj", MKL=True, OMP_NUM_THREADS=4) -model.geo.addGeom(filename="square_1x1.gml") +model = OGS(PROJECT_FILE="thm_test.prj", MKL=True, OMP_NUM_THREADS=4) +model.geo.addGeom(filename="square_1x1_thm.gml") model.mesh.addMesh(filename="quarter_002_2nd.vtu", axially_symmetric="true") model.processes.setProcess( name="THERMO_HYDRO_MECHANICS", @@ -105,7 +105,8 @@ prefix="blubb", repeat="1", each_steps="10", - variables=["displacement", "pressure", "temperature", "sigma", "epsilon"]) + variables=["displacement", "pressure", "temperature", "sigma", "epsilon"], + fixed_output_times=[1,2,3]) model.timeloop.addTimeSteppingPair(process="THERMO_HYDRO_MECHANICS", repeat="15", delta_t="32") model.timeloop.addOutputPair(repeat="12", each_steps="11") model.parameters.addParameter(name="E", type="Constant", value="5000000000") @@ -196,4 +197,4 @@ max_iteration_step="10000", error_tolerance="1e-16") model.writeInput() -model.runModel() +model.runModel(LOGFILE="out_thm.log") diff --git a/example_replace.py b/examples/example_replace.py similarity index 97% rename from example_replace.py rename to examples/example_replace.py index 2d9032f..5278962 100644 --- a/example_replace.py +++ b/examples/example_replace.py @@ -1,4 +1,4 @@ -from ogs import * +from ogs6py.ogs import OGS """ This example is based on a future version of the project file created by example_THM.py in which the porosity is already diff --git a/generateInvalidMediaForHT.py b/examples/generateInvalidMediaForHT.py similarity index 100% rename from generateInvalidMediaForHT.py rename to examples/generateInvalidMediaForHT.py diff --git a/thm_test/quarter_002_2nd.vtu b/examples/quarter_002_2nd.vtu similarity index 100% rename from thm_test/quarter_002_2nd.vtu rename to examples/quarter_002_2nd.vtu diff --git a/examples/simple_mechanics.prj b/examples/simple_mechanics.prj new file mode 100644 index 0000000..53022b6 --- /dev/null +++ b/examples/simple_mechanics.prj @@ -0,0 +1,152 @@ + + + square_1x1.gml + square_1x1_quad_1e2.vtu + + + SD + SMALL_DEFORMATION + 2 + rho_sr + 0 0 + + LinearElasticIsotropic + E + nu + + + displacement + + + + + + + + + + basic_newton + + DeltaX + NORM2 + 1e-15 + + + BackwardEuler + + + FixedTimeStepping + 0 + 1 + + + 4 + 0.25 + + + + + + + VTK + out_E=3 + + + 1 + 10 + + + + displacement + sigma + + + + + + E + Constant + 3 + + + nu + Constant + 0.3 + + + rho_sr + Constant + 1 + + + displacement0 + Constant + 0 0 + + + dirichlet0 + Constant + 0 + + + dirichlet1 + Constant + 0.05 + + + + + displacement + 2 + 1 + displacement0 + + + Dirichlet + square_1x1_geometry + left + 0 + dirichlet0 + + + Dirichlet + square_1x1_geometry + bottom + 1 + dirichlet0 + + + Dirichlet + square_1x1_geometry + top + 1 + dirichlet1 + + + + + + + basic_newton + Newton + 4 + general_linear_solver + + + + + general_linear_solver + -i cg -p jacobi -tol 1e-16 -maxiter 10000 + + CG + DIAGONAL + 10000 + 1e-16 + + + sd + -sd_ksp_type cg -sd_pc_type bjacobi -sd_ksp_rtol 1e-16 -sd_ksp_max_it 10000 + + + + diff --git a/square_1x1.gml b/examples/square_1x1.gml similarity index 100% rename from square_1x1.gml rename to examples/square_1x1.gml diff --git a/square_1x1_quad_1e2.vtu b/examples/square_1x1_quad_1e2.vtu similarity index 100% rename from square_1x1_quad_1e2.vtu rename to examples/square_1x1_quad_1e2.vtu diff --git a/thm_test/square_1x1.gml b/examples/square_1x1_thm.gml similarity index 100% rename from thm_test/square_1x1.gml rename to examples/square_1x1_thm.gml diff --git a/ogs6py/__init__.py b/ogs6py/__init__.py new file mode 100644 index 0000000..8391c8d --- /dev/null +++ b/ogs6py/__init__.py @@ -0,0 +1,5 @@ +from ogs6py.ogs import OGS +from ogs6py._version import __version__ + +__all__ = ["__version__"] +__all__ += ["OGS"] diff --git a/ogs6py/_version.py b/ogs6py/_version.py new file mode 100644 index 0000000..ab21655 --- /dev/null +++ b/ogs6py/_version.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +"""Provide a central version.""" +__version__ = "0.30" diff --git a/classes/__init__.py b/ogs6py/classes/__init__.py similarity index 100% rename from classes/__init__.py rename to ogs6py/classes/__init__.py diff --git a/classes/build_tree.py b/ogs6py/classes/build_tree.py similarity index 100% rename from classes/build_tree.py rename to ogs6py/classes/build_tree.py diff --git a/classes/curves.py b/ogs6py/classes/curves.py similarity index 95% rename from classes/curves.py rename to ogs6py/classes/curves.py index 38ebf2a..c836609 100644 --- a/classes/curves.py +++ b/ogs6py/classes/curves.py @@ -1,4 +1,4 @@ -from classes import build_tree +from ogs6py.classes import build_tree class CURVES(build_tree.BUILD_TREE): def __init__(self, **args): @@ -18,7 +18,6 @@ def addCurve(self, **args): raise KeyError("No coordinates given.") if not "values" in args: raise KeyError("No values given.") - print(len(args["coords"]), len(args["values"])) if len(args["coords"]) != len(args["values"]): raise ValueError("Number of time coordinate points differs from number of values") else: diff --git a/classes/geo.py b/ogs6py/classes/geo.py similarity index 92% rename from classes/geo.py rename to ogs6py/classes/geo.py index 8eeb803..260e5fd 100644 --- a/classes/geo.py +++ b/ogs6py/classes/geo.py @@ -1,4 +1,4 @@ -from classes import build_tree +from ogs6py.classes import build_tree class GEO(build_tree.BUILD_TREE): def __init__(self, **args): diff --git a/classes/linsolvers.py b/ogs6py/classes/linsolvers.py similarity index 99% rename from classes/linsolvers.py rename to ogs6py/classes/linsolvers.py index 0610f2f..9ec4a3e 100644 --- a/classes/linsolvers.py +++ b/ogs6py/classes/linsolvers.py @@ -1,4 +1,4 @@ -from classes import build_tree +from ogs6py.classes import build_tree class LINSOLVERS(build_tree.BUILD_TREE): def __init__(self, **args): diff --git a/classes/local_coordinate_system.py b/ogs6py/classes/local_coordinate_system.py similarity index 97% rename from classes/local_coordinate_system.py rename to ogs6py/classes/local_coordinate_system.py index 3fd5b8b..2c43aec 100644 --- a/classes/local_coordinate_system.py +++ b/ogs6py/classes/local_coordinate_system.py @@ -1,4 +1,4 @@ -from classes import build_tree +from ogs6py.classes import build_tree class LOCAL_COORDINATE_SYSTEM(build_tree.BUILD_TREE): def __init__(self, **args): diff --git a/classes/media.py b/ogs6py/classes/media.py similarity index 99% rename from classes/media.py rename to ogs6py/classes/media.py index e12fb23..27d2ae2 100644 --- a/classes/media.py +++ b/ogs6py/classes/media.py @@ -1,4 +1,4 @@ -from classes import build_tree +from ogs6py.classes import build_tree class MEDIA(build_tree.BUILD_TREE): def __init__(self, **args): diff --git a/classes/mesh.py b/ogs6py/classes/mesh.py similarity index 97% rename from classes/mesh.py rename to ogs6py/classes/mesh.py index 083d26e..6d0d111 100644 --- a/classes/mesh.py +++ b/ogs6py/classes/mesh.py @@ -1,4 +1,4 @@ -from classes import build_tree +from ogs6py.classes import build_tree class MESH(build_tree.BUILD_TREE): def __init__(self, **args): diff --git a/classes/nonlinsolvers.py b/ogs6py/classes/nonlinsolvers.py similarity index 98% rename from classes/nonlinsolvers.py rename to ogs6py/classes/nonlinsolvers.py index 6a49a56..50388c0 100644 --- a/classes/nonlinsolvers.py +++ b/ogs6py/classes/nonlinsolvers.py @@ -1,4 +1,4 @@ -from classes import build_tree +from ogs6py.classes import build_tree class NONLINSOLVERS(build_tree.BUILD_TREE): def __init__(self, **args): diff --git a/classes/parameters.py b/ogs6py/classes/parameters.py similarity index 99% rename from classes/parameters.py rename to ogs6py/classes/parameters.py index 9192856..bbb196a 100644 --- a/classes/parameters.py +++ b/ogs6py/classes/parameters.py @@ -1,4 +1,4 @@ -from classes import build_tree +from ogs6py.classes import build_tree class PARAMETERS(build_tree.BUILD_TREE): def __init__(self, **args): diff --git a/classes/processes.py b/ogs6py/classes/processes.py similarity index 98% rename from classes/processes.py rename to ogs6py/classes/processes.py index a50be4a..66d0157 100644 --- a/classes/processes.py +++ b/ogs6py/classes/processes.py @@ -1,4 +1,4 @@ -from classes import build_tree +from ogs6py.classes import build_tree class PROCESSES(build_tree.BUILD_TREE): def __init__(self, **args): diff --git a/classes/processvars.py b/ogs6py/classes/processvars.py similarity index 99% rename from classes/processvars.py rename to ogs6py/classes/processvars.py index 118da6d..b05690a 100644 --- a/classes/processvars.py +++ b/ogs6py/classes/processvars.py @@ -1,4 +1,4 @@ -from classes import build_tree +from ogs6py.classes import build_tree class PROCESSVARS(build_tree.BUILD_TREE): def __init__(self, **args): diff --git a/classes/python_script.py b/ogs6py/classes/python_script.py similarity index 93% rename from classes/python_script.py rename to ogs6py/classes/python_script.py index 99d6af5..5ed63cb 100644 --- a/classes/python_script.py +++ b/ogs6py/classes/python_script.py @@ -1,4 +1,4 @@ -from classes import build_tree +from ogs6py.classes import build_tree class PYTHON_SCRIPT(build_tree.BUILD_TREE): def __init__(self, **args): diff --git a/classes/timeloop.py b/ogs6py/classes/timeloop.py similarity index 99% rename from classes/timeloop.py rename to ogs6py/classes/timeloop.py index 12f7134..103038d 100644 --- a/classes/timeloop.py +++ b/ogs6py/classes/timeloop.py @@ -1,4 +1,4 @@ -from classes import build_tree +from ogs6py.classes import build_tree class TIMELOOP(build_tree.BUILD_TREE): def __init__(self, **args): diff --git a/log_parser/log_parser.py b/ogs6py/log_parser/log_parser.py similarity index 100% rename from log_parser/log_parser.py rename to ogs6py/log_parser/log_parser.py diff --git a/ogs.py b/ogs6py/ogs.py similarity index 94% rename from ogs.py rename to ogs6py/ogs.py index c3998a1..dceab4f 100644 --- a/ogs.py +++ b/ogs6py/ogs.py @@ -5,8 +5,9 @@ import time import pandas as pd from lxml import etree as ET -from classes import * -import log_parser.log_parser as parser +from ogs6py.classes import (geo, mesh, python_script, processes, media, timeloop, local_coordinate_system, + parameters, curves, processvars, linsolvers, nonlinsolvers) +import ogs6py.log_parser.log_parser as parser class OGS(object): def __init__(self, **args): @@ -209,10 +210,10 @@ def writeInput(self): root = self.tree.getroot() parser = ET.XMLParser(remove_blank_text=True) self.tree_string = ET.tostring(root, pretty_print=True) - self.tree = ET.fromstring(self.tree_string, parser=parser) - self.tree_ = ET.ElementTree(self.tree) - ET.indent(self.tree_, space=" ") - self.tree_.write(self.prjfile, + self.tree_ = ET.fromstring(self.tree_string, parser=parser) + self.tree = ET.ElementTree(self.tree_) + ET.indent(self.tree, space=" ") + self.tree.write(self.prjfile, encoding="ISO-8859-1", xml_declaration=True, pretty_print=True) @@ -239,10 +240,10 @@ def writeInput(self): # Reparsing for pretty_print to work properly parser = ET.XMLParser(remove_blank_text=True) self.tree_string = ET.tostring(self.root, pretty_print=True) - self.tree = ET.fromstring(self.tree_string, parser=parser) - self.tree_ = ET.ElementTree(self.tree) - ET.indent(self.tree_, space=" ") - self.tree_.write(self.prjfile, + self.tree_ = ET.fromstring(self.tree_string, parser=parser) + self.tree = ET.ElementTree(self.tree_) + ET.indent(self.tree, space=" ") + self.tree.write(self.prjfile, encoding="ISO-8859-1", xml_declaration=True, pretty_print=True) diff --git a/output_19_1.png b/output_19_1.png new file mode 100644 index 0000000..4969516 Binary files /dev/null and b/output_19_1.png differ diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..7beed36 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,7 @@ + +[metadata] +description-file = README.md +license_file = LICENSE + +[bdist_wheel] +universal = 1 diff --git a/setup.py b/setup.py index c4e3b16..7fe87f1 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,58 @@ # -*- coding: utf-8 -*- """ogs6py: a python API for OpenGeoSys6""" +import os +import codecs +import re + from setuptools import setup, find_packages + +# find __version__ ############################################################ + +def read(*parts): + """Read file data.""" + here = os.path.abspath(os.path.dirname(__file__)) + with codecs.open(os.path.join(here, *parts), "r") as fp: + return fp.read() + +def find_version(*file_paths): + """Find version without importing module.""" + version_file = read(*file_paths) + version_match = re.search( + r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M + ) + if version_match: + return version_match.group(1) + raise RuntimeError("Unable to find version string.") + +VERSION = find_version("ogs6py", "_version.py") + + +############################################################################### + +README = open("README.md").read() + + setup(name="ogs6py", - version=0.28, + version=VERSION, maintainer="Jörg Buchwald", maintainer_email="joerg_buchwald@ufz.de", + long_description=README, + long_description_content_type="text/markdown", author="Jörg Buchwald", author_email="joerg.buchwald@ufz.de", url="https://github.com/joergbuchwald/ogs6py", + classifiers=["Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering :: Visualization", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Scientific/Engineering :: Mathematics", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8"], license="MIT - see LICENSE.txt", platforms=["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], include_package_data=True, install_requires=["lxml","pandas"], - py_modules=["ogs","log_parser/log_parser"], - packages=["classes"]) + py_modules=["ogs6py/ogs","ogs6py/log_parser/log_parser"], + packages=["ogs6py/classes"])