Skip to content

Instantly share code, notes, and snippets.

View seumasmorrison's full-sized avatar

James Morrison seumasmorrison

View GitHub Profile
@seumasmorrison
seumasmorrison / Buoy_displacements_in_HDF5.ipynb
Created January 28, 2014 10:25
Notebook detailing experiements with HDF5 for storing buoy time series, http://nbviewer.ipython.org/gist/seumasmorrison/8665269
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@seumasmorrison
seumasmorrison / welchs_method_displacement.ipynb
Last active August 29, 2015 14:05
Welch's method for creating Power Spectral Density plots on displacement data from Datawell Waverider raw files
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@seumasmorrison
seumasmorrison / waves21_dat_plot.ipynb
Created September 3, 2014 11:31
Plot W@ves21 dat file
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@seumasmorrison
seumasmorrison / AWAC_Carloway.ipynb
Last active August 29, 2015 14:06
Outputs from a vertical deployment of an AWAC of Carloway Pier
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@seumasmorrison
seumasmorrison / awac_dat_dataframe.ipynb
Created September 12, 2014 11:48
Nortek AWAC dat file to pandas DataFrame
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@seumasmorrison
seumasmorrison / plot_battery.py
Last active August 29, 2015 14:06
Plotting Battery Status from Datawell waverider spt files using pandas
import os
import matplotlib.pyplot as plt
import pandas as pd
fig = plt.figure(figsize=(20,10), dpi=100)
from datetime import datetime
os.chdir('/path/to/buoy_name/year/')
date_index = []
battery_status = []
months = os.listdir('.')
@seumasmorrison
seumasmorrison / datawell_raw_to_wafo.m
Last active August 29, 2015 14:07
Plotting a spectra using WAFO Matlab toolbox from a Datawell Waverider MKIII raw displacements file. The raw file should have a significant wave height (Hm0) of 4.63 metres, a peak period of 14.29 seconds and a mean direction of 260.2 degrees (WSW) calculated by Datawell's own W@ves21. Using the default parameters WAFO gives good values for Hm0 …
% An example file for importing datawell raw displacements into wafo
% ( http://www.maths.lth.se/matstat/wafo/ )
function [S,mean_wave_dir_deg_peak_freq, Hm0, Tp] = datawell_raw_to_wafo(file_path)
%displacements=csvread(file_path);
displacements=dlmread(file_path);
heave=displacements(:,2)/100;
north=-1*displacements(:,3)/100;
west=displacements(:,4)/100;
%length of the time series
function output_spectra = datawell_raw_to_diwasp(file_path, output_dir, visible)
% read the raw file data into a matrix stripping signal quality info
try
raw_matrix = csvread(file_path);
catch err
disp('Problem with RAW file')
output_spectra = 0;
return
end
raw_matrix = raw_matrix/100;
@seumasmorrison
seumasmorrison / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@seumasmorrison
seumasmorrison / plot_spectra.py
Created October 21, 2014 15:13
Script for plotting buoy spectra from Datawell Waverider buoy. Pass an absolute file path to plot_spectra function and it will create png files with polar plots for buoy spectra file.
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 21 15:49:56 2014
@author: le12jm
"""
import os
import numpy as np
import matplotlib.cm as cm