Skip to content
This repository has been archived by the owner on Jan 9, 2020. It is now read-only.

Commit

Permalink
Remove solutions from notebooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrleeman committed Nov 15, 2017
1 parent bfb6d9a commit 6f1ff28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 70 deletions.
51 changes: 3 additions & 48 deletions notebooks/Animation/Creating Animations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -476,52 +476,7 @@
"metadata": {},
"outputs": [],
"source": [
"# %load solutions/animation.py\n",
"from netCDF4 import num2date\n",
"\n",
"# Load data\n",
"cat = TDSCatalog('http://thredds-test.unidata.ucar.edu/thredds/catalog/casestudies/irma/model/gfs/catalog.xml')\n",
"best_ds = cat.datasets['Best GFS Half Degree Forecast Time Series']\n",
"\n",
"# Access the best dataset using the subset service and request data\n",
"ncss = best_ds.subset()\n",
"\n",
"# Set up query\n",
"query = ncss.query().accept('netcdf4')\n",
"query.lonlat_box(west=-90, east=-55, south=15, north=30)\n",
"query.variables('Pressure_surface', 'Wind_speed_gust_surface')\n",
"query.time_range(datetime(2017, 9, 6, 12), datetime(2017, 9, 11, 12))\n",
"\n",
"# Pull useful pieces out of nc\n",
"nc = ncss.get_data(query)\n",
"lon = nc.variables['longitude'][:]\n",
"lat = nc.variables['latitude'][:]\n",
"press = nc.variables['Pressure_surface']\n",
"winds = nc.variables['Wind_speed_gust_surface']\n",
"time_var = nc.variables['time1']\n",
"times = num2date(time_var[:], time_var.units)\n",
"\n",
"# Create a figure for plotting\n",
"proj = ccrs.LambertConformal(central_longitude=-70)\n",
"fig = plt.figure(figsize=(10, 5))\n",
"ax = fig.add_subplot(1, 1, 1, projection=proj)\n",
"ax.coastlines()\n",
"add_metpy_logo(fig, x=15, y=15)\n",
"\n",
"# Setup up the animation, looping over data to do the plotting that we want\n",
"pressure_levels = np.arange(95000, 105000, 800)\n",
"wind_levels = np.arange(0., 100., 10.)\n",
"artists = []\n",
"\n",
"for press_slice, wind_slice, time in zip(press, winds, times):\n",
" press_contour = ax.contour(lon, lat, press_slice, pressure_levels,\n",
" transform=ccrs.PlateCarree(), colors='black')\n",
" wind_contour = ax.contour(lon, lat, wind_slice, wind_levels,\n",
" transform=ccrs.PlateCarree(), colors='blue')\n",
" text = ax.text(0.5, 1.01, time, transform=ax.transAxes, ha='center')\n",
" artists.append(press_contour.collections + wind_contour.collections + [text])\n",
"\n",
"manimation.ArtistAnimation(fig, artists, interval=100)\n"
"# %load solutions/animation.py"
]
},
{
Expand All @@ -535,9 +490,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:unidata-workshop]",
"display_name": "Python 3",
"language": "python",
"name": "conda-env-unidata-workshop-py"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand Down
25 changes: 3 additions & 22 deletions notebooks/CartoPy/CartoPy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -396,34 +396,15 @@
"metadata": {},
"outputs": [],
"source": [
"# %load solutions/map.py\n",
"fig = plt.figure(figsize=(10, 8))\n",
"ax = fig.add_subplot(1, 1, 1, projection=ccrs.Mercator())\n",
"\n",
"ax.add_feature(cfeat.COASTLINE)\n",
"ax.add_feature(cfeat.LAND, facecolor='tab:brown')\n",
"ax.add_feature(cfeat.OCEAN, facecolor='tab:cyan')\n",
"ax.add_feature(cfeat.BORDERS, linewidth=2)\n",
"ax.add_feature(state_borders, linestyle=\"--\", edgecolor='black')\n",
"\n",
"ax.plot(-101.877, 33.583, marker='o', color='tab:green', transform=ccrs.PlateCarree())\n",
"\n",
"ax.set_extent([-108, -93, 25, 37])"
"# %load solutions/map.py"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:unidata-workshop]",
"display_name": "Python 3",
"language": "python",
"name": "conda-env-unidata-workshop-py"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand Down

0 comments on commit 6f1ff28

Please sign in to comment.