-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
7,747 additions
and
2,412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
numpy = "*" | ||
|
||
[dev-packages] | ||
flake8 = "*" | ||
pydocstyle = "*" | ||
ipython = "*" | ||
pep8 = "*" | ||
sphinx = "*" | ||
sphinx-rtd-theme = "*" | ||
doc8 = "*" | ||
coverage = "*" | ||
matplotlib = "*" | ||
m2r2 = "*" | ||
|
||
[requires] | ||
python_version = "3.9" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,16 +2,16 @@ | |
|
||
[![DOI](https://zenodo.org/badge/87794116.svg)](https://zenodo.org/badge/latestdoi/87794116) | ||
|
||
- [VelocityConversion](#VelocityConversion) | ||
- [Introduction](#Introduction) | ||
- [Recommended citation for VelocityConversion](#Recommended-citation-for-VelocityConversion) | ||
- [Prerequisites](#Prerequisites) | ||
- [How to get started](#How-to-get-started) | ||
- [Usage as command line tool](#Usage-as-command-line-tool) | ||
- [Usage as a Python module](#Usage-as-a-Python-module) | ||
- [Modifying physical properties of the minerals](#Modifying-physical-properties-of-the-minerals) | ||
- [References](#References) | ||
- [Licence](#Licence) | ||
- [VelocityConversion](#velocityconversion) | ||
- [Introduction](#introduction) | ||
- [Recommended citation for VelocityConversion](#recommended-citation-for-velocityconversion) | ||
- [Prerequisites](#prerequisites) | ||
- [How to get started](#how-to-get-started) | ||
- [Usage as command line tool](#usage-as-command-line-tool) | ||
- [Usage as a Python module](#usage-as-a-python-module) | ||
- [Modifying physical properties of the minerals](#modifying-physical-properties-of-the-minerals) | ||
- [References](#references) | ||
- [Licence](#licence) | ||
|
||
## Introduction | ||
|
||
|
@@ -40,6 +40,19 @@ If you use this code, please consider citing it as | |
This code requires an installation of Python 3.x and numpy. | ||
Building the documentation furthermore requires sphinx and m2r. | ||
|
||
You can use [`pipenv`](https://pypi.org/project/pipenv/) to create an | ||
environment: | ||
|
||
```bash | ||
pipenv install | ||
``` | ||
|
||
ctivate the environment via | ||
|
||
```bash | ||
pipenv shell | ||
``` | ||
|
||
## How to get started | ||
|
||
The code can be used either as a command line tool or as a module within | ||
|
@@ -50,6 +63,13 @@ repository: | |
git clone https://github.com/cmeessen/VelocityConversion.git | ||
``` | ||
|
||
or, if you haven an [SSH key](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) | ||
associated to your account: | ||
|
||
```bash | ||
git clone [email protected]:cmeessen/VelocityConversion.git | ||
``` | ||
|
||
To check whether everything is working run the tests | ||
|
||
```bash | ||
|
@@ -76,7 +96,7 @@ In order to use the code as command line tool, add the `./Examples` directory | |
to your `PATH`, e.g. in your bash profile: | ||
|
||
```bash | ||
export PATH=/path/to/VelocityConversion/Examples | ||
export PATH=/path/to/VelocityConversion/Examples:$PATH | ||
``` | ||
|
||
Alternatively you can move the bash script | ||
|
@@ -147,6 +167,12 @@ For a more complete documentation on how to use `VelocityConversion` as a Python | |
module please visit the | ||
[documentation](https://cmeessen.github.io/VelocityConversion/). | ||
|
||
To uninstall `VelocityConversion`, run | ||
|
||
```bash | ||
pip uninstall velocityconversion-cmeessen | ||
``` | ||
|
||
## Modifying physical properties of the minerals | ||
|
||
The database that contains the physical properties of the individual mineral | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,26 +16,6 @@ | |
# You should have received a copy of the GNU General Public License # | ||
# along with VelocityConversion. If not, see <http://www.gnu.org/licenses/>. # | ||
############################################################################### | ||
""" | ||
This code is a python implementation of the p- and s-wave velocity to density | ||
conversion approach after Goes et al. (2000) | ||
Recommended citation | ||
==================== | ||
> Meeßen, Christian (2017): VelocityConversion. V. v1.0.1. GFZ Data Services. | ||
> http://doi.org/10.5880/GFZ.6.1.2017.001 | ||
Contact | ||
======= | ||
For questions or suggestions please contact | ||
| Christian Meeßen | ||
| Section 4.5 Basin Modelling | ||
| GFZ Potsdam | ||
| [email protected] | ||
""" | ||
|
||
from __future__ import print_function, unicode_literals | ||
import numpy as np | ||
|
@@ -47,7 +27,12 @@ | |
from warnings import warn | ||
import __main__ | ||
|
||
__version__ = '1.1.1-rc1' | ||
__version__ = '1.1.1' | ||
|
||
|
||
class UnavailableMethodError(Exception): | ||
"""Raise when trying to use AlphaPT""" | ||
pass | ||
|
||
|
||
class MantleConversion: | ||
|
@@ -73,7 +58,7 @@ def __init__(self): | |
self.Verbose = False | ||
self.SimpleP = False | ||
self.NN = False | ||
self.UseAlpha = 'Alpha' | ||
self._UseAlpha = 'Alpha' | ||
self.VelType = None | ||
self.scaleV = 1. | ||
|
||
|
@@ -204,6 +189,25 @@ def __check_mineralogy__(self): | |
self.Mineralogy = np.sort(self.Mineralogy, order='phase') | ||
self.n_Phases = len(self.Mineralogy['phase']) | ||
|
||
@property | ||
def UseAlpha(self): | ||
"""Property that defines how Alpha is computed""" | ||
return self._UseAlpha | ||
|
||
@UseAlpha.setter | ||
def UseAlpha(self, mode): | ||
valid_modes = { | ||
'const': 'Alpha', | ||
'T': 'AlphaT', | ||
# 'PT': 'AlphaPT' # Deactivate due to unsolved issues | ||
} | ||
try: | ||
self._UseAlpha = valid_modes[mode] | ||
except KeyError: | ||
raise UnavailableMethodError( | ||
f"This method for computation of Alpha is not available: {mode}" | ||
) | ||
|
||
def AK135(self, depth, simple=False): | ||
""" | ||
Return Pressure at given depth based on AK135 model. | ||
|
@@ -478,7 +482,7 @@ def CalcVRho(self, z, T): | |
Array contining V and Rho according for specified z and T | ||
""" | ||
# Calculate P | ||
P = self.AK135(z) | ||
P = self.AK135(z, self.SimpleP) | ||
if self.Verbose: | ||
print('> z='+str(z)+'km; P='+str(P)+'Pa') | ||
|
||
|
@@ -913,9 +917,9 @@ def ReadArgs(self): | |
i = 2 | ||
while i < n_args: | ||
if sys.argv[i] == '-AlphaT': | ||
self.UseAlpha = 'AlphaT' | ||
self.UseAlpha = 'T' | ||
elif sys.argv[i] == '-AlphaPT': | ||
self.UseAlpha = 'AlphaPT' | ||
self.UseAlpha = 'PT' | ||
elif sys.argv[i] == '-comp': | ||
self.LoadMineralogy(sys.argv[i+1]) | ||
i += 1 | ||
|
@@ -1016,12 +1020,7 @@ def SetAlpha(self, mode): | |
mode : str | ||
Valid modes are `const`, `T` and `PT` | ||
""" | ||
valid_modes = { | ||
'const': 'Alpha', | ||
'T': 'AlphaT', | ||
'PT': 'AlphaPT' | ||
} | ||
self.UseAlpha = valid_modes[mode] | ||
self.UseAlpha = mode | ||
|
||
def SetMineralogy(self, assemblage): | ||
"""Define the mineralogical assemblage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: d81aaa56fef58c3b9148eedab21e9f9d | ||
config: eff9231dd2a1754c818508a98793b04c | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.