Created
May 9, 2016 18:31
-
-
Save phobson/d0c0825c5296bf06791ecc35fb463917 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# PDX airport monthly rainfall data" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"C:\\Users\\phobson\\Miniconda3\\envs\\std\\lib\\site-packages\\IPython\\html.py:14: ShimWarning: The `IPython.html` package has been deprecated. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.\n", | |
" \"`IPython.html.widgets` has moved to `ipywidgets`.\", ShimWarning)\n" | |
] | |
} | |
], | |
"source": [ | |
"import cloudside" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Create station, download data" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"pdx = cloudside.WeatherStation(\"KPDX\")\n", | |
"pdx.getASOSData(\"2015-01-01\", \"2016-05-01\", filename='kpdx_asos.csv')\n", | |
"pdx.getWundergroundData(\"2015-01-01\", \"2016-05-01\", filename='kpdx_wunder.csv')" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## List ASOS files" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"1) kpdx_asos.csv - start: 2015-01-01 00:00:00\tend: 2016-04-30 23:55:00\n" | |
] | |
} | |
], | |
"source": [ | |
"pdx.showCompiledFiles(\"asos\")" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Load by filename" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>Sta</th>\n", | |
" <th>Precip</th>\n", | |
" <th>Temp</th>\n", | |
" <th>DewPnt</th>\n", | |
" <th>WindSpd</th>\n", | |
" <th>WindDir</th>\n", | |
" <th>AtmPress</th>\n", | |
" <th>SkyCover</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>Date</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>2015-01-01 00:00:00</th>\n", | |
" <td>KPDX</td>\n", | |
" <td>0.0</td>\n", | |
" <td>-2.8</td>\n", | |
" <td>-10.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>120.0</td>\n", | |
" <td>30.41</td>\n", | |
" <td>0.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-01-01 00:05:00</th>\n", | |
" <td>KPDX</td>\n", | |
" <td>0.0</td>\n", | |
" <td>-2.2</td>\n", | |
" <td>-10.0</td>\n", | |
" <td>9.0</td>\n", | |
" <td>120.0</td>\n", | |
" <td>30.40</td>\n", | |
" <td>0.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-01-01 00:10:00</th>\n", | |
" <td>KPDX</td>\n", | |
" <td>0.0</td>\n", | |
" <td>-2.2</td>\n", | |
" <td>-10.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>120.0</td>\n", | |
" <td>30.40</td>\n", | |
" <td>0.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-01-01 00:15:00</th>\n", | |
" <td>KPDX</td>\n", | |
" <td>0.0</td>\n", | |
" <td>-2.2</td>\n", | |
" <td>-10.6</td>\n", | |
" <td>10.0</td>\n", | |
" <td>110.0</td>\n", | |
" <td>30.40</td>\n", | |
" <td>0.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-01-01 00:20:00</th>\n", | |
" <td>KPDX</td>\n", | |
" <td>0.0</td>\n", | |
" <td>-2.2</td>\n", | |
" <td>-10.6</td>\n", | |
" <td>11.0</td>\n", | |
" <td>110.0</td>\n", | |
" <td>30.40</td>\n", | |
" <td>0.0</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Sta Precip Temp DewPnt WindSpd WindDir AtmPress \\\n", | |
"Date \n", | |
"2015-01-01 00:00:00 KPDX 0.0 -2.8 -10.0 7.0 120.0 30.41 \n", | |
"2015-01-01 00:05:00 KPDX 0.0 -2.2 -10.0 9.0 120.0 30.40 \n", | |
"2015-01-01 00:10:00 KPDX 0.0 -2.2 -10.0 7.0 120.0 30.40 \n", | |
"2015-01-01 00:15:00 KPDX 0.0 -2.2 -10.6 10.0 110.0 30.40 \n", | |
"2015-01-01 00:20:00 KPDX 0.0 -2.2 -10.6 11.0 110.0 30.40 \n", | |
"\n", | |
" SkyCover \n", | |
"Date \n", | |
"2015-01-01 00:00:00 0.0 \n", | |
"2015-01-01 00:05:00 0.0 \n", | |
"2015-01-01 00:10:00 0.0 \n", | |
"2015-01-01 00:15:00 0.0 \n", | |
"2015-01-01 00:20:00 0.0 " | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"df = pdx.loadCompiledFile(\"asos\", filename='kpdx_asos.csv')\n", | |
"df.head()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## List Wunderground files" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"1) kpdx_wunder.csv - start: 2015-01-01 08:53:00\tend: 2016-05-02 06:53:00\n" | |
] | |
} | |
], | |
"source": [ | |
"pdx.showCompiledFiles(\"wunderground\")" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Load by file number" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>Sta</th>\n", | |
" <th>Precip</th>\n", | |
" <th>Temp</th>\n", | |
" <th>DewPnt</th>\n", | |
" <th>WindSpd</th>\n", | |
" <th>WindDir</th>\n", | |
" <th>AtmPress</th>\n", | |
" <th>SkyCover</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>Date</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>2015-01-01 08:53:00</th>\n", | |
" <td>KPDX</td>\n", | |
" <td>0.0</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-01-01 09:53:00</th>\n", | |
" <td>KPDX</td>\n", | |
" <td>0.0</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-01-01 10:53:00</th>\n", | |
" <td>KPDX</td>\n", | |
" <td>0.0</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-01-01 11:53:00</th>\n", | |
" <td>KPDX</td>\n", | |
" <td>0.0</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-01-01 12:53:00</th>\n", | |
" <td>KPDX</td>\n", | |
" <td>0.0</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Sta Precip Temp DewPnt WindSpd WindDir AtmPress \\\n", | |
"Date \n", | |
"2015-01-01 08:53:00 KPDX 0.0 NaN NaN NaN NaN NaN \n", | |
"2015-01-01 09:53:00 KPDX 0.0 NaN NaN NaN NaN NaN \n", | |
"2015-01-01 10:53:00 KPDX 0.0 NaN NaN NaN NaN NaN \n", | |
"2015-01-01 11:53:00 KPDX 0.0 NaN NaN NaN NaN NaN \n", | |
"2015-01-01 12:53:00 KPDX 0.0 NaN NaN NaN NaN NaN \n", | |
"\n", | |
" SkyCover \n", | |
"Date \n", | |
"2015-01-01 08:53:00 NaN \n", | |
"2015-01-01 09:53:00 NaN \n", | |
"2015-01-01 10:53:00 NaN \n", | |
"2015-01-01 11:53:00 NaN \n", | |
"2015-01-01 12:53:00 NaN " | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"df = pdx.loadCompiledFile(\"wunderground\", filenum=1)\n", | |
"df.head()" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.5.1" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment