Skip to content

Commit

Permalink
Update docstrings for "JFD"
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvothecoder committed May 17, 2022
1 parent 1cffe6d commit da2cf9e
Showing 1 changed file with 33 additions and 36 deletions.
69 changes: 33 additions & 36 deletions xcdat/temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,9 @@ def average(
The mode for the season that includes December.
* "DJF": season includes the previous year December.
* "JFD": season includes the same year December. Xarray
incorrectly labels the season with December as "DJF" when it
should be "JFD". Refer to [1]_ for more information on this
xarray behavior.
* "JFD": season includes the same year December.
Xarray labels the season with December as "DJF", but it is
actually "JFD".
* "drop_incomplete_djf" (bool, by default False)
If the "dec_mode" is "DJF", this flag drops (True) or keeps
Expand Down Expand Up @@ -304,10 +303,9 @@ def group_average(
The mode for the season that includes December.
* "DJF": season includes the previous year December.
* "JFD": season includes the same year December. Xarray
incorrectly labels the season with December as "DJF" when it
should be "JFD". Refer to [1]_ for more information on this
xarray behavior.
* "JFD": season includes the same year December.
Xarray labels the season with December as "DJF", but it is
actually "JFD".
* "drop_incomplete_djf" (bool, by default False)
If the "dec_mode" is "DJF", this flag drops (True) or keeps
Expand Down Expand Up @@ -339,10 +337,6 @@ def group_average(
xr.Dataset
Dataset with the average of a data variable by time group.
References
----------
.. [1] https://github.com/pydata/xarray/issues/810
Examples
--------
Expand Down Expand Up @@ -441,10 +435,9 @@ def climatology(
The mode for the season that includes December.
* "DJF": season includes the previous year December.
* "JFD": season includes the same year December. Xarray
incorrectly labels the season with December as "DJF" when it
should be "JFD". Refer to [2]_ for more information on this
xarray behavior.
* "JFD": season includes the same year December.
Xarray labels the season with December as "DJF", but it is
actually "JFD".
* "drop_incomplete_djf" (bool, by default False)
If the "dec_mode" is "DJF", this flag drops (True) or keeps
Expand Down Expand Up @@ -476,10 +469,6 @@ def climatology(
xr.Dataset
Dataset with the climatology of a data variable.
References
----------
.. [2] https://github.com/pydata/xarray/issues/810
Examples
--------
Expand Down Expand Up @@ -560,9 +549,8 @@ def departures(
xarray's grouped arithmetic operates over each value of the DataArray
corresponding to each grouping label without changing the size of the
DataArra. For example,the original monthly time coordinates are
DataArray. For example,the original monthly time coordinates are
maintained when calculating seasonal departures on monthly data.
Visit [3]_ to learn more about how xarray's grouped arithmetic works.
Parameters
----------
Expand Down Expand Up @@ -599,10 +587,9 @@ def departures(
The mode for the season that includes December.
* "DJF": season includes the previous year December.
* "JFD": season includes the same year December. Xarray
incorrectly labels the season with December as "DJF" when it
should be "JFD". Refer to [4]_ for more information on this
xarray behavior.
* "JFD": season includes the same year December.
Xarray labels the season with December as "DJF", but it is
actually "JFD".
* "drop_incomplete_djf" (bool, by default False)
If the "dec_mode" is "DJF", this flag drops (True) or keeps
Expand Down Expand Up @@ -634,10 +621,13 @@ def departures(
xr.Dataset
The Dataset containing the departures for a data var's climatology.
Notes
-----
Refer to [1]_ to learn more about how xarray's grouped arithmetic works.
References
----------
.. [3] https://xarray.pydata.org/en/stable/user-guide/groupby.html#grouped-arithmetic
.. [4] https://github.com/pydata/xarray/issues/810
.. [1] https://xarray.pydata.org/en/stable/user-guide/groupby.html#grouped-arithmetic
Examples
--------
Expand Down Expand Up @@ -1097,8 +1087,7 @@ def _get_df_dt_components(self, time_coords: xr.DataArray) -> pd.DataFrame:
This method extracts the applicable xarray datetime components from each
time coordinate based on the averaging mode and frequency, and stores
them in a DataFrame. Refer to [5]_ for information on xarray datetime
accessor components.
them in a DataFrame.
Additional processing is performed for the seasonal frequency,
including:
Expand All @@ -1120,9 +1109,13 @@ def _get_df_dt_components(self, time_coords: xr.DataArray) -> pd.DataFrame:
pd.DataFrame
A DataFrame of datetime components.
Notes
-----
Refer to [2]_ for information on xarray datetime accessor components.
References
----------
.. [5] https://xarray.pydata.org/en/stable/user-guide/time-series.html#datetime-components
.. [2] https://xarray.pydata.org/en/stable/user-guide/time-series.html#datetime-components
"""
df = pd.DataFrame()

Expand Down Expand Up @@ -1331,7 +1324,7 @@ def _convert_df_to_dt(self, df: pd.DataFrame) -> np.ndarray:
If the default value of 1 is used for the years, datetime objects
must be created using `cftime.datetime` because year 1 is outside the
Timestamp-valid range. Refer to [6]_ and [7]_ for more information.
Timestamp-valid range.
Parameters
----------
Expand All @@ -1343,11 +1336,15 @@ def _convert_df_to_dt(self, df: pd.DataFrame) -> np.ndarray:
np.ndarray
A numpy ndarray of datetime.datetime or cftime.datetime objects.
Notes
-----
Refer to [3]_ and [4]_ for more information on Timestamp-valid range.
References
----------
.. [6] https://docs.xarray.dev/en/stable/user-guide/weather-climate.html#non-standard-calendars-and-dates-outside-the-timestamp-valid-range
.. [3] https://docs.xarray.dev/en/stable/user-guide/weather-climate.html#non-standard-calendars-and-dates-outside-the-timestamp-valid-range
.. [7] https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timestamp-limitations
.. [4] https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timestamp-limitations
"""
df_new = df.copy()

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

0 comments on commit da2cf9e

Please sign in to comment.