Skip to content
Snippets Groups Projects
Commit e611f521 authored by Martin Lange's avatar Martin Lange
Browse files

Merge branch 'optimize-units' into 'main'

Optimize unit checks

See merge request !228
parents 16a5dd38 c73f1b52
No related branches found
No related tags found
1 merge request!228Optimize unit checks
Pipeline #133672 passed with stages
in 6 minutes and 35 seconds
......@@ -87,7 +87,6 @@ def to_xarray(data, name, info, time_entries=1, force_copy=False):
name=name,
info=info,
overwrite_name=True,
check_units_equivalent=False,
)
if equivalent_units(info.units, data):
if force_copy:
......@@ -383,7 +382,6 @@ def check(
name,
info,
overwrite_name=False,
check_units_equivalent=True,
):
"""
Check if data matches given info.
......@@ -398,8 +396,6 @@ def check(
Info associated with the data.
overwrite_name : bool
Overwrites the name in the data instead of comparing both names
check_units_equivalent : bool
Check equivalence of data and info units.
Raises
------
......@@ -443,11 +439,6 @@ def check(
f"check: given data has incompatible units. "
f"Got {get_units(xdata)}, expected {units}."
)
if check_units_equivalent and not equivalent_units(units, xdata):
raise FinamDataError(
f"check: given data has non-equivalent units. "
f"Got {get_units(xdata)}, expected {units}."
)
def _check_shape(xdata, grid):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment