Skip to content

Instantly share code, notes, and snippets.

View pwolfram's full-sized avatar

Phillip J. Wolfram pwolfram

View GitHub Profile
@bradyrx
bradyrx / mpas_for_paraview.sh
Last active May 21, 2019 21:33
extracts just the needed variables to trigger the Paraview reader to recognize it as an MPAS file
#!/bin/bash
GridVars=latCell,lonCell,maxLevelCell,nEdgesOnCell,xCell,yCell,zCell,dcEdge,dvEdge,indexToEdgeID,latEdge,lonEdge,nEdgesOnEdge,xEdge,yEdge,zEdge,areaTriangle,indexToVertexID,latVertex,lonVertex,xVertex,yVertex,zVertex,edgesOnVertex,cellsOnVertex,indexToCellID,indexToEdgeID,indexToVertexID,cellsOnEdge,edgesOnCell,edgesOnEdge,cellsOnCell,refBottomDepth,verticesOnCell,verticesOnEdge,bottomDepth
ncks -d Time,0 -v ${GridVars} file1.nc file2.nc
ncks -A -v ${GridVars} mpas_grid.nc mpas_file.nc
@pwolfram
pwolfram / a.rb
Created December 24, 2018 21:34
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?>
<gpx creator="StravaGPX" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd" version="1.1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
<metadata>
<time>2018-12-23T14:41:57Z</time>
</metadata>
<trk>
<name>HR test with polar</name>
<type>9</type>
<trkseg>
<trkpt lat="39.8870700" lon="-105.0340230">
@cossatot
cossatot / new_python_qgis_colorramps.xml
Created July 27, 2016 15:41
New Python perceptually-uniform colormaps as color ramps for QGIS
<!DOCTYPE qgis_style>
<qgis_style version="0">
<symbols/>
<colorramps>
<colorramp type="gradient" name="Magma">
<prop k="color1" v="0,0,3,255"/>
<prop k="color2" v="251,252,191,255"/>
<prop k="stops" v="0.04;4,4,21,255:0.08;14,10,42,255:0.12;26,16,65,255:0.16;40,17,89,255:0.20;57,15,110,255:0.23;74,16,121,255:0.27;90,21,126,255:0.31;105,28,128,255:0.35;121,34,129,255:0.39;137,40,129,255:0.43;153,45,127,255:0.47;169,50,124,255:0.51;185,55,120,255:0.55;202,62,114,255:0.59;217,70,106,255:0.62;230,81,98,255:0.66;240,96,93,255:0.70;247,113,91,255:0.74;251,132,96,255:0.78;253,151,104,255:0.82;254,170,116,255:0.86;254,188,130,255:0.90;253,207,146,255:0.94;253,225,163,255:0.98;252,243,181,255"/>
</colorramp>
<colorramp type="gradient" name="Inferno">
@tillahoffmann
tillahoffmann / weighted_kde.ipynb
Last active June 24, 2023 07:39
Weighted kernel density estimation based on `scipy.stats.gaussian_kde`.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nkeim
nkeim / fast_hist.py
Created January 4, 2013 20:20
Fast numpy histograms in 1 and 2 dimensions, extensible to n.
import numpy as np
def fast_hist(data, bin_edges):
"""Fast 1-dimensional histogram. Comparable to numpy.histogram(), but careless.
'bin_edges' should encompass all values in 'data'; the first and last elements
in 'bin_edges' are ignored, and are effectively (-infinity, infinity).
Returns the histogram array only.
"""