Skip to content

Commit

Permalink
Merge pull request #70 from murphyqm/check-docstrings
Browse files Browse the repository at this point in the history
Check docstrings
  • Loading branch information
murphyqm committed Jul 15, 2021
2 parents 4e91b7d + cccd66d commit 7d371a1
Show file tree
Hide file tree
Showing 7 changed files with 298 additions and 139 deletions.
65 changes: 39 additions & 26 deletions pytesimal/analysis.py
Expand Up @@ -29,24 +29,24 @@ def core_freezing(
Parameters
----------
coretemp : numpy.ndarray
Array of temperatures in the core
Array of temperatures in the core, in Kelvin.
max_time : float
Length of time the model runs for, in seconds
Length of time the model runs for, in seconds.
times : numpy.ndarray
Array from 0 to the max time +0.5* the timestep, with a spacing equal
to the timestep
to the timestep.
latent : list
List of total latent heat extracted since core began freezing, at each
timestep
timestep.
temp_core_melting : float
Melting point of core material (in K)
Melting point of core material, in Kelvin.
timestep : float, default 1e11
Discretisation timestep in seconds.
Returns
-------
core_frozen: boolean array where temperature <= 1200
times_frozen: array of indices of times where the temp <= 1200
core_frozen: boolean array where temperature <= 1200 K
times_frozen: array of indices of times where the temp <= 1200 K
time_core_frozen: when the core starts to freeze, in seconds
fully_frozen: when the core finished freezing, in seconds
Expand Down Expand Up @@ -91,12 +91,12 @@ def cooling_rate_cloudyzone_diameter(d):
Parameters
----------
d : float
Cloudy zone particle size in nm
Cloudy zone particle size in nm.
Returns
-------
cz_rate : float
The cooling rate in K/Myr
The cooling rate in K/Myr.
"""
m = 7620000 # constant
Expand All @@ -114,12 +114,12 @@ def cooling_rate_tetra_width(tw):
Parameters
----------
tw : float
Tetrataenite bandwidth in nm
Tetrataenite bandwidth in nm.
Returns
-------
t_rate : float
The cooling rate in K/Myr
The cooling rate in K/Myr.
"""
k = 14540000 # constant
Expand All @@ -128,9 +128,21 @@ def cooling_rate_tetra_width(tw):


def cooling_rate_to_seconds(cooling_rate):
"""Convert cooling rates to seconds."""
"""Convert cooling rates to seconds.
Parameters
----------
cooling_rate : float
The cooling rate in K/Myr.
Returns
-------
new_cooling_rate : float
The cooling rate in K/s.
"""
myr = 3.1556926e13
new_cooling_rate = cooling_rate / myr # /1000000/365/24/60/60 # fix to myr
new_cooling_rate = cooling_rate / myr
return new_cooling_rate


Expand All @@ -156,37 +168,38 @@ def meteorite_depth_and_timing(
Parameters
----------
CR : float
cooling rate of meteorite
cooling rate of meteorite, in K/s.
temperatures : numpy.ndarray
Array of mantle temperatures
Array of mantle temperatures, in Kelvin.
dT_by_dt : numpy.ndarray
Array of mantle cooling rates
Array of mantle cooling rates, in K/dt.
radii : numpy.ndarray
Mantle radii spaced by `dr`
Mantle radii spaced by `dr`, in m.
r_planet : float
Planetesimal radius, in m
Planetesimal radius, in m.
core_size_factor : float, <1
Radius of the core, expressed as a fraction of `r_planet`
Radius of the core, expressed as a fraction of `r_planet`.
time_core_frozen : float
The time the core begins to freeze
The time the core begins to freeze, in dt.
fully_frozen : float
The time the core is fully frozen
The time the core is fully frozen, in dt.
dr : float, default 1000.0
Radial step for numerical discretisation
Radial step for numerical discretisation, in m.
Returns
-------
depth : float
Depth of genesis of meteorite
Depth of genesis of meteorite, in km.
string : string
Relative timing of tetrataenite formation and core crystallisation, in
a string format
time_core_frozen : float
The time the core begins to freeze
The time the core begins to freeze, in dt.
Time_of_Crossing : float
When the meteorite cools through tetrataenite formation temperature
When the meteorite cools through tetrataenite formation temperature, in
dt.
Critical_Radius : float
Depth of meteorite genesis given as radius value
Depth of meteorite genesis given as radius value, in m.
"""
# Define two empty lists
Expand Down
26 changes: 13 additions & 13 deletions pytesimal/core_function.py
Expand Up @@ -34,26 +34,26 @@ class IsothermalEutecticCore:
Attributes
----------
initial_temperature : float
Initial uniform temperature of the core
Initial uniform temperature of the core, in K.
melting_temperature : float
Temperature at which core crystallisation initiates
Temperature at which core crystallisation initiates, in K.
outer_r : float
Outer core radius
Outer core radius, in m.
inner_r : float
Inner core radius, not used by this simple implementation of the core
(set to zero), but included so that more complex core models can be
coupled to the mantle discretisation function
coupled to the mantle discretisation function.
rho : float
Core density
Core density, kg m^-3.
cp : float
Core heat capacity
Core heat capacity, J kg^-1 K^-1.
core_latent_heat : float
Latent heat of crystallisation of the core, used to calculate time for
core to solidify fully
core to solidify fully, J kg^-1.
lat : float, optional
Tracks latent heat of core, always initially zero in current
implementation but included for forward compatibility with a coupled
model where core has already cooled by some degree
model where core has already cooled by some degree, in J kg^-1.
"""

Expand Down Expand Up @@ -112,9 +112,9 @@ def extract_heat(self, power, timestep):
Parameters
----------
power : float
Heat extracted across the CMB in Watts
Heat extracted across the CMB in Watts.
timestep : float
The time over which the heat is extracted (in s)
The time over which the heat is extracted (in s).
"""
volume_of_core = (4.0 / 3.0) * np.pi * self.radius ** 3
Expand All @@ -139,7 +139,7 @@ def temperature_array_1D(self):
Returns
-------
temp_array : numpy.ndarray
Time series of `boundary_temperature`
Time series of `boundary_temperature`, in K.
"""
temp_array = np.asarray(self.templist)
Expand All @@ -152,12 +152,12 @@ def temperature_array_2D(self, coretemp_array):
Parameters
----------
coretemp_array : numpy.ndarray
Array of zeros to be filled wth core temperature history
Array of zeros to be filled wth core temperature history.
Returns
-------
coretemp_array : numpy.ndarray
Array of core temperature history
Array of core temperature history, in K.
"""
for i in range(1, len(self.templist[1:])):
Expand Down

0 comments on commit 7d371a1

Please sign in to comment.