Skip to content

Instantly share code, notes, and snippets.

View seumasmorrison's full-sized avatar

James Morrison seumasmorrison

View GitHub Profile
@seumasmorrison
seumasmorrison / Scottish_Government_COVID-19_data.ipynb
Last active March 20, 2020 15:54
A daily breakdown of COVID-19 cases by Scottish health board since March 6th ( first case Tayside 1st March )
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@seumasmorrison
seumasmorrison / Teledyne_V50_Magnitude_Direction_CSV.ipynb
Last active September 12, 2017 16:09
Process exported CSVs from Teledyne Velocity software using pandas including export to compressed hdf5 & mat file using scipy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@seumasmorrison
seumasmorrison / sikuli_velocity.py
Created September 12, 2017 15:29
Sikuli script for automating data export from Teledyne's Velocity application ( moves through a long timseries exporting csv data for each section )
counter = 1
for n in range(362,800):
counter = counter + 2.5
t=find("1505122022039.png")
click(t)
wait(5)
click(Location(round(1032+n+counter),86))
wait(3)
if not exists("1505121767755.png"):
click(t)
@seumasmorrison
seumasmorrison / read_his.py
Created July 6, 2017 15:18
Snippet for reading a Datawell MKIII historical spectra file into a date time indexed DataFrame
import pandas as pd
his_columns = ['date_time', 'tp', 'dirp', 'sprp', 'tz', 'hm0', 'ti', 't1',
'tc', 'tdw2', 'tdw1', 'tpc', 'nu','eps','qp','ss','tref','tsea',
'bat']
def read_his(filepath):
return pd.read_csv(filepath, names=his_columns, index_col=[0], parse_dates=[0])
@seumasmorrison
seumasmorrison / SeaDarQ.au3
Last active June 26, 2017 15:47
AutoIt3 script for playback of XSPF in SeaDarQ with wave report enabled, timer set, playback speed set to maximum and specific XSPF file opened
#include <Constants.au3>
; Run SeaDarQ
Run("C:\Program Files\SeaDarQ\SeaDarQ.exe")
; Wait till it's finished loading
Sleep(5000)
;Right Click Wave menu to set timer & interval
MouseClick ( "right", 689, 35)
@seumasmorrison
seumasmorrison / wunderground_api_daily_observations_to_dataframe.ipynb
Last active June 25, 2017 11:39
Notebook for extracting daily wind observation data for one year from an airport weather station using the Weather Underground and creating a single time indexed and resampled pandas DataFrame then exporting to Excel Workbook.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@seumasmorrison
seumasmorrison / import_seadarq_wave_report.ipynb
Last active June 23, 2017 10:52
IPython Notebook for importing wave report files produced by Nortek B.V.'s SeaDarQ software ( tested with version 4.4.3756 ), importing all point spectral data into a single time indexed pandas DataFrame, Location values are converted to decimal degrees. Metadata including CubeSize, RangeCell, RotationTime & creation DateTime are stored along wi…
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from geopandas import GeoDataFrame
from shapely.geometry import Point
geometry = [Point(xy) for xy in zip(df.Lon, df.Lat)]
df = df.drop(['Lon', 'Lat'], axis=1)
crs = {'init': 'epsg:4326'}
geo_df = GeoDataFrame(df, crs=crs, geometry=geometry)
@seumasmorrison
seumasmorrison / hva_file_number_name_column.py
Created June 9, 2017 16:24
Dictionaries for mapping MKIV data based on data from libdatawell manual
# Dictionary mapping file name to data contents
datawell_mappings = {'20':'heave_spectrum',
'21':'directional_spectrum',
'23':'spectrum_sync',
'25':'directional_spectral_parameters',
'26':'upcross_wave_statistics',
'28':'secondary_directional_spectrum',
'81':'sea_surface_temperature',
'82':'acoustic_current_meter',
'C1':'system_message',
@seumasmorrison
seumasmorrison / windows_to_python_datetime.py
Last active November 3, 2017 11:24
Function for converting Windows timestamps to Python datetimes.
from datetime import datetime
from datetime import timedelta
def windows_timestamp_to_python_datetime(windows_timestamp):
return datetime(1601,1,1) + timedelta(microseconds=windows_timestamp/10)