Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HISTORY.rst and fix docstrings #139

Merged
merged 1 commit into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 53 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,56 @@
History
=======

0.1.0 (2021-09-30)
------------------
v0.1.0 (7 October, 2021)
------------------------

New Features
~~~~~~~~~~~~

- Add geospatial averaging API through
``DatasetSpatialAverageAccessor`` class by @pochedls and
@tomvothecoder in #87

- Does not support parallelism with Dask yet

- Add wrappers for xarray's ``open_dataset`` and ``open_mfdataset`` to
apply common operations such as:

- If the dataset has a time dimension, decode both CF and non-CF
time units
- Generate bounds for supported coordinates if they don’t exist
- Option to limit the Dataset to a single regular (non-bounds) data
variable while retaining any bounds data variables

- Add ``DatasetBoundsAccessor`` class for filling missing bounds,
returning mapping of bounds, returning names of bounds keys
- Add ``XCDATBoundsAccessor`` class for accessing xcdat public methods
from other accessor classes

- This will be probably be the API endpoint for most users, unless
they prefer importing the individual accessor classes

- Add ability to infer data variables in xcdat APIs based on the
"xcdat_infer" Dataset attr

- This attr is set in ``xcdat.open_dataset()``,
``xcdat_mfdataset()``, or manually

- Utilizes ``cf_xarray`` package
(https://github.com/xarray-contrib/cf-xarray)


Documentation
~~~~~~~~~~~~~

- Visit the docs here:
https://xcdat.readthedocs.io/en/latest/index.html

CI/CD
~~~~~

- 100% code coverage (https://app.codecov.io/gh/XCDAT/xcdat)
- GH Actions for CI/CD build (https://github.com/XCDAT/xcdat/actions)
- Pytest and pytest-cov for test suite

**Full Changelog**: https://github.com/XCDAT/xcdat/commits/v0.1.0
12 changes: 4 additions & 8 deletions xcdat/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,13 @@ def open_dataset(
Keep a single variable in the Dataset:

>>> from xcdat.dataset import open_dataset
>>> ds = open_dataset("file_path", keep_vars="tas")
>>> ds = open_dataset("file_path", data_var="tas")

Keep multiple variables in the Dataset:

>>> from xcdat.dataset import open_dataset
>>> ds = open_dataset("file_path", keep_vars=["ts", "tas"])
>>> ds = open_dataset("file_path", data_var=["ts", "tas"])
"""
# NOTE: Using decode_times=False may add incorrect units for existing time
# bounds (becomes "days since 1970-01-01 00:00:00").
ds = xr.open_dataset(path, decode_times=False, **kwargs)
ds = infer_or_keep_var(ds, data_var)

Expand Down Expand Up @@ -141,15 +139,13 @@ def open_mfdataset(
Keep a single variable in the Dataset:

>>> from xcdat.dataset import open_dataset
>>> ds = open_mfdataset(["file_path1", "file_path2"], keep_vars="tas")
>>> ds = open_mfdataset(["file_path1", "file_path2"], data_var="tas")

Keep multiple variables in the Dataset:

>>> from xcdat.dataset import open_dataset
>>> ds = open_mfdataset(["file_path1", "file_path2"], keep_vars=["ts", "tas"])
>>> ds = open_mfdataset(["file_path1", "file_path2"], data_var=["ts", "tas"])
"""
# NOTE: Using decode_times=False may add incorrect units for existing time
# bounds (becomes "days since 1970-01-01 00:00:00").
ds = xr.open_mfdataset(paths, decode_times=False, **kwargs)
ds = infer_or_keep_var(ds, data_var)

Expand Down
4 changes: 2 additions & 2 deletions xcdat/spatial_avg.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def avg(

Get time series in Nino 3.4 domain:

>>> ts_n34 = ds.spatial.avg("tas", axis=["lat", "lon"],
>>> ts_n34 = ds.spatial.avg("ts", axis=["lat", "lon"],
>>> lat_bounds=(-5, 5),
>>> lon_bounds=(-170, -120))["tas"]
>>> lon_bounds=(-170, -120))["ts"]
tomvothecoder marked this conversation as resolved.
Show resolved Hide resolved

Get zonal mean time series:

Expand Down