Skip to content

Instantly share code, notes, and snippets.

View james-roden's full-sized avatar
🏴󠁧󠁢󠁷󠁬󠁳󠁿

James M Roden james-roden

🏴󠁧󠁢󠁷󠁬󠁳󠁿
View GitHub Profile
@james-roden
james-roden / Joides_GHSZ_Formula.py
Last active October 25, 2019 11:15
Joides Gas Hydrate Stability Zone Formula (Returns the base of the gas hydrate stability zone for a given water depth)
#!Python3
def joides(water_depth, base_water_temp, geothermal_gradient):
"""Returns the base of the gas hydrate stability zone for a given water depth
Joides formula for calculating the base gas hydrate stability meters below sea floor. As per the publication:
Ocean Drilling Program Guidelines for Pollution Prevention and Safety; JOIDES Journal, Volume 18, Special Issue
No. 7, October 1992.
A range of 1-2501 is used, as per studies, generally the maximum is 2000 meters below surface.
@james-roden
james-roden / Rotation_Matrix_Function.py
Created February 22, 2018 09:22
Python function to rotate a (x, y) coordinate by a specified angle
# Rotation matrix function
def rotate_matrix (x, y, angle, x_shift=0, y_shift=0, units="DEGREES"):
"""
Rotates a point in the xy-plane counterclockwise through an angle about the origin
https://en.wikipedia.org/wiki/Rotation_matrix
:param x: x coordinate
:param y: y coordinate
:param x_shift: x-axis shift from origin (0, 0)
:param y_shift: y-axis shift from origin (0, 0)
:param angle: The rotation angle in degrees