Skip to content

Commit

Permalink
Use explicit chunking configuration (#443)
Browse files Browse the repository at this point in the history
### What kind of change does this PR introduce?

* Adds explicit chunking dictionary for cell in notebooks

### Does this PR introduce a breaking change?

No.

### Other information:

This change should be backwards-compatible.
  • Loading branch information
Zeitsperre authored Jan 23, 2025
2 parents 70ee97a + 424656e commit 3a5373b
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions docs/notebooks/03_Extracting_forcing_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"outputs_hidden": false
}
},
"metadata": {},
"outputs": [],
"source": [
"# We will add a wrapper to ensure that the following operations will preserve the original data attributes, such as units and variable names.\n",
Expand All @@ -117,9 +113,14 @@
" ds.sel(time=slice(reference_start_day, reference_stop_day)), basin_contour\n",
" )\n",
" ERA5_tas = ERA5_reference[\"t2m\"].resample(time=\"1D\")\n",
" ERA5_tmin = ERA5_tas.min().chunk(-1, -1, -1)\n",
" ERA5_tmax = ERA5_tas.max().chunk(-1, -1, -1)\n",
" ERA5_pr = ERA5_reference[\"tp\"].resample(time=\"1D\").sum().chunk(-1, -1, -1)\n",
" ERA5_tmin = ERA5_tas.min().chunk({\"latitude\": -1, \"longitude\": -1, \"time\": -1})\n",
" ERA5_tmax = ERA5_tas.max().chunk({\"latitude\": -1, \"longitude\": -1, \"time\": -1})\n",
" ERA5_pr = (\n",
" ERA5_reference[\"tp\"]\n",
" .resample(time=\"1D\")\n",
" .sum()\n",
" .chunk({\"latitude\": -1, \"longitude\": -1, \"time\": -1})\n",
" )\n",
"\n",
"ERA5_pr"
]
Expand Down Expand Up @@ -231,7 +232,7 @@
"metadata": {},
"source": [
"### Here we will write the files to disk in a temporary folder since the root folder containing these notebooks is read-only.\n",
"You can change the path here to your own preferred path in your writable workspace. Alternatively, if you copy this notebook to your writable-workspace as shown in the introduction documentation, you can save just the filename (no absolute path) and the file will appear \"beside\" the notebooks, ready to be read by the next series of notebooks. \n",
"You can change the path here to your own preferred path in your writable workspace. Alternatively, if you copy this notebook to your writable-workspace as shown in the introduction documentation, you can save just the filename (no absolute path) and the file will appear \"beside\" the notebooks, ready to be read by the next series of notebooks.\n",
"\n",
"For this case, you will want to use the second provided option in which all variables are stored in the same netcdf file. This will make the data much easier to find for Raven and prevent some errors, such as if Raven needs to calculate daily average temperature. This will be possible with all variables in the same file, but will cause an error if max and min temperature are in two seperate files."
]
Expand Down

0 comments on commit 3a5373b

Please sign in to comment.