Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions docs/notebooks/usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Xclim also allows to call indicators using datasets and variable names."
"Some indicators also expose time-selection arguments as `**indexer` keywords. This allows to run the indice on a subset of the time coordinates, for example only on a specific season, month, or between two dates in every year. It relies on the [select_time](../indices.rst#xclim.indices.generic.select_time) function. Some indicators will simply select the time period and run the calculations, while others will smartly perform the selection at the right time, when the order of operation makes a difference. All will pass the `indexer` kwargs to the missing value handling ensuring that the missing values _outside_ the valid time period are **not** considered.\n",
"\n",
"The next example computes the annual sum of growing degree days over 10 °C, but only considering days from the 1st of April to the 30th of September."
]
},
{
Expand All @@ -183,23 +185,16 @@
"source": [
"with xclim.set_options(cf_compliance=\"log\"):\n",
" gdd = xclim.atmos.growing_degree_days(\n",
" tas=\"air\", thresh=\"10.0 degC\", freq=\"MS\", ds=daily_ds\n",
" tas=daily_ds.air, thresh=\"10 degC\", freq=\"YS\", date_bounds=(\"04-01\", \"09-30\")\n",
" )\n",
"\n",
" # variable names default to xclim names, so we can even do this:\n",
" renamed_daily_ds = daily_ds.rename(air=\"tas\")\n",
" gdd = xclim.atmos.growing_degree_days(\n",
" thresh=\"10.0 degC\", freq=\"MS\", ds=renamed_daily_ds\n",
" )"
"gdd"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Finally, some indicators also expose time-selection arguments as `**indexer` keywords. This allows to run the indice on a subset of the time coordinates, for example only on a specific season, month, or between two dates in every year. It relies on the [select_time](../indices.rst#xclim.indices.generic.select_time) function. Some indicators will simply select the time period and run the calculations, while others will smartly perform the selection at the right time, when the order of operation makes a difference. All will pass the `indexer` kwargs to the missing value handling ensuring that the missing values _outside_ the valid time period are **not** considered.\n",
"\n",
"The next example computes the annual sum of growing degree days over 10 °C, but only considering days from the 1st of April to the 30th of September."
"Finally, xclim also allows to call indicators using datasets and variable names."
]
},
{
Expand All @@ -210,9 +205,14 @@
"source": [
"with xclim.set_options(cf_compliance=\"log\"):\n",
" gdd = xclim.atmos.growing_degree_days(\n",
" tas=daily_ds.air, thresh=\"10 degC\", freq=\"YS\", date_bounds=(\"04-01\", \"09-30\")\n",
" tas=\"air\", thresh=\"10.0 degC\", freq=\"MS\", ds=daily_ds\n",
" )\n",
"gdd"
"\n",
" # variable names default to xclim names, so we can even do this:\n",
" renamed_daily_ds = daily_ds.rename(air=\"tas\")\n",
" gdd = xclim.atmos.growing_degree_days(\n",
" thresh=\"10.0 degC\", freq=\"MS\", ds=renamed_daily_ds\n",
" )"
]
},
{
Expand Down Expand Up @@ -303,7 +303,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down