Skip to content

Instantly share code, notes, and snippets.

View jrleeman's full-sized avatar

John Leeman jrleeman

View GitHub Profile
@jrleeman
jrleeman / mems_timeset.py
Created November 1, 2023 00:05
MEMS Inclinometer Time Setting Script
import serial
import sys
from time import sleep
from datetime import datetime
def find_serial_ports():
""" Lists serial port names
:raises EnvironmentError:
On unsupported or unknown platforms
@jrleeman
jrleeman / rgb_animation.py
Created September 11, 2017 17:10
GOES-16 RGB Animation
from datetime import datetime
from scipy import interpolate
from siphon.catalog import TDSCatalog
from netCDF4 import Dataset
import matplotlib.pyplot as plt
from matplotlib import patheffects
import cartopy.feature as cfeat
import cartopy.crs as ccrs
import numpy as np
from metpy.plots import add_logo
@jrleeman
jrleeman / newyears.py
Created December 28, 2021 01:59
Simple python dropping new year ball animation.
import time
from console.screen import sc
from math import floor
from console import fg, bg, fx
import random
from datetime import datetime
colors = [fg.green, fg.yellow, fg.blue, fg.red, fg.default,
fg.royalblue, fg.lightslateblue, fg.steelblue,
fg.magenta, fg.violet, fg.mediumpurple,
@jrleeman
jrleeman / part2.ipynb
Last active September 21, 2020 03:35
Part 2 - The Solution to the MH370 Pinger Locator Problem
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jrleeman
jrleeman / toDayOfYear.ino
Last active September 11, 2020 15:43
Arduino Day of Year Function
/*
toDayOfYear
This sketch demonstrates a function to convert the year, month, day
format to the day of the year. Leap years are corrected. Unit tests
include leap year and regular year tests for every month as well as
corner case and error case testing.
Created 30 March 2015
Modified 14 April 2015
@jrleeman
jrleeman / lgeo_cla.md
Created July 13, 2020 15:33
Leeman Geophysical LLC Public Project CLA

About the Contributor License Agreement

Everybody who contributes code to Leeman Geophysical LLC public projects is going to be asked to sign a Contributor License Agreement (CLA). Our CLA comes from Project Harmony, which is a community-centered group focused on contributor agreements for free and open source software.

The document you are reading now is not a legal analysis of the CLA. If you want one of those, please talk to your lawyer. This is a description of the

@jrleeman
jrleeman / rsfs.py
Created December 30, 2014 21:04
Example forward model of rate-and-state friction in python
import numpy as np
from scipy import integrate
import matplotlib.pyplot as plt
from math import exp,log
def friction(t,y):
k = 1e-3
a = 0.005
b = 0.01
Dc = 10.
import serial
import sys
import time
from datetime import datetime
def post_data_to_chords(data, time):
# 88.1, 88.7, 93.3, 97.9, 100.3, 101.1, 105.9, T, p, rh
sensor_indices = [1, 4, 27, 50, 62, 66, 90]
sensor_id = 'fmradar'
import serial
from datetime import datetime
def get_infrasound_reading():
data = int(ser.readline())
time = datetime.strftime(datetime.utcnow(), '%m-%d-%YT%H:%M:%S.%f')
return time, data
def get_new_hourly_file():
current_file_time = datetime.utcnow()
@jrleeman
jrleeman / multiprocessing_satellite.py
Created May 7, 2018 21:02
Multiprocessing satellite example from MetPy Monday #41.
import multiprocessing as mp
from datetime import datetime
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
from matplotlib import patheffects
from metpy.plots.ctables import registry
from siphon.catalog import TDSCatalog