From 4f671b2f15c65d47ace51509310add98e7f40659 Mon Sep 17 00:00:00 2001 From: Banzee Date: Fri, 22 Mar 2019 04:18:19 +0530 Subject: [PATCH 1/2] Removed load_data & save_data functions and tests. --- arviz/data/io_netcdf.py | 57 +--------------------------------------- arviz/tests/test_data.py | 10 ------- 2 files changed, 1 insertion(+), 66 deletions(-) diff --git a/arviz/data/io_netcdf.py b/arviz/data/io_netcdf.py index 642f0be6ee..43083de154 100644 --- a/arviz/data/io_netcdf.py +++ b/arviz/data/io_netcdf.py @@ -1,5 +1,5 @@ """Input and output support for data.""" -import warnings + from .inference_data import InferenceData from .converters import convert_to_inference_data @@ -41,58 +41,3 @@ def to_netcdf(data, filename, *, group="posterior", coords=None, dims=None): inference_data = convert_to_inference_data(data, group=group, coords=coords, dims=dims) file_name = inference_data.to_netcdf(filename) return file_name - - -def load_data(filename): - """Load netcdf file back into an arviz.InferenceData. - - Parameters - ---------- - filename : str - name or path of the file to load trace - - Note - ---- - This function is deprecated and will be removed in 0.4. - Use `from_netcdf` instead. - """ - warnings.warn( - "The 'load_data' function is deprecated as of 0.3.2, use 'from_netcdf' instead", - DeprecationWarning, - ) - return from_netcdf(filename=filename) - - -def save_data(data, filename, *, group="posterior", coords=None, dims=None): - """Save dataset as a netcdf file. - - WARNING: Only idempotent in case `data` is InferenceData - - Parameters - ---------- - data : InferenceData, or any object accepted by `convert_to_inference_data` - Object to be saved - filename : str - name or path of the file to load trace - group : str (optional) - In case `data` is not InferenceData, this is the group it will be saved to - coords : dict (optional) - See `convert_to_inference_data` - dims : dict (optional) - See `convert_to_inference_data` - - Returns - ------- - str - filename saved to - - Note - ---- - This function is deprecated and will be removed in 0.4. - Use `to_netcdf` instead. - """ - warnings.warn( - "The 'save_data' function is deprecated as of 0.3.2, use 'to_netcdf' instead", - DeprecationWarning, - ) - return to_netcdf(data=data, filename=filename, group=group, coords=coords, dims=dims) diff --git a/arviz/tests/test_data.py b/arviz/tests/test_data.py index 5964549760..64b9e48659 100644 --- a/arviz/tests/test_data.py +++ b/arviz/tests/test_data.py @@ -22,8 +22,6 @@ from_netcdf, from_tfp, to_netcdf, - load_data, - save_data, load_arviz_data, list_datasets, clear_data_home, @@ -664,14 +662,6 @@ def test_io_function(self, data, eight_schools_params): assert hasattr(inference_data2, "posterior") os.remove(filepath) assert not os.path.exists(filepath) - # Test deprecated functions - save_data(inference_data, filepath) - assert os.path.exists(filepath) - assert os.path.getsize(filepath) > 0 - inference_data3 = load_data(filepath) - assert hasattr(inference_data3, "posterior") - os.remove(filepath) - assert not os.path.exists(filepath) def test_io_method(self, data, eight_schools_params): inference_data = self.get_inference_data( # pylint: disable=W0612 From 95edd0c0bfa8bd6172ca311d3eabf617480bc377 Mon Sep 17 00:00:00 2001 From: Banzee Date: Fri, 22 Mar 2019 05:05:57 +0530 Subject: [PATCH 2/2] Fixed travis issues. --- arviz/data/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arviz/data/__init__.py b/arviz/data/__init__.py index 85ff4c3145..e3a71602d3 100644 --- a/arviz/data/__init__.py +++ b/arviz/data/__init__.py @@ -1,6 +1,6 @@ """Code for loading and manipulating data structures.""" from .inference_data import InferenceData, concat -from .io_netcdf import from_netcdf, to_netcdf, load_data, save_data +from .io_netcdf import from_netcdf, to_netcdf from .datasets import load_arviz_data, list_datasets, clear_data_home from .base import numpy_to_data_array, dict_to_dataset from .converters import convert_to_dataset, convert_to_inference_data @@ -31,6 +31,4 @@ "from_tfp", "from_netcdf", "to_netcdf", - "load_data", - "save_data", ]