Skip to content

Instantly share code, notes, and snippets.

@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',
#!/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 / 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": [
{
@douglatornell
douglatornell / WestgridJun2014.ipynb
Last active August 29, 2015 14:02
Analysis of Jun-2014 Salish Sea NEMO runtime profile tests on westgrid.ca machines
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@douglatornell
douglatornell / script_runs_example.py
Created July 22, 2014 16:50
Example of a script to execute a series of Salish Sea NEMO model runs.
"""Example script to define and execute a series of Salish Sea NEMO model runs.
"""
from __future__ import absolute_import
import os
import salishsea_cmd.api
def main():
@douglatornell
douglatornell / gist:2151f2ab1173e7985594
Created September 17, 2014 20:46
Commands to concatenate hourly EC research 2.5km GEM files to create a 1-day forcing file for NEMO
ncrcat -4 -L4 2014091000_00?_2.5km_360x300.nc ../NEMO-atmos/y2014m09d10.nc
ncrcat -4 -L4 -A ../NEMO-atmos/y2014m09d10.nc 2014091000_01?_2.5km_360x300.nc ../NEMO-atmos/y2014m09d10.nc
ncrcat -4 -L4 -A ../NEMO-atmos/y2014m09d10.nc 2014091000_02?_2.5km_360x300.nc ../NEMO-atmos/y2014m09d10.nc
{
"metadata": {
"name": "",
"signature": "sha256:9e4150b049ad8b9ee7600a8fe76567ad97f185a1fd5cf7f86f63e60c83795bf7"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@douglatornell
douglatornell / gist:550c46ebd38c0f627a3e
Last active August 29, 2015 14:16
Notes from plot_thresholds_all() code review on 2015-03-10
from collections import OrderedDict
# Here's a possible data structure to hold constant values for the sites
# that we report ssh for. The outer dict has 2 keys: DFO and NOAA. Each of
# those keys has an OrderedDict as its value. OrderedDicts are defined by
# lists of key-value 2-tuples. Here the keys of the DFO OrderedDict are the
# names of the DFO sites, and the values are a dict of constant values.
# So, iterating over SITES['DFO'].items() will return the constants for
# Point Atkinson, Campbell River, and Victoria, in that order. The Campbell
# River extreme_ssh is accessed by SITES['DFO']['Campbell River']['extreme_ssh'].
@douglatornell
douglatornell / gist:ca2e978bc1f3a7fc5e10970ce88b5970
Created November 17, 2016 18:47
GoMSS Nowcast Test 14nov16
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Visualize Results of a GoMSS Nowcast Run\n",
"\n",
"A quick collection of plots of results from a 1 day GoMSS nowcast system run."
]
@douglatornell
douglatornell / NowcastResultsViz.ipynb
Created December 8, 2016 20:27
GoMSS Nowcast Production 08dec16
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.