update notebook format, removed binary blobs

intro16
epifanio 2016-04-20 00:17:58 -04:00
parent c870a04a84
commit b13ebb491e
16 changed files with 6086 additions and 7729 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,3 @@
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@ -28,15 +21,37 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"prompt_number": 2
"source": []
}
],
"metadata": {}
"metadata": {
"kernelspec": {
"display_name": "Python 3 Sys",
"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+"
},
"widgets": {
"state": {},
"version": "0.3.0"
}
]
},
"nbformat": 4,
"nbformat_minor": 1
}

View File

@ -1,10 +1,3 @@
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@ -28,24 +21,16 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import iris\n",
"print iris.load([iris.sample_data_path('GloSea4', 'ensemble_010.pp'),\n",
" iris.sample_data_path('GloSea4', 'ensemble_011.pp')])"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"0: surface_temperature / (K) (realization: 2; time: 6; latitude: 145; longitude: 192)\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
@ -56,25 +41,39 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"print iris.load(iris.sample_data_path('GloSea4', 'ensemble_01[12].pp'))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 Sys",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"0: surface_temperature / (K) (time: 6; forecast_reference_time: 2; latitude: 145; longitude: 192)\n"
]
"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+"
},
"widgets": {
"state": {},
"version": "0.3.0"
}
],
"prompt_number": 3
}
],
"metadata": {}
}
]
},
"nbformat": 4,
"nbformat_minor": 1
}

View File

@ -1,10 +1,3 @@
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@ -18,7 +11,29 @@
]
}
],
"metadata": {}
"metadata": {
"kernelspec": {
"display_name": "Python 3 Sys",
"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+"
},
"widgets": {
"state": {},
"version": "0.3.0"
}
]
},
"nbformat": 4,
"nbformat_minor": 1
}

View File

@ -1,10 +1,3 @@
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@ -37,7 +30,29 @@
]
}
],
"metadata": {}
"metadata": {
"kernelspec": {
"display_name": "Python 3 Sys",
"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+"
},
"widgets": {
"state": {},
"version": "0.3.0"
}
]
},
"nbformat": 4,
"nbformat_minor": 1
}

View File

@ -1,26 +1,20 @@
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import iris.analysis.cartography\n",
"cube.coord('grid_latitude').guess_bounds()\n",
"cube.coord('grid_longitude').guess_bounds()\n",
"grid_areas = iris.analysis.cartography.area_weights(cube)\n",
"\n",
"area_avg = cube.collapsed(['grid_longitude', 'grid_latitude'], iris.analysis.MEAN, weights=grid_areas)"
],
"language": "python",
"metadata": {},
"outputs": []
]
},
{
"cell_type": "markdown",
@ -31,14 +25,37 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": []
}
],
"metadata": {}
"metadata": {
"kernelspec": {
"display_name": "Python 3 Sys",
"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+"
},
"widgets": {
"state": {},
"version": "0.3.0"
}
]
},
"nbformat": 4,
"nbformat_minor": 1
}

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,3 @@
{
"metadata": {
"name": "iris_exercise_7"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@ -18,41 +11,17 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import iris\n",
"filename = iris.sample_data_path(\"A1B_north_america.nc\")\n",
"cube = iris.load_cube(filename)\n",
"print cube"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"air_temperature / (K) (time: 240; latitude: 37; longitude: 49)\n",
" Dimension coordinates:\n",
" time x - -\n",
" latitude - x -\n",
" longitude - - x\n",
" Auxiliary coordinates:\n",
" forecast_period x - -\n",
" Scalar coordinates:\n",
" forecast_reference_time: 1859-09-01 06:00:00\n",
" height: 1.5 m\n",
" Attributes:\n",
" Conventions: CF-1.5\n",
" Model scenario: A1B\n",
" STASH: m01s03i236\n",
" source: Data from Met Office Unified Model 6.05\n",
" Cell methods:\n",
" mean: time (6 hour)\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
@ -63,42 +32,33 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"tcoord = cube.coord('time')\n",
"def since_1980(cell):\n",
" return tcoord.units.num2date(cell.point).year >= 1980\n",
"\n",
"tcon = iris.Constraint(time=since_1980)\n",
"cube = cube.extract(tcon)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"tcoord = cube.coord('time')\n",
"\n",
"print tcoord.units.num2date(tcoord.points.min())\n",
"print tcoord.units.num2date(tcoord.points.max())"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"1980-06-01 00:00:00\n",
"2099-06-01 00:00:00\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "markdown",
@ -112,26 +72,18 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def get_decade(coord, point):\n",
" year = coord.units.num2date(point).year\n",
" return (year/10)*10\n",
"time = iris.coords.DimCoord([10], 'time', units='days since 2018-01-01')\n",
"print get_decade(time, time.points[0])"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"2010\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "markdown",
@ -142,34 +94,16 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import iris.coord_categorisation as coord_cat\n",
"coord_cat.add_categorised_coord(cube, 'decade', 'time', get_decade)\n",
"print cube.coord('decade')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"AuxCoord(array([1980, 1980, 1980, 1980, 1980, 1980, 1980, 1980, 1980, 1980, 1990,\n",
" 1990, 1990, 1990, 1990, 1990, 1990, 1990, 1990, 1990, 2000, 2000,\n",
" 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2010, 2010, 2010,\n",
" 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2020, 2020, 2020, 2020,\n",
" 2020, 2020, 2020, 2020, 2020, 2020, 2030, 2030, 2030, 2030, 2030,\n",
" 2030, 2030, 2030, 2030, 2030, 2040, 2040, 2040, 2040, 2040, 2040,\n",
" 2040, 2040, 2040, 2040, 2050, 2050, 2050, 2050, 2050, 2050, 2050,\n",
" 2050, 2050, 2050, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060,\n",
" 2060, 2060, 2070, 2070, 2070, 2070, 2070, 2070, 2070, 2070, 2070,\n",
" 2070, 2080, 2080, 2080, 2080, 2080, 2080, 2080, 2080, 2080, 2080,\n",
" 2090, 2090, 2090, 2090, 2090, 2090, 2090, 2090, 2090, 2090]), standard_name=None, units=Unit('1'), long_name=u'decade')\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "markdown",
@ -180,43 +114,16 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import iris.analysis\n",
"cube = cube.aggregated_by('decade', iris.analysis.MEAN)\n",
"print cube"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"air_temperature / (K) (time: 12; latitude: 37; longitude: 49)\n",
" Dimension coordinates:\n",
" time x - -\n",
" latitude - x -\n",
" longitude - - x\n",
" Auxiliary coordinates:\n",
" decade x - -\n",
" forecast_period x - -\n",
" Scalar coordinates:\n",
" forecast_reference_time: 1859-09-01 06:00:00\n",
" height: 1.5 m\n",
" Attributes:\n",
" Conventions: CF-1.5\n",
" Model scenario: A1B\n",
" STASH: m01s03i236\n",
" history: Mean of air_temperature aggregated over decade\n",
" source: Data from Met Office Unified Model 6.05\n",
" Cell methods:\n",
" mean: time (6 hour)\n",
" mean: decade\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "markdown",
@ -227,8 +134,12 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import iris.plot as iplt\n",
"\n",
@ -241,14 +152,32 @@
" plt.title('{}'.format(decade_cube.coord('decade').points[0]))\n",
" plt.gca().coastlines()\n",
"plt.show()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 16
}
],
"metadata": {}
}
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 Sys",
"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+"
},
"widgets": {
"state": {},
"version": "0.3.0"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,3 @@
{
"metadata": {
"name": "",
"signature": "sha256:848ef38126532012d51f85fda6138dfe097a4c6c37850c846063ebee9d3928bb"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@ -22,25 +14,16 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import numpy as np\n",
"A = np.arange(1, 9).reshape(2, -1)\n",
"print A"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[[1 2 3 4]\n",
" [5 6 7 8]]\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "markdown",
@ -54,23 +37,15 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"B = np.array([1, 2])\n",
"print B"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[1 2]\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
@ -86,26 +61,39 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"print A + B.reshape(2, 1)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 Sys",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[[ 2 3 4 5]\n",
" [ 7 8 9 10]]\n"
]
"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+"
},
"widgets": {
"state": {},
"version": "0.3.0"
}
],
"prompt_number": 3
}
],
"metadata": {}
}
]
},
"nbformat": 4,
"nbformat_minor": 1
}

View File

@ -1,11 +1,3 @@
{
"metadata": {
"name": "",
"signature": "sha256:e3e7c1608702d0a84f35e6fa63112daab968fe74a96ae1f6ee9f39993826a343"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@ -70,8 +62,15 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"input": [
"slideshow": {
"slide_type": "skip"
}
},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"x = np.linspace(0, 3, 10)\n",
@ -79,26 +78,7 @@
"\n",
"print x\n",
"print y"
],
"language": "python",
"metadata": {
"slideshow": {
"slide_type": "skip"
}
},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[ 0. 0.33333333 0.66666667 1. 1.33333333 1.66666667\n",
" 2. 2.33333333 2.66666667 3. ]\n",
"[ 0. 0.11111111 0.44444444 1. 1.77777778 2.77777778\n",
" 4. 5.44444444 7.11111111 9. ]\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "markdown",
@ -117,28 +97,18 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"y_roll_sum = y[:-1] + y[1:]\n",
"print y_roll_sum"
],
"language": "python",
"execution_count": null,
"metadata": {
"collapsed": false,
"slideshow": {
"slide_type": "skip"
}
},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[ 0.11111111 0.55555556 1.44444444 2.77777778 4.55555556\n",
" 6.77777778 9.44444444 12.55555556 16.11111111]\n"
"outputs": [],
"source": [
"y_roll_sum = y[:-1] + y[1:]\n",
"print y_roll_sum"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
@ -155,19 +125,18 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def trapz(x, y):\n",
" return 0.5 * np.sum((x[1:] - x[:-1]) * (y[:-1] + y[1:]))"
],
"language": "python",
"execution_count": null,
"metadata": {
"collapsed": false,
"slideshow": {
"slide_type": "skip"
}
},
"outputs": [],
"prompt_number": 3
"source": [
"def trapz(x, y):\n",
" return 0.5 * np.sum((x[1:] - x[:-1]) * (y[:-1] + y[1:]))"
]
},
{
"cell_type": "markdown",
@ -184,27 +153,17 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"trapz(x, y)"
],
"language": "python",
"execution_count": null,
"metadata": {
"collapsed": false,
"slideshow": {
"slide_type": "skip"
}
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 4,
"text": [
"9.0555555555555554"
"outputs": [],
"source": [
"trapz(x, y)"
]
}
],
"prompt_number": 4
},
{
"cell_type": "markdown",
@ -221,26 +180,17 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print np.trapz(y, x)"
],
"language": "python",
"execution_count": null,
"metadata": {
"collapsed": false,
"slideshow": {
"slide_type": "skip"
}
},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"9.05555555556\n"
"outputs": [],
"source": [
"print np.trapz(y, x)"
]
}
],
"prompt_number": 5
},
{
"cell_type": "markdown",
@ -260,8 +210,15 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"input": [
"slideshow": {
"slide_type": "skip"
}
},
"outputs": [],
"source": [
"def trapzf(f, a, b, npts=100):\n",
" x = np.linspace(a, b, npts)\n",
" y = f(x)\n",
@ -280,26 +237,32 @@
"\n",
"print 'Minimum samples for absolute error less than or equal to 0.0001:', n_samples\n",
" "
]
}
],
"language": "python",
"metadata": {
"slideshow": {
"slide_type": "skip"
"kernelspec": {
"display_name": "Python 3 Sys",
"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+"
},
"widgets": {
"state": {},
"version": "0.3.0"
}
},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Minimum samples for absolute error less than or equal to 0.0001: 214\n"
]
}
],
"prompt_number": 6
}
],
"metadata": {}
}
]
"nbformat": 4,
"nbformat_minor": 1
}