Skip to content

Instantly share code, notes, and snippets.

View florisvb's full-sized avatar

Floris van Breugel florisvb

View GitHub Profile
import gdal
d = gdal.Open('10n060e_20101117_gmted_mea300.tif')
arr = d.ReadAsArray()
def get_elevation_at_point(x, y, elevation_array):
# skip interpolation for now
return elevation_array[int(x), int(y)]
def get_elevation_profile_for_path(x, y, elevation_array):
e = [get_elevation_at_point(x[i], y[i], elevation_array) for i in range(len(x))]
@florisvb
florisvb / SystemVersion.plist
Created March 23, 2018 22:11
File required for making ubuntu bootable on a Mac
<xml version="1.0" encoding="utf-8"?>
<plist version="1.0">
<dict>
<key>ProductBuildVersion</key>
<string></string>
<key>ProductName</key>
<string>Linux</string>
<key>ProductVersion</key>
<string>Ubuntu Linux</string>
</dict>
@florisvb
florisvb / figurefirst_install_notes.md
Last active April 11, 2018 19:58
Some handy commands for getting FigureFirst and Jupyter installed in a virtualenv

Install inkscape

sudo apt-get install inkscape

Download figurefirst:

git clone https://github.com/FlyRanch/figurefirst.git

Make a virtual environment

Include the system site packages (that way we don't have to install numpy, scipy, etc)
sudo apt-get install python-virtualenv

virtualenv FIG --system-site-packages

@florisvb
florisvb / install_ros_and_mac_cam.sh
Last active January 14, 2019 16:32
Install ROS and make mac camera available
#!/bin/sh
sudo apt-get update
sudo apt-get upgrade -y
# install ROS
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full -y
sudo rosdep init
rosdep update
@florisvb
florisvb / read_hdf5.py
Created May 2, 2018 01:10
Psuedo script for opening and plotting hdf5 data
import h5py
f = h5py.File(filename)
print f.keys()
data = f[keyname].value # choose a keyname from the list of keys
print data
a = data[name] # choose a name from the data dtype names
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
@florisvb
florisvb / multiprocessing_example.py
Created October 7, 2019 16:17
multiprocessing example
import multiprocessing
import numpy as np
import time
def compute_something(input):
a = input[0]
b = input[1]
r = a**b**b
return r
#########################################################################################################
## OVERVIEW
#########################################################################################################
# Plot trajectory with oriented, colored wedges. See file end for example.
#########################################################################################################
## IMPORTS
#########################################################################################################