Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvothecoder authored Nov 7, 2022
1 parent f8d42a2 commit 3d8cfc3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion xcdat/bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def add_bounds(self, axis: CFAxisKey, width: float = 0.5) -> xr.Dataset:
meet the following criteria in order to add bounds:
1. The axis for the coordinates are "X", "Y", "T", or "Z"
2. Coordinates are a single dimensional, not multidimensional.
2. Coordinates are single dimensional, not multidimensional.
3. Coordinates are a length > 1 (not singleton)
4. Bounds must not already exist.
* Determined by attempting to map the coordinate variable's
Expand Down
9 changes: 4 additions & 5 deletions xcdat/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def decode_time(dataset: xr.Dataset) -> xr.Dataset: # noqa: C901
Examples
--------
Decode the time coordinates with non-CF units in a Dataset:
Decode the time coordinates in a Dataset:
>>> from xcdat.dataset import decode_time
>>>
Expand Down Expand Up @@ -530,7 +530,7 @@ def _is_decoded(da: xr.DataArray) -> bool:
def _decode_time(da: xr.DataArray) -> xr.Variable:
"""Lazily decodes a DataArray of numerically encoded time with cftime.
The ``xr.DataArray` is converted to an ``xr.Variable`` so that
The ``xr.DataArray`` is converted to an ``xr.Variable`` so that
``xr.coding.variables.lazy_elemwise_func`` can be leveraged to lazily decode
time.
Expand Down Expand Up @@ -559,7 +559,7 @@ def _decode_time(da: xr.DataArray) -> xr.Variable:


def _get_cftime_coords(offsets: np.ndarray, units: str, calendar: str) -> np.ndarray:
"""Get an array of `cftime` coordinates starting from a reference date.
"""Get an array of cftime coordinates starting from a reference date.
This function calls xarray's ``decode_cf_datetime()`` if the units are
CF compliant because ``decode_cf_datetime()`` considers leap days when
Expand All @@ -575,7 +575,6 @@ def _get_cftime_coords(offsets: np.ndarray, units: str, calendar: str) -> np.nda
An array of numerically encoded time offsets from the reference date.
units : str
The time units.
calendar : str
calendar : str
The CF calendar type supported by ``cftime`` . This includes "noleap",
"360_day", "365_day", "366_day", "gregorian", "proleptic_gregorian",
Expand All @@ -584,7 +583,7 @@ def _get_cftime_coords(offsets: np.ndarray, units: str, calendar: str) -> np.nda
Returns
-------
np.ndarray
An array of `cftime` coordinates.
An array of ``cftime`` coordinates.
"""
units_type, ref_date = units.split(" since ")

Expand Down
2 changes: 1 addition & 1 deletion xcdat/temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ def _set_data_var_attrs(self, data_var: str):
except KeyError:
raise KeyError(
f"The 'calendar' encoding attribute is not set on the '{data_var}' "
"time coordinate variable ({self.dim}). This might indicate that the "
f"time coordinate variable ({self.dim}). This might indicate that the "
"time coordinates were not decoded, which is required for temporal "
"averaging operations. "
)
Expand Down

0 comments on commit 3d8cfc3

Please sign in to comment.