|
15 | 15 | },
|
16 | 16 | {
|
17 | 17 | "cell_type": "code",
|
18 |
| - "execution_count": 1, |
| 18 | + "execution_count": null, |
19 | 19 | "metadata": {},
|
20 | 20 | "outputs": [],
|
21 | 21 | "source": [
|
|
37 | 37 | "metadata": {},
|
38 | 38 | "outputs": [],
|
39 | 39 | "source": [
|
40 |
| - "imerghh_730 = xr.open_datatree(\n", |
41 |
| - " '~/xarray-data/imerghh_730.hdf5', engine='h5netcdf'\n", |
42 |
| - ")\n", |
| 40 | + "imerghh_730 = xr.open_datatree('~/xarray-data/imerghh_730.hdf5', engine='h5netcdf')\n", |
43 | 41 | "imerghh_730"
|
44 | 42 | ]
|
45 | 43 | },
|
|
223 | 221 | "metadata": {},
|
224 | 222 | "outputs": [],
|
225 | 223 | "source": [
|
226 |
| - "combined_imerghh_tree = xr.DataTree.from_dict({'time_730': imerghh_730,\n", |
227 |
| - " 'time_830': imerghh_830})\n", |
| 224 | + "combined_imerghh_tree = xr.DataTree.from_dict({'time_730': imerghh_730, 'time_830': imerghh_830})\n", |
228 | 225 | "combined_imerghh_tree"
|
229 | 226 | ]
|
230 | 227 | },
|
|
247 | 244 | },
|
248 | 245 | {
|
249 | 246 | "cell_type": "code",
|
250 |
| - "execution_count": 17, |
| 247 | + "execution_count": null, |
251 | 248 | "metadata": {},
|
252 | 249 | "outputs": [],
|
253 | 250 | "source": [
|
254 |
| - "precip_concat = xr.concat([combined_imerghh_tree['time_730/Grid/precipitation'], combined_imerghh_tree['time_830/Grid/precipitation']], dim='time')" |
| 251 | + "precip_concat = xr.concat(\n", |
| 252 | + " [\n", |
| 253 | + " combined_imerghh_tree['time_730/Grid/precipitation'],\n", |
| 254 | + " combined_imerghh_tree['time_830/Grid/precipitation'],\n", |
| 255 | + " ],\n", |
| 256 | + " dim='time',\n", |
| 257 | + ")" |
255 | 258 | ]
|
256 | 259 | },
|
257 | 260 | {
|
|
266 | 269 | },
|
267 | 270 | {
|
268 | 271 | "cell_type": "code",
|
269 |
| - "execution_count": 18, |
| 272 | + "execution_count": null, |
270 | 273 | "metadata": {},
|
271 | 274 | "outputs": [],
|
272 | 275 | "source": [
|
|
275 | 278 | " & (precip_concat.lat <= 35)\n",
|
276 | 279 | " & (precip_concat.lon >= -110)\n",
|
277 | 280 | " & (precip_concat.lon <= -78),\n",
|
278 |
| - " drop=True,)" |
| 281 | + " drop=True,\n", |
| 282 | + ")" |
279 | 283 | ]
|
280 | 284 | },
|
281 | 285 | {
|
|
288 | 292 | },
|
289 | 293 | {
|
290 | 294 | "cell_type": "code",
|
291 |
| - "execution_count": 19, |
| 295 | + "execution_count": null, |
292 | 296 | "metadata": {},
|
293 | 297 | "outputs": [],
|
294 | 298 | "source": [
|
|
310 | 314 | "outputs": [],
|
311 | 315 | "source": [
|
312 | 316 | "# Plot the precipitation data\n",
|
313 |
| - "precip_plot = precipitation_subset_mask.plot(figsize=(12, 6), transform=ccrs.PlateCarree(), subplot_kws={'projection':ccrs.PlateCarree()},\n", |
| 317 | + "precip_plot = precipitation_subset_mask.plot(\n", |
| 318 | + " figsize=(12, 6),\n", |
| 319 | + " transform=ccrs.PlateCarree(),\n", |
| 320 | + " subplot_kws={'projection': ccrs.PlateCarree()},\n", |
314 | 321 | " x=\"lon\",\n",
|
315 | 322 | " y=\"lat\",\n",
|
316 |
| - " col='time', # The dimension (\"time\") we are faceting our plot on\n", |
317 |
| - " col_wrap=2, # Number of subplots\n", |
| 323 | + " col='time', # The dimension (\"time\") we are faceting our plot on\n", |
| 324 | + " col_wrap=2, # Number of subplots\n", |
318 | 325 | " cmap='jet',\n",
|
319 | 326 | " cbar_kwargs={\"orientation\": \"horizontal\", \"pad\": 0.15, \"shrink\": 0.6},\n",
|
320 | 327 | " vmin=precipitation_subset_mask.min(),\n",
|
321 | 328 | " vmax=precipitation_subset_mask.max(),\n",
|
322 |
| - "\n", |
323 | 329 | ")\n",
|
324 | 330 | "\n",
|
325 | 331 | "\n",
|
|
328 | 334 | " ax.coastlines()\n",
|
329 | 335 | " gl = ax.gridlines(linewidth=1, color='black', linestyle='--')\n",
|
330 | 336 | " gl.left_labels = True\n",
|
331 |
| - " gl.bottom_labels = True\n" |
| 337 | + " gl.bottom_labels = True" |
332 | 338 | ]
|
333 | 339 | }
|
334 | 340 | ],
|
335 | 341 | "metadata": {
|
336 |
| - "kernelspec": { |
337 |
| - "display_name": "utf-upgrade-datatree", |
338 |
| - "language": "python", |
339 |
| - "name": "python3" |
340 |
| - }, |
341 | 342 | "language_info": {
|
342 | 343 | "codemirror_mode": {
|
343 | 344 | "name": "ipython",
|
|
347 | 348 | "mimetype": "text/x-python",
|
348 | 349 | "name": "python",
|
349 | 350 | "nbconvert_exporter": "python",
|
350 |
| - "pygments_lexer": "ipython3", |
351 |
| - "version": "3.12.5" |
| 351 | + "pygments_lexer": "ipython3" |
352 | 352 | }
|
353 | 353 | },
|
354 | 354 | "nbformat": 4,
|
|
0 commit comments