Skip to content

Commit

Permalink
Update add_bounds kwarg default value to True
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvothecoder committed Apr 27, 2022
1 parent 79c488e commit b3631fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
5 changes: 3 additions & 2 deletions tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_non_cf_compliant_time_is_decoded(self):
ds = generate_dataset(cf_compliant=False, has_bounds=False)
ds.to_netcdf(self.file_path)

result = open_dataset(self.file_path, data_var="ts", add_bounds=True)
result = open_dataset(self.file_path, data_var="ts")

# Generate an expected dataset with decoded non-CF compliant time units.
expected = generate_dataset(cf_compliant=True, has_bounds=True)
Expand Down Expand Up @@ -173,7 +173,8 @@ def test_non_cf_compliant_time_is_decoded(self):
ds2.to_netcdf(self.file_path2)

result = open_mfdataset(
[self.file_path1, self.file_path2], data_var="ts", add_bounds=True
[self.file_path1, self.file_path2],
data_var="ts",
)

# Generate an expected dataset, which is a combination of both datasets
Expand Down
16 changes: 9 additions & 7 deletions xcdat/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def open_dataset(
data_var: Optional[str] = None,
decode_times: bool = True,
center_times: bool = False,
add_bounds: bool = False,
add_bounds: bool = True,
lon_orient: Optional[Tuple[float, float]] = None,
**kwargs: Dict[str, Any],
) -> xr.Dataset:
Expand All @@ -44,8 +44,9 @@ def open_dataset(
and lower bounds. Otherwise, use the provided time coordinates, by
default False.
add_bounds: bool, optional
If True, add bounds for supported axes (T, X, Y) if they are missing in
the Dataset, by default False.
If True, add bounds for supported axes (X, Y, T) if they are missing in
the Dataset, by default True. Bounds are required for many xCDAT
features.
lon_orient: Optional[Tuple[float, float]], optional
The orientation to use for the Dataset's longitude axis (if it exists),
by default None.
Expand Down Expand Up @@ -105,7 +106,7 @@ def open_mfdataset(
data_var: Optional[str] = None,
decode_times: bool = True,
center_times: bool = False,
add_bounds: bool = False,
add_bounds: bool = True,
lon_orient: Optional[Tuple[float, float]] = None,
data_vars: Union[Literal["minimal", "different", "all"], List[str]] = "minimal",
preprocess: Optional[Callable] = None,
Expand Down Expand Up @@ -133,8 +134,9 @@ def open_mfdataset(
and lower bounds. Otherwise, use the provided time coordinates, by
default False.
add_bounds: bool, optional
If True, add bounds for supported axes (T, X, Y) if they are missing in
the Dataset, by default False.
If True, add bounds for supported axes (X, Y, T) if they are missing in
the Dataset, by default True. Bounds are required for many xCDAT
features.
lon_orient: Optional[Tuple[float, float]], optional
The orientation to use for the Dataset's longitude axis (if it exists),
by default None.
Expand Down Expand Up @@ -426,7 +428,7 @@ def _postprocess_dataset(
and lower bounds. Otherwise, use the provided time coordinates, by
default False.
add_bounds: bool, optional
If True, add bounds for supported axes (T, X, Y) if they are missing in
If True, add bounds for supported axes (X, Y, T) if they are missing in
the Dataset, by default False.
lon_orient: Optional[Tuple[float, float]], optional
The orientation to use for the Dataset's longitude axis (if it exists),
Expand Down

0 comments on commit b3631fe

Please sign in to comment.