Skip to content

Commit

Permalink
adjust tests to new xarray cfscale return dtype algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
observingClouds committed Apr 6, 2024
1 parent c7a8c6a commit e3198e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions tests/test_bitround.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_bitround_along_dim(air_temperature):
ds, info_per_bit, dim="lon", inflevels=[1.0, 0.9999, 0.99, 0.975]
)

assert ds_bitrounded_along_lon.air.dtype == "float32"
assert ds_bitrounded_along_lon.air.dtype == "float64"
assert ds_bitrounded_along_lon.lon.size == ds.lon.size
assert ds_bitrounded_along_lon.lat.size == ds.lat.size
assert ds_bitrounded_along_lon.time.size == ds.time.size
Expand All @@ -99,7 +99,7 @@ def test_bitround_along_dim(air_temperature):
ds, info_per_bit, dim="lon", inflevels=None, keepbits=2
)

assert ds_bitrounded_along_lon.air.dtype == "float32"
assert ds_bitrounded_along_lon.air.dtype == "float64"
assert ds_bitrounded_along_lon.lon.size == ds.lon.size
assert ds_bitrounded_along_lon.lat.size == ds.lat.size
assert ds_bitrounded_along_lon.time.size == ds.time.size
Expand Down
20 changes: 10 additions & 10 deletions xbitinfo/xbitinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ def get_bitinformation( # noqa: C901
-------
>>> ds = xr.tutorial.load_dataset("air_temperature")
>>> xb.get_bitinformation(ds, dim="lon") # doctest: +ELLIPSIS
<xarray.Dataset> Size: 652B
Dimensions: (bitfloat32: 32)
<xarray.Dataset> Size: 1kB
Dimensions: (bitfloat64: 64)
Coordinates:
* bitfloat32 (bitfloat32) <U3 384B '±' 'e1' 'e2' 'e3' ... 'm21' 'm22' 'm23'
* bitfloat64 (bitfloat64) <U3 768B '±' 'e1' 'e2' 'e3' ... 'm50' 'm51' 'm52'
dim <U3 12B 'lon'
Data variables:
air (bitfloat32) float64 256B 0.0 0.0 0.0 ... 3.953e-05 0.0006889
air (bitfloat64) float64 512B 0.0 0.0 0.0 ... 0.002847 0.0 0.0005092
Attributes:
xbitinfo_description: bitinformation calculated by xbitinfo.get_bit...
python_repository: https://github.com/observingClouds/xbitinfo
Expand All @@ -167,13 +167,13 @@ def get_bitinformation( # noqa: C901
xbitinfo_version: ...
BitInformation.jl_version: ...
>>> xb.get_bitinformation(ds)
<xarray.Dataset> Size: 1kB
Dimensions: (bitfloat32: 32, dim: 3)
<xarray.Dataset> Size: 2kB
Dimensions: (bitfloat64: 64, dim: 3)
Coordinates:
* bitfloat32 (bitfloat32) <U3 384B '±' 'e1' 'e2' 'e3' ... 'm21' 'm22' 'm23'
* bitfloat64 (bitfloat64) <U3 768B '±' 'e1' 'e2' 'e3' ... 'm50' 'm51' 'm52'
* dim (dim) <U4 48B 'lat' 'lon' 'time'
Data variables:
air (dim, bitfloat32) float64 768B 0.0 0.0 ... 6.327e-06 0.0004285
air (dim, bitfloat64) float64 2kB 0.0 0.0 0.0 ... 0.0 0.0004498
Attributes:
xbitinfo_description: bitinformation calculated by xbitinfo.get_bit...
python_repository: https://github.com/observingClouds/xbitinfo
Expand Down Expand Up @@ -411,15 +411,15 @@ def get_keepbits(info_per_bit, inflevel=0.99):
dim <U3 12B 'lon'
* inflevel (inflevel) float64 8B 0.99
Data variables:
air (inflevel) int64 8B 7
air (inflevel) int64 8B 6
>>> xb.get_keepbits(info_per_bit, inflevel=0.99999999)
<xarray.Dataset> Size: 28B
Dimensions: (inflevel: 1)
Coordinates:
dim <U3 12B 'lon'
* inflevel (inflevel) float64 8B 1.0
Data variables:
air (inflevel) int64 8B 14
air (inflevel) int64 8B 7
>>> xb.get_keepbits(info_per_bit, inflevel=1.0)
<xarray.Dataset> Size: 28B
Dimensions: (inflevel: 1)
Expand Down

0 comments on commit e3198e5

Please sign in to comment.