Last Update: 02.05.2017
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 rtree import index | |
from random import random | |
from datetime import datetime | |
timer = datetime.now() | |
# Create 10,000,000 random numbers between 0 and 1 | |
rands = [random() for i in range(10000000)] | |
# Function required to bulk load the random points into the index |
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
''' | |
Only slighted modified from code provided by Laura De Cicco (USGS). | |
Laura De Cicco, A. Crosby | |
http://nwisvaws02.er.usgs.gov/ogc-swie/wml2/uv/sos?request=GetObservation&featureID=01446500&offering=UNIT&observedProperty=00060&beginPosition=2013-02-15 | |
''' | |
from xml.dom import minidom, Node | |
import datetime |
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
# Make sure g++ compiler is installed for hdf5 | |
sudo apt-get install g++ dpkg-dev | |
# Download HDF5 source unpack and cd to directory | |
wget http://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.10.tar.gz | |
tar -xzvf hdf5-1.8.10.tar.gz | |
cd hdf5-1.8.10 | |
./configure --prefix=/usr/local --enable-shared --enable-hl | |
make -j 2 | |
sudo make install |
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
sudo apt-get install dpkg-dev libcurl4-gnutls-dev | |
# Download netCDF4 source unpack and cd to directory | |
wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.2.1.1.zip | |
unzip netcdf-4.2.1.1.zip | |
cd netcdf-4.2.1.1 | |
LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include ./configure --enable-netcdf-4 --enable-dap --enable-shared --prefix=/usr/local --disable-doxygen | |
make -j 2 | |
sudo make install | |
cd .. |
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
# Install spatialindex 1.7.0+ | |
wget http://download.osgeo.org/libspatialindex/spatialindex-src-1.7.1.tar.gz | |
tar zxvf spatialindex-src-1.7.1.tar.gz | |
cd spatialindex-src-1.7.1 | |
./configure | |
make -j 2 | |
sudo make install | |
sudo ldconfig |
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
;; this location is "~/.pudb-bp" in older versions of pudb | |
(setq pudb-bp-file (expand-file-name "~/.config/pudb/saved-breakpoints")) | |
(defun pudb-add-breakpoint () | |
(interactive) | |
(append-to-file | |
(concat "b " buffer-file-name ":" | |
(nth 1 (split-string (what-line))) "\n") | |
nil pudb-bp-file)) | |
(define-key py-mode-map (kbd "C-c C-t") 'pudb-add-breakpoint) |
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
#!/usr/bin/python | |
import subprocess, sys, shlex | |
#command = shlex.split(sys.argv[1]) | |
command = "optirun " + sys.argv[1] | |
test = True | |
c = 0 | |
while test: |
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 numpy as np | |
import struct | |
def read_stl(filename): | |
with open(filename) as f: | |
Header = f.read(80) | |
nn = f.read(4) | |
Numtri = struct.unpack('i', nn)[0] | |
record_dtype = np.dtype([ |
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 pyugrid | |
import netCDF4 | |
# Default ADCIRC output (from OWI) | |
adcirc = "fort.63.nc" | |
nc = netCDF4.Dataset(adcirc) | |
ugobj = pyugrid.UGrid.from_nc_dataset(nc) | |
pyugrid.read_netcdf.is_valid_mesh(nc, "adcirc_mesh") | |
# SELFE sample |
OlderNewer