Skip to content

Commit

Permalink
temporarily remove placeholder functions (#29)
Browse files Browse the repository at this point in the history
* remove to_base_units, plus_minus and to_system

* remove placeholder tests and test groups
  • Loading branch information
keewis authored Aug 31, 2020
1 parent 8e20683 commit 8e173c9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 58 deletions.
36 changes: 1 addition & 35 deletions pint_xarray/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
import pint
from pint.quantity import Quantity
from pint.unit import Unit
from xarray import (
DataArray,
Dataset,
register_dataarray_accessor,
register_dataset_accessor,
)
from xarray import DataArray, register_dataarray_accessor, register_dataset_accessor
from xarray.core.npcompat import IS_NEP18_ACTIVE

from . import conversion
Expand Down Expand Up @@ -375,27 +370,6 @@ def to(self, units=None, **unit_kwargs):

return conversion.convert_units(self.da, units)

def to_base_units(self):
quantity = self.da.data.to_base_units()
return DataArray(
dim=self.da.dims,
data=quantity,
coords=self.da.coords,
attrs=self.da.attrs,
encoding=self.da.encoding,
)

# TODO integrate with the uncertainties package here...?
def plus_minus(self, value, error, relative=False):
quantity = self.da.data.plus_minus(value, error, relative)
return DataArray(
dim=self.da.dims,
data=quantity,
coords=self.da.coords,
attrs=self.da.attrs,
encoding=self.da.encoding,
)

def sel(
self, indexers=None, method=None, tolerance=None, drop=False, **indexers_kwargs
):
Expand Down Expand Up @@ -630,14 +604,6 @@ def to(self, units=None, **unit_kwargs):

return conversion.convert_units(self.ds, units)

def to_base_units(self):
base_vars = {name: da.pint.to_base_units() for name, da in self.ds.items()}
return Dataset(base_vars, coords=self.ds.coords, attrs=self.ds.attrs)

# TODO unsure if the upstream capability exists in pint for this yet.
def to_system(self, system):
raise NotImplementedError

def sel(
self, indexers=None, method=None, tolerance=None, drop=False, **indexers_kwargs
):
Expand Down
23 changes: 0 additions & 23 deletions pint_xarray/tests/test_accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,24 +147,6 @@ def example_quantity_ds():
return ds


@pytest.mark.skip(reason="Not yet implemented")
class TestPropertiesDataArray:
def test_units(self):
...


@pytest.mark.skip(reason="Not yet implemented")
class TestConversionDataArray:
def test_units(self):
...


@pytest.mark.skip(reason="Not yet implemented")
class TestUncertainties:
def test_units(self):
...


class TestQuantifyDataSet:
def test_attach_units_from_str(self, example_unitless_ds):
orig = example_unitless_ds
Expand Down Expand Up @@ -242,8 +224,3 @@ def test_roundtrip_data(self, example_unitless_ds):

result = quantified.pint.dequantify().pint.quantify()
assert_equal(quantified, result)


@pytest.mark.skip(reason="Not yet implemented")
class TestIndexing:
...

0 comments on commit 8e173c9

Please sign in to comment.