Skip to content

Commit 340d080

Browse files
committed
remove the mask and add attrs to root
1 parent 63f19e2 commit 340d080

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

intermediate/hierarchical_computation.ipynb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,18 @@
4545
"source": [
4646
"ds = xr.tutorial.open_dataset(\"air_temperature\")\n",
4747
"\n",
48-
"ds_daily = (\n",
49-
" ds.resample(time=\"D\").mean(\"time\").assign(mask=lambda ds: ds[\"air\"].isel(time=0) >= 293.15)\n",
50-
")\n",
51-
"ds_weekly = (\n",
52-
" ds.resample(time=\"W\").mean(\"time\").assign(mask=lambda ds: ds[\"air\"].isel(time=0) >= 293.15)\n",
53-
")\n",
54-
"ds_monthly = (\n",
55-
" ds.resample(time=\"ME\").mean(\"time\").assign(mask=lambda ds: ds[\"air\"].isel(time=0) >= 293.15)\n",
56-
")\n",
48+
"ds_daily = ds.resample(time=\"D\").mean(\"time\")\n",
49+
"ds_weekly = ds.resample(time=\"W\").mean(\"time\")\n",
50+
"ds_monthly = ds.resample(time=\"ME\").mean(\"time\")\n",
5751
"\n",
58-
"tree = xr.DataTree.from_dict({\"daily\": ds_daily, \"weekly\": ds_weekly, \"monthly\": ds_monthly})\n",
52+
"tree = xr.DataTree.from_dict(\n",
53+
" {\n",
54+
" \"daily\": ds_daily,\n",
55+
" \"weekly\": ds_weekly,\n",
56+
" \"monthly\": ds_monthly,\n",
57+
" \"\": xr.Dataset(attrs={\"name\": \"NMC reanalysis temporal pyramid\"}),\n",
58+
" }\n",
59+
")\n",
5960
"tree"
6061
]
6162
},

0 commit comments

Comments
 (0)