Skip to content

Commit

Permalink
Streamline resample implementation. Raise error for resample_datastore()
Browse files Browse the repository at this point in the history
  • Loading branch information
bdestombe committed Jul 26, 2023
1 parent 3f80fb0 commit becb88a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Bug fixes

* Single-ended measurements with `fix_alpha` failed due to a bug introduced in v2.0.0 ([#173](https://github.com/dtscalibration/python-dts-calibration/pull/173)).

Removed

* Removed ds.resample_datastore() in favor of using xarray's resample function. See example notebook 2.

2.0.0 (2023-05-24)
------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,20 +282,9 @@
"metadata": {},
"outputs": [],
"source": [
"# We use the logic from xarray to resample. However, it returns an xarray dataset type\n",
"import xarray as xr\n",
"ds_xarray = xr.Dataset(ds).resample(time=\"47S\").mean()\n",
"\n",
"# Therefore we convert it back to the dtscalibration Datastore type.\n",
"# We use the logic from xarray to resample. However, it returns an xarray dataset type. Therefore we convert it back to the dtscalibration Datastore type.\n",
"from dtscalibration import DataStore\n",
"ds_resampled2 = DataStore(ds_xarray)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that the resample function from dtscalibration has been removed in v2.1.0. The above example works versions from before 2.0.1 as well. Starting with version 2.1.0 the `xr.Dataset(ds).resample()` may become `ds.resample()`."
"ds_resampled = DataStore(ds.resample(time=\"47S\").mean())"
]
},
{
Expand Down
5 changes: 5 additions & 0 deletions src/dtscalibration/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -5503,6 +5503,11 @@ def func(a):

return out

def resample_datastore(*args, **kwargs):
raise "ds.resample_datastore() is deprecated. Use " \
"from dtscalibration import DataStore; DataStore(ds.resample()) " \
"instead. See example notebook 2."


class ParameterIndexDoubleEnded:
"""
Expand Down

0 comments on commit becb88a

Please sign in to comment.