Skip to content

Commit

Permalink
Updated notebooks 2_getting_started and 6_config with associated temp…
Browse files Browse the repository at this point in the history
…lates/1-basic_workflow_with_config/config1.yml
  • Loading branch information
vindelico committed Dec 2, 2023
1 parent e2277dd commit ac206a3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
12 changes: 5 additions & 7 deletions docs/notebooks/2_getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1020,20 +1020,18 @@
"\n",
"**NOTE:** The aggregation is over *year*, __*not* over *time*__. For example, if given monthly data, the climatological operation will be computed separately for January, February, etc. This means that the data should already be aggregated at the required frequency, for example using `xs.compute_indicators` to compute yearly, seasonal, or monthly indicators.\n",
"\n",
"The function requires the following arguments:\n",
"- `ds` is the *xr.Dataset* containing the data.\n",
"- `op` is the operation to perform. It can be any of the following: ['max', 'mean', 'median', 'min', 'std', 'sum', 'var', 'linregress']\n",
"\n",
"In the following example, we will use `op='mean'`.\n",
"The function call requires a `xr.Dataset` and argument `op` specifies the operation to perform. It can be any of the following:\n",
"`['max', 'mean', 'median', 'min', 'std', 'sum', 'var', 'linregress']`.\n",
"\n",
"The optional arguments are as follow:\n",
"\n",
"- `window` indicates how many year to use for the average. Uses all available years by default.\n",
"- `min_period` minimum number of years required for a value to be computed durring the `rolling` operation.\n",
"- `stride` indicates the stride (in years) at which to provide an output.\n",
"- `periods` is a list of [start, end] of continuous periods to be considered.\n",
"\n",
"Additional arguments allow to control the output of the function by automatically renaming variables to reflect the operation performed, restructuring the output dataset and setting the `to_level` attribute."
"Additional arguments allow to control the output of the function by automatically renaming variables to reflect the operation performed, restructuring the output dataset and setting the `to_level` attribute.\n",
"\n",
"In the following example, we will use `op='mean'`."
]
},
{
Expand Down
17 changes: 11 additions & 6 deletions docs/notebooks/6_config.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
"xs.load_config(\n",
" str(\n",
" Path().absolute().parent.parent\n",
" / \"home\"\n",
" / \"braun\"\n",
" / \"python\"\n",
" / \"github\"\n",
" / \"xscen\"\n",
" / \"templates\"\n",
" / \"1-basic_workflow_with_config\"\n",
" / \"config1.yml\"\n",
Expand Down Expand Up @@ -248,7 +253,7 @@
"id": "85b36803-29b8-4993-add3-3c69e4e4a750",
"metadata": {},
"source": [
"Let's test that it is working, using `climatological_mean`:"
"Let's test that it is working, using `climatological_op`:"
]
},
{
Expand All @@ -261,7 +266,7 @@
"outputs": [],
"source": [
"# We should obtain 30-year means separated in 10-year intervals.\n",
"CONFIG[\"aggregate\"][\"climatological_mean\"]"
"CONFIG[\"aggregate\"][\"climatological_op\"]"
]
},
{
Expand All @@ -282,8 +287,8 @@
"da.name = \"test\"\n",
"ds = da.to_dataset()\n",
"\n",
"# Call climatological_mean using no argument other than what's in CONFIG\n",
"print(xs.climatological_mean(ds))"
"# Call climatological_op using no argument other than what's in CONFIG\n",
"print(xs.climatological_op(ds))"
]
},
{
Expand Down Expand Up @@ -369,9 +374,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "obsflow",
"language": "python",
"name": "python3"
"name": "obsflow"
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 3 additions & 1 deletion templates/1-basic_workflow_with_config/config1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,13 @@ aggregate:
processing_level: indicators
delta:
processing_level: climatology
climatological_mean: # automatically passed to the function
climatological_op: # automatically passed to the function
op: mean
window: 30
interval: 10
periods: [['1951', '2100']]
to_level: climatology
#periods_as_dim: True
#min_periods:
compute_deltas: # automatically passed to the function
kind: "+"
Expand Down

0 comments on commit ac206a3

Please sign in to comment.