From e183c7a836db98ddd54a70770fa3c4e4c3aea103 Mon Sep 17 00:00:00 2001 From: christophcc <56341319+christophcc@users.noreply.github.com> Date: Wed, 9 Oct 2019 15:22:03 +0200 Subject: [PATCH 1/5] Typo correction in docs (#3387) --- doc/data-structures.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/data-structures.rst b/doc/data-structures.rst index f7b34036a03..d5567f4863e 100644 --- a/doc/data-structures.rst +++ b/doc/data-structures.rst @@ -411,7 +411,7 @@ Any variables using that dimension are dropped: As an alternate to dictionary-like modifications, you can use :py:meth:`~xarray.Dataset.assign` and :py:meth:`~xarray.Dataset.assign_coords`. -These methods return a new dataset with additional (or replaced) or values: +These methods return a new dataset with additional (or replaced) values: .. ipython:: python @@ -420,7 +420,7 @@ These methods return a new dataset with additional (or replaced) or values: There is also the :py:meth:`~xarray.Dataset.pipe` method that allows you to use a method call with an external function (e.g., ``ds.pipe(func)``) instead of simply calling it (e.g., ``func(ds)``). This allows you to write pipelines for -transforming you data (using "method chaining") instead of writing hard to +transforming your data (using "method chaining") instead of writing hard to follow nested function calls: .. ipython:: python From d197c8192b086451882bdcac66147a5099361328 Mon Sep 17 00:00:00 2001 From: Andrew Thomas Date: Tue, 29 Oct 2019 11:36:03 -0400 Subject: [PATCH 2/5] Update terminology.rst (#3455) Fixed broken link --- doc/terminology.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/terminology.rst b/doc/terminology.rst index 138a99740fe..18ede57a4c6 100644 --- a/doc/terminology.rst +++ b/doc/terminology.rst @@ -15,7 +15,7 @@ Terminology ---- -**Variable:** A `NetCDF-like variable `_ consisting of dimensions, data, and attributes which describe a single array. The main functional difference between variables and numpy arrays is that numerical operations on variables implement array broadcasting by dimension name. Each ``DataArray`` has an underlying variable that can be accessed via ``arr.variable``. However, a variable is not fully described outside of either a ``Dataset`` or a ``DataArray``. +**Variable:** A `NetCDF-like variable `_ consisting of dimensions, data, and attributes which describe a single array. The main functional difference between variables and numpy arrays is that numerical operations on variables implement array broadcasting by dimension name. Each ``DataArray`` has an underlying variable that can be accessed via ``arr.variable``. However, a variable is not fully described outside of either a ``Dataset`` or a ``DataArray``. .. note:: @@ -39,4 +39,4 @@ Terminology ---- -**Index:** An *index* is a data structure optimized for efficient selecting and slicing of an associated array. Xarray creates indexes for dimension coordinates so that operations along dimensions are fast, while non-dimension coordinates are not indexed. Under the hood, indexes are implemented as :py:class:`pandas.Index` objects. The index associated with dimension name ``x`` can be retrieved by ``arr.indexes[x]``. By construction, ``len(arr.dims) == len(arr.indexes)`` \ No newline at end of file +**Index:** An *index* is a data structure optimized for efficient selecting and slicing of an associated array. Xarray creates indexes for dimension coordinates so that operations along dimensions are fast, while non-dimension coordinates are not indexed. Under the hood, indexes are implemented as :py:class:`pandas.Index` objects. The index associated with dimension name ``x`` can be retrieved by ``arr.indexes[x]``. By construction, ``len(arr.dims) == len(arr.indexes)`` From 8d50626dfbf123340ad26508180988e5e7ac20b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20LALANDE?= Date: Wed, 30 Oct 2019 10:51:52 +0100 Subject: [PATCH 3/5] Error in leap year? I've tried this script; however, it adds +1 to all months of the leap years. It sounds like an error, or I am wrong? So I wrote the condition "and month == 2" line 86 so that only the month of February gets +1. --- doc/examples/monthly-means.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/examples/monthly-means.rst b/doc/examples/monthly-means.rst index 7cc47eb2847..7d620f1bca3 100644 --- a/doc/examples/monthly-means.rst +++ b/doc/examples/monthly-means.rst @@ -83,7 +83,7 @@ the ``calendar.month_range`` function. for i, (month, year) in enumerate(zip(time.month, time.year)): month_length[i] = cal_days[month] - if leap_year(year, calendar=calendar): + if leap_year(year, calendar=calendar) and month == 2: month_length[i] += 1 return month_length From fea8f61d142dcde4011fd0b5be569e86a485f606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20LALANDE?= Date: Wed, 30 Oct 2019 14:59:24 +0100 Subject: [PATCH 4/5] Fix leap year (pydata#3464) --- doc/whats-new.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 6bcf4b61436..a6dc5ffc365 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -73,7 +73,7 @@ Bug fixes Documentation ~~~~~~~~~~~~~ - +- Fix leap year (http://xarray.pydata.org/en/stable/examples/monthly-means.html) by `Mickaël Lalande `_. - Fix the documentation of :py:meth:`DataArray.resample` and :py:meth:`Dataset.resample` and explicitly state that a datetime-like dimension is required. (:pull:`3400`) From 563f9668f56739085810fafaab87a1817ba6b7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20LALANDE?= Date: Wed, 30 Oct 2019 15:36:41 +0100 Subject: [PATCH 5/5] Update doc/whats-new.rst Co-Authored-By: Deepak Cherian --- doc/whats-new.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index a6dc5ffc365..6c69d8014d9 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -73,7 +73,7 @@ Bug fixes Documentation ~~~~~~~~~~~~~ -- Fix leap year (http://xarray.pydata.org/en/stable/examples/monthly-means.html) by `Mickaël Lalande `_. +- Fix leap year condition in example (http://xarray.pydata.org/en/stable/examples/monthly-means.html) by `Mickaël Lalande `_. - Fix the documentation of :py:meth:`DataArray.resample` and :py:meth:`Dataset.resample` and explicitly state that a datetime-like dimension is required. (:pull:`3400`)