Skip to content

Instantly share code, notes, and snippets.

@douglatornell
douglatornell / gist:11020457
Created April 18, 2014 01:33
IPython Notebook Exploring How netCDF4 Variable fill_value=0 Works
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Fortran namelist parser. Converts nameslists to python dictionaries.
Should be fairly robust. Cannot be used for verifying fortran namelists as it
is rather forgiving.
Error messages during parsing are kind of messy right now.
@douglatornell
douglatornell / get_EC_xml_weather_obs.py
Last active January 6, 2017 20:00
Pulling hourly historical weather data from http://climate.weather.gc.ca/
import cStringIO
import requests
from xml.etree import cElementTree as ElementTree
url = 'http://climate.weather.gc.ca/climateData/bulkdata_e.html'
query = {
# Spelling of keys is case-sensitive at the URL-processor end
'timeframe': 1,
'stationID': 6831, # Sandheads
'format': 'xml',
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@douglatornell
douglatornell / gist:5887821
Created June 28, 2013 20:26
dwgLINQ search code
@staticmethod
def search(params):
"""Return an iterator that yields :class:`Drawing` objects populated
with the data for the drawings that match the search parameters.
:arg params: Search parameters in key-value pairs from search form
on drawings page.
:type params: dict
"""
filters = []
@douglatornell
douglatornell / pages.py
Created June 21, 2013 22:35
Examples of Selenium/WebDriver page objects and tests. The page objects are based on the holmium.core library.
# -*- coding: utf-8 -*-
"""Page objects for UI testing of Nordion SmartSolve CF app.
"""
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from holmium.core import (
Locators,
PageElement,
PageObject,
)
@douglatornell
douglatornell / gist:5730819
Created June 7, 2013 17:13
Scons build file example for Sphinx HTML generation and rsync deployment
# -*- coding: utf-8 -*-
"""SCons build file for dwgLINQ CADD drawing metadata database tool project
for Nordion Vancouver.
"""
import os
env = Environment(
ENV=os.environ,
tools=['sphinx'],
@douglatornell
douglatornell / dynmodes.ipynb
Created April 29, 2013 04:00
Calculation of Vertical Dynamic Ocean Modes Based on http://woodshole.er.usgs.gov/operations/sea-mat/klinck-html/dynmodes.html by John Klinck, 1999.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@douglatornell
douglatornell / gist:4435214
Created January 2, 2013 15:07
pyramid_mailer transaction traceback from Python 3.3
Traceback (most recent call last):
File "/Users/doug/.virtualenvs/randopony-tetra/lib/python3.3/site-packages/pyramid_debugtoolbar-1.0.3-py3.3.egg/pyramid_debugtoolbar/panels/performance.py", line 55, in resource_timer_handler
result = handler(request)
File "/Users/doug/.virtualenvs/randopony-tetra/lib/python3.3/site-packages/pyramid-1.4-py3.3.egg/pyramid/tweens.py", line 21, in excview_tween
response = handler(request)
File "/Users/doug/.virtualenvs/randopony-tetra/lib/python3.3/site-packages/pyramid_tm-0.7-py3.3.egg/pyramid_tm/__init__.py", line 82, in tm_tween
reraise(*exc_info)
File "/Users/doug/.virtualenvs/randopony-tetra/lib/python3.3/site-packages/pyramid_tm-0.7-py3.3.egg/pyramid_tm/compat.py", line 13, in reraise
raise value
File "/Users/doug/.virtualenvs/randopony-tetra/lib/python3.3/site-packages/pyramid_tm-0.7-py3.3.egg/pyramid_tm/__init__.py", line 63, in tm_tween