Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Waigl chryss

View GitHub Profile
@chryss
chryss / wrf39_source_file.ipynb
Created Aug 17, 2018
Fuego volcano source file
View wrf39_source_file.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chryss
chryss / wrf39_source_file.ipynb
Created Aug 17, 2018
Fuego volcano source file
View wrf39_source_file.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chryss
chryss / getthething.py
Created Jun 8, 2018
What to do when an API returns EITHER a scalar/string OR a list of scalars/strings, and you want the first one
View getthething.py
mylist = ['a', 'b']
mynotalist = 'a'
def getthething(athing):
return list(athing)[0]
print(getthething(mylist))
print(getthething(mynotalist))
View uselection2016.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View plottingshapefiles.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View rawmodismetadata.txt
GROUP = INVENTORYMETADATA
GROUPTYPE = MASTERGROUP
GROUP = ECSDATAGRANULE
OBJECT = LOCALGRANULEID
NUM_VAL = 1
VALUE = "MOD021KM.A2015166.2225.005.2015167074726.hdf"
END_OBJECT = LOCALGRANULEID
View modis_coremetadata0.py
{'INVENTORYMETADATA': {'ADDITIONALATTRIBUTES': {'AveragedBlackBodyTemperature': 290.02,
'AveragedFocalPlane1Temperature': 269.94,
'AveragedFocalPlane2Temperature': 270.15,
'AveragedFocalPlane3Temperature': 83.34,
'AveragedFocalPlane4Temperature': 83.02,
'AveragedMirrorTemperature': 277.73,
'CalibrationQuality': 'marginal',
'MissionPhase': 'EXECUTION',
'NadirPointing': 'Y'},
'ANCILLARYINPUTGRANULE': {'ANCILLARYINPUTPOINTER': 'MOD03.A2015166.2225.005.2015167051911.hdf',
View gist:2a548faf0a495c596398
### 42 OPEN FILES:
[u'/Users/chris/.virtualenvs/science27/lib/python2.7/site-packages/mpl_toolkits/basemap/data/gshhs_l.dat',
u'/Users/chris/.virtualenvs/science27/lib/python2.7/site-packages/mpl_toolkits/basemap/data/gshhs_l.dat',
u'/Users/chris/.virtualenvs/science27/lib/python2.7/site-packages/mpl_toolkits/basemap/data/riversmeta_l.dat',
u'/Users/chris/.virtualenvs/science27/lib/python2.7/site-packages/mpl_toolkits/basemap/data/gshhs_l.dat',
u'/Users/chris/.virtualenvs/science27/lib/python2.7/site-packages/mpl_toolkits/basemap/data/countriesmeta_l.dat',
u'/Users/chris/.virtualenvs/science27/lib/python2.7/site-packages/mpl_toolkits/basemap/data/riversmeta_l.dat',
u'/Users/chris/.virtualenvs/science27/lib/python2.7/site-packages/mpl_toolkits/basemap/data/gshhsmeta_l.dat',
u'/Users/chris/.virtualenvs/science27/lib/python2.7/site-packages/mpl_toolkits/basemap/data/gshhs_l.dat',
u'/Users/chris/.virtualenvs/science27/lib/python2.7/site-packages/mpl_toolkits/basemap/data/rivers_l.dat',
View StLaurence_ice.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View minesweeper.py
import argparse
import collections
# Let's define a global dispatch table for the 8 different possible neighbors
# clockwise starting top-left: tl, t, tr, r, br, b, bl, l.
# The target index only depends on the number of rows and the start index jj
# As we won't know beforehand which functions to use for a given start index,
# we make them all dependent on both jj and n
neighbordispatch = {