Skip to content

Instantly share code, notes, and snippets.

View pwolfram's full-sized avatar

Phillip J. Wolfram pwolfram

View GitHub Profile
@pwolfram
pwolfram / mpas_for_paraview.sh
Created May 21, 2019 21:30 — forked from bradyrx/mpas_for_paraview.sh
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pwolfram
pwolfram / gist:73fdf5e2f7fae0f8eb8d2fb848f2ffc8
Created March 9, 2017 19:36 — forked from mloberg/gist:3750653
Find file in git based on md5 checksum.
#!/bin/sh
CHECKSUM=$1
FILE=$2
if [[ -z "$CHECKSUM" ]]; then
echo "Usage: $0 md5 file"
exit 1
elif [[ -z "$FILE" ]]; then
echo "Usage: $0 md5 file"
@pwolfram
pwolfram / git-mv-with-history
Created April 1, 2016 20:08 — forked from emiller/git-mv-with-history
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@pwolfram
pwolfram / remove-periodic.cpd
Created October 29, 2015 14:39
Add missing numpy import
<CustomFilterDefinitions>
<CustomProxyDefinition name="Remove Periodic Sides" group="filters">
<CompoundSourceProxy id="5150" servers="1">
<Proxy group="filters" type="ProgrammableFilter" id="4476" servers="1" compound_name="ProgrammableFilter1">
<Property name="CopyArrays" id="4476.CopyArrays" number_of_elements="1">
<Element index="0" value="0"/>
<Domain name="bool" id="4476.CopyArrays.bool"/>
</Property>
<Property name="InformationScript" id="4476.InformationScript" number_of_elements="1">
<Element index="0" value=""/>
@pwolfram
pwolfram / fast_hist.py
Last active August 29, 2015 14:24 — forked from nkeim/fast_hist.py
#!/usr/bin/env python
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).
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pwolfram
pwolfram / README.md
Last active August 29, 2015 14:13 — forked from kerryrodden/.block

This is a modified example building off http://bl.ocks.org/kerryrodden/7090426

This example shows how it is possible to use a D3 sunburst visualization (partition layout) with data that describes sequences of events.

I created this example in my work at Google, but it is not part of any Google product. It is covered by the Apache license:

Copyright 2013 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); > > you may not use this file except in compliance with the License.

#!/usr/bin/env python
# Copyright: This document has been placed in the public domain.
"""
Taylor diagram (Taylor, 2001) test implementation.
http://www-pcmdi.llnl.gov/about/staff/Taylor/CV/Taylor_diagram_primer.htm
"""
__version__ = "Time-stamp: <2012-02-17 20:59:35 ycopin>"