From fcda0359ad7ea335edb3b8ccaa988c0086a31d5b Mon Sep 17 00:00:00 2001 From: rpgoldman Date: Thu, 9 Jan 2020 14:23:16 -0600 Subject: [PATCH 1/5] How do I add a new variable to dataset. --- doc/howdoi.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/howdoi.rst b/doc/howdoi.rst index 80266bd3b84..26389785189 100644 --- a/doc/howdoi.rst +++ b/doc/howdoi.rst @@ -11,6 +11,8 @@ How do I ... * - How do I... - Solution + * - add a DataArray to my dataset as a new variable + - ``my_dataset[varname] = my_dataArray`` * - add variables from other datasets to my dataset - :py:meth:`Dataset.merge` * - add a new dimension and/or coordinate From 8a10a2d3b21b25ffc97bed59cccaaca6a8e6b01e Mon Sep 17 00:00:00 2001 From: rpgoldman Date: Thu, 9 Jan 2020 17:45:42 -0600 Subject: [PATCH 2/5] Update doc/howdoi.rst Improvement from dcherian Co-Authored-By: Deepak Cherian --- doc/howdoi.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/howdoi.rst b/doc/howdoi.rst index 26389785189..cccf807c535 100644 --- a/doc/howdoi.rst +++ b/doc/howdoi.rst @@ -12,7 +12,7 @@ How do I ... * - How do I... - Solution * - add a DataArray to my dataset as a new variable - - ``my_dataset[varname] = my_dataArray`` + - ``my_dataset[varname] = my_dataArray`` or :py:meth:`Dataset.assign` * - add variables from other datasets to my dataset - :py:meth:`Dataset.merge` * - add a new dimension and/or coordinate From 3c6cfaa9b6c8ff7840f42d77774bcc667a22cdae Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Thu, 9 Jan 2020 17:57:06 -0600 Subject: [PATCH 3/5] Add cross-reference per suggestion. --- doc/data-structures.rst | 2 ++ doc/howdoi.rst | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/data-structures.rst b/doc/data-structures.rst index 504d820a234..70e34adabed 100644 --- a/doc/data-structures.rst +++ b/doc/data-structures.rst @@ -353,6 +353,8 @@ setting) variables and attributes: This is particularly useful in an exploratory context, because you can tab-complete these variable names with tools like IPython. +.. _dictionary_like_methods: + Dictionary like methods ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/howdoi.rst b/doc/howdoi.rst index cccf807c535..3bd45da819f 100644 --- a/doc/howdoi.rst +++ b/doc/howdoi.rst @@ -12,7 +12,7 @@ How do I ... * - How do I... - Solution * - add a DataArray to my dataset as a new variable - - ``my_dataset[varname] = my_dataArray`` or :py:meth:`Dataset.assign` + - ``my_dataset[varname] = my_dataArray`` or :py:meth:`Dataset.assign`[#assign_dict]_ * - add variables from other datasets to my dataset - :py:meth:`Dataset.merge` * - add a new dimension and/or coordinate @@ -59,3 +59,7 @@ How do I ... - ``obj.dt.ceil``, ``obj.dt.floor``, ``obj.dt.round``. See :ref:`dt_accessor` for more. * - make a mask that is ``True`` where an object contains any of the values in a array - :py:meth:`Dataset.isin`, :py:meth:`DataArray.isin` + +.. rubric:: Footnotes + +.. [#assign_dict] See also :ref:`_dictionary_like_methods`:. \ No newline at end of file From a830502a630a0241c185fd4326df148325958cf5 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Fri, 10 Jan 2020 11:13:47 -0600 Subject: [PATCH 4/5] Fix cross-reference. --- doc/howdoi.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/howdoi.rst b/doc/howdoi.rst index 3bd45da819f..4308ede8cf6 100644 --- a/doc/howdoi.rst +++ b/doc/howdoi.rst @@ -62,4 +62,4 @@ How do I ... .. rubric:: Footnotes -.. [#assign_dict] See also :ref:`_dictionary_like_methods`:. \ No newline at end of file +.. [#assign_dict] See also :ref:`dictionary_like_methods`:. \ No newline at end of file From 877352d5bf92844060450ab06231219302f9a5fb Mon Sep 17 00:00:00 2001 From: rpgoldman Date: Fri, 10 Jan 2020 13:34:52 -0600 Subject: [PATCH 5/5] Update doc/howdoi.rst Suggestion from keewis Co-Authored-By: keewis --- doc/howdoi.rst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/doc/howdoi.rst b/doc/howdoi.rst index 4308ede8cf6..84c0c786027 100644 --- a/doc/howdoi.rst +++ b/doc/howdoi.rst @@ -12,7 +12,7 @@ How do I ... * - How do I... - Solution * - add a DataArray to my dataset as a new variable - - ``my_dataset[varname] = my_dataArray`` or :py:meth:`Dataset.assign`[#assign_dict]_ + - ``my_dataset[varname] = my_dataArray`` or :py:meth:`Dataset.assign` (see also :ref:`dictionary_like_methods`) * - add variables from other datasets to my dataset - :py:meth:`Dataset.merge` * - add a new dimension and/or coordinate @@ -60,6 +60,3 @@ How do I ... * - make a mask that is ``True`` where an object contains any of the values in a array - :py:meth:`Dataset.isin`, :py:meth:`DataArray.isin` -.. rubric:: Footnotes - -.. [#assign_dict] See also :ref:`dictionary_like_methods`:. \ No newline at end of file