Skip to content

Instantly share code, notes, and snippets.

View johannah's full-sized avatar

Johanna Hansen johannah

View GitHub Profile
@johannah
johannah / send_nmea.py
Last active May 2, 2016 22:34
example nmea output
import os
import sys
import socket
# sinaps server ip address
UDP_IP = "192.168.0.1"
UDP_POT = 5003
NMEA = "$GPGGA,172814.0,3723.46587704,N,12202.26957864,W,2,6,1.2,18.893,M,-25.669,M,2.0,0031*4F"
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@johannah
johannah / mb-system-install-notes.md
Last active June 10, 2023 12:41
Instructions for Installing MB-System for Sonar processing

This is documentation for installing MB-System-r2279 on Ubuntu 14.04 as of Nov 2016. Although documentation for mb-system has improved dramatically over the past few years, it can still be difficult. In particular, I have not found step 1.4 in the documentation and missing this step will result in being unable to use gmt shared libraries such as "gmt mbcontour" which is necessary for producing contour lines in maps.

##1) Install GMT 5.1.2 I am using directions from Andrew at: http://andrewjmoodie.com/2014/12/installing-the-generic-mapping-tools-5-gmt-5-1-x-on-ubuntu-linux/ I've added step 1.4 to get this to load shared libraries from mb-system.

##1.1) Install relvent dependencies

@johannah
johannah / create_geotiff.py
Last active September 5, 2022 20:46
Helper file to create a geotiff from a given image or from an automatically downloaded satellite image from google maps which is centered around a given coordinate .
"""
BST License
# Description
File to create geotiffs depends on gdal installed on system. Can be used under two modes:
1) Download a satellite overview screenshot from google maps around a center
coordinate. Can give zoom (max is usually 20, but depends on area - will return
an image with error message if zoom is too high) and image size
(defaults to max 640x640)
2) Convert an existing image into a geotiff by giving UL and LR corner
import numpy
import time
import matplotlib.pyplot as plt
import numpy as np
from copy import deepcopy
import os, sys
from scipy.misc import face
import GPy
from skimage.transform import resize
from skimage.filters import gaussian_filter
@johannah
johannah / dataset_links.md
Last active June 8, 2017 17:31
Dataset links and short descriptions
@johannah
johannah / statistics_for_hackers.py
Last active July 7, 2017 18:16
stats for hackers
import matplotlib.pyplot as plt
import numpy as np
# example taken from Jake Vanderplas' talk "Statistics for Hackers"
def is_statistically_significant_shuffle(s1,s2,trials=10000,do_plot=False,null_hyp=.05):
# find difference of means to test null hyp
odiff = np.mean(s1)-np.mean(s2)
# join the lists together
a = np.array(s1+s2)
name: py-ros
channels:
- defaults
dependencies:
- backports=1.0=py27h63c9359_1
- backports.shutil_get_terminal_size=1.0.0=py27h5bc021e_2
- ca-certificates=2017.08.26=h1d4fec5_0
- certifi=2017.7.27.1=py27h9ceb091_0
- decorator=4.1.2=py27h1544723_0
- enum34=1.1.6=py27h99a27e9_1
import os, sys
from glob import glob
from IPython import embed
from subprocess import call
# example <a href='catalog.html?dataset=NOAA/CBOFS/MODELS/201710/nos.cbofs.stations.nowcast.20171031.t18z.nc'><tt>nos.cbofs.stations.nowcast.20171031.t18z.nc</tt></a></td>^M
fpaths = glob('/localdata/jhansen/thredds/opendap.co-ops.nos.noaa.gov/thredds/catalog/NOAA/*')
output = '/localdata/jhansen/thredds/ncfiles'
fileServer = 'https://opendap.co-ops.nos.noaa.gov/thredds/fileServer/'
for station in fpaths:
# only get stations which have fairly open oceans
@johannah
johannah / sine_wave_rnn.py
Last active May 1, 2018 17:12
learning rnn sinewaves
# from KK
import torch
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plt
import torch.nn.init as init
from IPython import embed
dtype = torch.FloatTensor
input_size, hidden_size, output_size = 1,128,1
# from KK
from copy import deepcopy
import time
import os
import torch
import torch.nn as nn
from torch.nn.utils.clip_grad import clip_grad_norm
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable