Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cd7b423

Browse files
committedMar 5, 2025·
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent fe39686 commit cd7b423

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed
 

‎fundamentals/01_datatree_imerghh.ipynb

+23-23
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
{
1717
"cell_type": "code",
18-
"execution_count": 1,
18+
"execution_count": null,
1919
"metadata": {},
2020
"outputs": [],
2121
"source": [
@@ -37,9 +37,7 @@
3737
"metadata": {},
3838
"outputs": [],
3939
"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",
4341
"imerghh_730"
4442
]
4543
},
@@ -223,8 +221,7 @@
223221
"metadata": {},
224222
"outputs": [],
225223
"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",
228225
"combined_imerghh_tree"
229226
]
230227
},
@@ -247,11 +244,17 @@
247244
},
248245
{
249246
"cell_type": "code",
250-
"execution_count": 17,
247+
"execution_count": null,
251248
"metadata": {},
252249
"outputs": [],
253250
"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+
")"
255258
]
256259
},
257260
{
@@ -266,7 +269,7 @@
266269
},
267270
{
268271
"cell_type": "code",
269-
"execution_count": 18,
272+
"execution_count": null,
270273
"metadata": {},
271274
"outputs": [],
272275
"source": [
@@ -275,7 +278,8 @@
275278
" & (precip_concat.lat <= 35)\n",
276279
" & (precip_concat.lon >= -110)\n",
277280
" & (precip_concat.lon <= -78),\n",
278-
" drop=True,)"
281+
" drop=True,\n",
282+
")"
279283
]
280284
},
281285
{
@@ -288,7 +292,7 @@
288292
},
289293
{
290294
"cell_type": "code",
291-
"execution_count": 19,
295+
"execution_count": null,
292296
"metadata": {},
293297
"outputs": [],
294298
"source": [
@@ -310,16 +314,18 @@
310314
"outputs": [],
311315
"source": [
312316
"# 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",
314321
" x=\"lon\",\n",
315322
" 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",
318325
" cmap='jet',\n",
319326
" cbar_kwargs={\"orientation\": \"horizontal\", \"pad\": 0.15, \"shrink\": 0.6},\n",
320327
" vmin=precipitation_subset_mask.min(),\n",
321328
" vmax=precipitation_subset_mask.max(),\n",
322-
"\n",
323329
")\n",
324330
"\n",
325331
"\n",
@@ -328,16 +334,11 @@
328334
" ax.coastlines()\n",
329335
" gl = ax.gridlines(linewidth=1, color='black', linestyle='--')\n",
330336
" gl.left_labels = True\n",
331-
" gl.bottom_labels = True\n"
337+
" gl.bottom_labels = True"
332338
]
333339
}
334340
],
335341
"metadata": {
336-
"kernelspec": {
337-
"display_name": "utf-upgrade-datatree",
338-
"language": "python",
339-
"name": "python3"
340-
},
341342
"language_info": {
342343
"codemirror_mode": {
343344
"name": "ipython",
@@ -347,8 +348,7 @@
347348
"mimetype": "text/x-python",
348349
"name": "python",
349350
"nbconvert_exporter": "python",
350-
"pygments_lexer": "ipython3",
351-
"version": "3.12.5"
351+
"pygments_lexer": "ipython3"
352352
}
353353
},
354354
"nbformat": 4,

0 commit comments

Comments
 (0)
Please sign in to comment.