This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from shapely.geometry import mapping | |
from shapely.ops import polygonize | |
import fiona | |
def polyline_to_polygon(input_file, output_file): | |
polylines = fiona.open(input_file) | |
geom = [x['geometry'] for x in polylines] | |
coords = [x['coordinates']for x in geom[:-1]] | |
schema = {'geometry': 'Polygon','properties': {'id': 'int'}} | |
with fiona.open(output_file, 'w', 'ESRI Shapefile', schema) as c: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import datetime | |
import os | |
def make_raw_files(path_to_raw_df, output_folder): | |
raw_df = pd.read_pickle(path_to_raw_df) | |
os.chdir(output_folder) | |
timestamp = datetime.datetime(2013,2,1,0,17,59) | |
half_hour_delta = datetime.timedelta(0,1800) | |
final_timestamp = datetime.datetime(2013,2,28,23,48) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from datetime import datetime | |
def month_his_to_df(his_file_path, resample=True): | |
his_columns = ['date_time', 'Tp', 'dirp', 'sprp', 'Tz', 'Hm0', 'TI', 'T1', | |
'Tc', 'Tdw2', 'Tdw1', 'Tpc', 'nu','eps','QP','Ss','TRef', | |
'TSea','Bat'] | |
month_dataframe = pd.io.parsers.read_csv(his_file_path, names = his_columns) | |
date_time_array = [] | |
for date_time_string in month_dataframe['date_time'].values: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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('.') |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.