Skip to content

utilities

Simon_Glatzel_fn(Pr, Tr)

Takes a reference pressure and temperature, and returns a Simon-Glatzel function [Simon and Glatzel, 1929] f(P, a, b) = (Tr ((P - Pr)/a + 1)^b).

Simon and Glatzel, 1929

Simon F. and Glatzel G., 1929. unknown. Anorg. (Allg.) Chem.. 178, pp.309-312.

Parameters:

Name Type Description Default
Pr float

Reference pressure (Pa)

required
Tr float

Reference temperature (K)

required

Returns:

Type Description
function

The Simon-Glatzel function

Source code in terratools/properties/utilities.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def Simon_Glatzel_fn(Pr, Tr):
    """
    Takes a reference pressure and temperature,
    and returns a Simon-Glatzel function [@Simon1929]
    f(P, a, b) = (Tr ((P - Pr)/a + 1)^b).

    :param float Pr: Reference pressure (Pa)
    :param float Tr: Reference temperature (K)

    :return: The Simon-Glatzel function
    :rtype: function
    """

    def Simon_Glatzel(P, a, b):
        return Tr * np.power(((P - Pr) / a + 1.0), b)

    return Simon_Glatzel

read_table(filename)

Reads a table from a packaged dataset within terratools.

Parameters:

Name Type Description Default
filename string

path to file

required

Returns:

Type Description
numpy array

The table in the file in numpy array form.

Source code in terratools/properties/utilities.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def read_table(filename):
    """
    Reads a table from a packaged dataset within terratools.

    :param string filename: path to file

    :return: The table in the file in numpy array form.
    :rtype: numpy array
    """
    datastream = pkgutil.get_data("terratools", filename)
    datalines = [
        line.strip() for line in datastream.decode("ascii").split("\n") if line.strip()
    ]
    table = []

    for line in datalines:
        if line[0] != "#":
            numbers = np.fromstring(line, sep=" ")
            table.append(numbers)
    return np.array(table)