Skip to content

Commit da2cf9e

Browse files
committed
Update docstrings for "JFD"
1 parent 1cffe6d commit da2cf9e

File tree

1 file changed

+33
-36
lines changed

1 file changed

+33
-36
lines changed

xcdat/temporal.py

+33-36
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,9 @@ def average(
210210
The mode for the season that includes December.
211211
212212
* "DJF": season includes the previous year December.
213-
* "JFD": season includes the same year December. Xarray
214-
incorrectly labels the season with December as "DJF" when it
215-
should be "JFD". Refer to [1]_ for more information on this
216-
xarray behavior.
213+
* "JFD": season includes the same year December.
214+
Xarray labels the season with December as "DJF", but it is
215+
actually "JFD".
217216
218217
* "drop_incomplete_djf" (bool, by default False)
219218
If the "dec_mode" is "DJF", this flag drops (True) or keeps
@@ -304,10 +303,9 @@ def group_average(
304303
The mode for the season that includes December.
305304
306305
* "DJF": season includes the previous year December.
307-
* "JFD": season includes the same year December. Xarray
308-
incorrectly labels the season with December as "DJF" when it
309-
should be "JFD". Refer to [1]_ for more information on this
310-
xarray behavior.
306+
* "JFD": season includes the same year December.
307+
Xarray labels the season with December as "DJF", but it is
308+
actually "JFD".
311309
312310
* "drop_incomplete_djf" (bool, by default False)
313311
If the "dec_mode" is "DJF", this flag drops (True) or keeps
@@ -339,10 +337,6 @@ def group_average(
339337
xr.Dataset
340338
Dataset with the average of a data variable by time group.
341339
342-
References
343-
----------
344-
.. [1] https://github.com/pydata/xarray/issues/810
345-
346340
Examples
347341
--------
348342
@@ -441,10 +435,9 @@ def climatology(
441435
The mode for the season that includes December.
442436
443437
* "DJF": season includes the previous year December.
444-
* "JFD": season includes the same year December. Xarray
445-
incorrectly labels the season with December as "DJF" when it
446-
should be "JFD". Refer to [2]_ for more information on this
447-
xarray behavior.
438+
* "JFD": season includes the same year December.
439+
Xarray labels the season with December as "DJF", but it is
440+
actually "JFD".
448441
449442
* "drop_incomplete_djf" (bool, by default False)
450443
If the "dec_mode" is "DJF", this flag drops (True) or keeps
@@ -476,10 +469,6 @@ def climatology(
476469
xr.Dataset
477470
Dataset with the climatology of a data variable.
478471
479-
References
480-
----------
481-
.. [2] https://github.com/pydata/xarray/issues/810
482-
483472
Examples
484473
--------
485474
@@ -560,9 +549,8 @@ def departures(
560549
561550
xarray's grouped arithmetic operates over each value of the DataArray
562551
corresponding to each grouping label without changing the size of the
563-
DataArra. For example,the original monthly time coordinates are
552+
DataArray. For example,the original monthly time coordinates are
564553
maintained when calculating seasonal departures on monthly data.
565-
Visit [3]_ to learn more about how xarray's grouped arithmetic works.
566554
567555
Parameters
568556
----------
@@ -599,10 +587,9 @@ def departures(
599587
The mode for the season that includes December.
600588
601589
* "DJF": season includes the previous year December.
602-
* "JFD": season includes the same year December. Xarray
603-
incorrectly labels the season with December as "DJF" when it
604-
should be "JFD". Refer to [4]_ for more information on this
605-
xarray behavior.
590+
* "JFD": season includes the same year December.
591+
Xarray labels the season with December as "DJF", but it is
592+
actually "JFD".
606593
607594
* "drop_incomplete_djf" (bool, by default False)
608595
If the "dec_mode" is "DJF", this flag drops (True) or keeps
@@ -634,10 +621,13 @@ def departures(
634621
xr.Dataset
635622
The Dataset containing the departures for a data var's climatology.
636623
624+
Notes
625+
-----
626+
Refer to [1]_ to learn more about how xarray's grouped arithmetic works.
627+
637628
References
638629
----------
639-
.. [3] https://xarray.pydata.org/en/stable/user-guide/groupby.html#grouped-arithmetic
640-
.. [4] https://github.com/pydata/xarray/issues/810
630+
.. [1] https://xarray.pydata.org/en/stable/user-guide/groupby.html#grouped-arithmetic
641631
642632
Examples
643633
--------
@@ -1097,8 +1087,7 @@ def _get_df_dt_components(self, time_coords: xr.DataArray) -> pd.DataFrame:
10971087
10981088
This method extracts the applicable xarray datetime components from each
10991089
time coordinate based on the averaging mode and frequency, and stores
1100-
them in a DataFrame. Refer to [5]_ for information on xarray datetime
1101-
accessor components.
1090+
them in a DataFrame.
11021091
11031092
Additional processing is performed for the seasonal frequency,
11041093
including:
@@ -1120,9 +1109,13 @@ def _get_df_dt_components(self, time_coords: xr.DataArray) -> pd.DataFrame:
11201109
pd.DataFrame
11211110
A DataFrame of datetime components.
11221111
1112+
Notes
1113+
-----
1114+
Refer to [2]_ for information on xarray datetime accessor components.
1115+
11231116
References
11241117
----------
1125-
.. [5] https://xarray.pydata.org/en/stable/user-guide/time-series.html#datetime-components
1118+
.. [2] https://xarray.pydata.org/en/stable/user-guide/time-series.html#datetime-components
11261119
"""
11271120
df = pd.DataFrame()
11281121

@@ -1331,7 +1324,7 @@ def _convert_df_to_dt(self, df: pd.DataFrame) -> np.ndarray:
13311324
13321325
If the default value of 1 is used for the years, datetime objects
13331326
must be created using `cftime.datetime` because year 1 is outside the
1334-
Timestamp-valid range. Refer to [6]_ and [7]_ for more information.
1327+
Timestamp-valid range.
13351328
13361329
Parameters
13371330
----------
@@ -1343,11 +1336,15 @@ def _convert_df_to_dt(self, df: pd.DataFrame) -> np.ndarray:
13431336
np.ndarray
13441337
A numpy ndarray of datetime.datetime or cftime.datetime objects.
13451338
1339+
Notes
1340+
-----
1341+
Refer to [3]_ and [4]_ for more information on Timestamp-valid range.
1342+
13461343
References
13471344
----------
1348-
.. [6] https://docs.xarray.dev/en/stable/user-guide/weather-climate.html#non-standard-calendars-and-dates-outside-the-timestamp-valid-range
1345+
.. [3] https://docs.xarray.dev/en/stable/user-guide/weather-climate.html#non-standard-calendars-and-dates-outside-the-timestamp-valid-range
13491346
1350-
.. [7] https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timestamp-limitations
1347+
.. [4] https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timestamp-limitations
13511348
"""
13521349
df_new = df.copy()
13531350

@@ -1394,11 +1391,11 @@ def _get_weights(self) -> xr.DataArray:
13941391
13951392
Notes
13961393
-----
1397-
Refer to [8]_ for the supported CF convention calendar types.
1394+
Refer to [5]_ for the supported CF convention calendar types.
13981395
13991396
References
14001397
----------
1401-
.. [8] https://cfconventions.org/cf-conventions/cf-conventions.html#calendar
1398+
.. [5] https://cfconventions.org/cf-conventions/cf-conventions.html#calendar
14021399
"""
14031400
# FIXME: This takes awhile ~1.5-2.2 seconds, not sure if there is a way
14041401
# around this because this is a vectorized operation already (to my

0 commit comments

Comments
 (0)