Skip to content

Instantly share code, notes, and snippets.

View mbstacy's full-sized avatar

Mark Stacy mbstacy

  • Harvard University
  • Boston, MA
  • 19:16 (UTC -04:00)
View GitHub Profile
@mbstacy
mbstacy / fread.py
Created June 8, 2012 14:47
DDA code for TECO
import sys
from numpy import *
def readobs(filename,headlen=1):
"Read the observational file for the TECO model"
obs=loadtxt(filename,skiprows=headlen)
return obs
def readinit(filename,headlen=0):
"Read initial conditions for TECO model"
initcon=loadtxt(filename,skiprows=headlen)
<html>
<head>
<script type="text/javascript" src="http://static.cybercommons.org/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="http://static.cybercommons.org/js/jquery.flot.js"></script>
<script type="text/javascript" src="http://static.cybercommons.org/js/jquery.flot.time.js"></script>
</head>
<style>
.placeholder{
width:800px;
height:540px;
@mbstacy
mbstacy / attains_styles.css
Last active December 17, 2015 03:18
Load EPA impaired waters scraped tables in dashboard
#content a.metadata
{
color:#006699;
cursor:help;
}
#content a.description
{
color:#006699;
cursor:help;
% This program is modified by XIA XU from the programm written by Tao Xu to study the inverse problem of
% a one/two/three C pool model using MCMC with initial C pool size
% 06/25/2013-Windows version
clear all;
close all;
format long e;
% random seed is the clock, clock is used because the time we start something is relatively random
@mbstacy
mbstacy / ok_mesonet.py
Last active August 29, 2015 13:57
Oklahoma Mesonet Pandas DataFrame
#!/Users//anaconda/bin/python
"""
Python main module requires the correct python path.(see above).
Args sites startdate enddate
sites: string - comma sperated sites
startdate: YYY-MM-DD
enddate: YYYY-MM-DD
example:
Single site:
./ok_mesonet.py adax 2014-01-01 2014-02-01
@mbstacy
mbstacy / get-data-example.py
Last active August 29, 2015 14:04
US Army Corps of Engineers - Monthly Data into pandas
{
"metadata": {
"name": "Pandas Fixed Width"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@mbstacy
mbstacy / Pandas_groupby_mesonet
Created August 6, 2014 18:42
Pandas IO and Group By Weather Data Statisitcs
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mbstacy
mbstacy / OWS_Water_Usage_Oil_Gas.ipynb
Created November 3, 2014 17:39
OWS - Oil and Gas water usage grouped by year and fluid type
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mbstacy
mbstacy / secret_key_generator.py
Created December 23, 2015 22:20
Generate random secret key
import os, string
import binascii
key = binascii.hexlify(os.urandom(24)).decode("utf-8")
#Random upper case letters
for i in range(1,15):
char = random.choice(string.ascii_lowercase)
key = "".join(c.upper() if c in var else c for i, c in enumerate(key))