Skip to content

Commit

Permalink
Fix warnings (#485)
Browse files Browse the repository at this point in the history
* Capture warnings in first test

* Fix remaining warnings in test_transformations.py

* Try to bust last remaining warning

* Somehow this works

* Update setup.cfg

* ignore traittypes

* update conda build pytest config

Co-authored-by: Cagtay Fabry <43667554+CagtayFabry@users.noreply.github.com>
  • Loading branch information
vhirtham and CagtayFabry authored Aug 18, 2021
1 parent 5b6a744 commit 914a2d4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion devtools/conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test:
commands:
- pip check
- welding_schema --help
- pytest --pyargs weldx.tests -n auto --dist=loadfile
- pytest --pyargs weldx.tests -n auto --dist=loadfile --tb=short --color=yes

about:
home: https://www.bam.de/Content/EN/Projects/WelDX/weldx.html
Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ asdf_schema_root = weldx/schemas
#asdf_schema_skip_tests =
# weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.schema.yaml
norecursedirs = doc
filterwarnings =
ignore::DeprecationWarning:traittypes.*:

[isort]
profile = black
Expand Down Expand Up @@ -154,4 +156,4 @@ ignore_errors = True
# and https://github.com/space-physics/msise00/commit/8b59a9383dd6fcc54b7dac74eb95a350308d7b62
[mypy-xarray]
follow_imports = skip
ignore_errors = True
ignore_errors = True
9 changes: 6 additions & 3 deletions weldx/tests/test_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,11 @@ def test_init_expr_time_series_as_coord(time, time_ref, angles):
orientation = None
if angles is not None:
orientation = WXRotation.from_euler("x", angles, degrees=True).as_matrix()
lcs = LCS(
orientation=orientation, coordinates=ts_coord, time=time, time_ref=time_ref
)
if orientation is None and time is not None:
with pytest.warns(UserWarning):
lcs = LCS(orientation, ts_coord, time, time_ref)
else:
lcs = LCS(orientation, ts_coord, time, time_ref)
assert lcs.has_reference_time == (time_ref is not None)

# test_init_discrete_time_series_as_coord ------------------------------------------
Expand Down Expand Up @@ -1038,6 +1040,7 @@ def test_interp_time_discrete_outside_value_range_both_sides():
]
),
)
@pytest.mark.filterwarnings("ignore:Provided time is dropped")
def test_interp_time_timeseries_as_coords(
seconds: List[float],
lcs_ref_sec: float,
Expand Down
13 changes: 9 additions & 4 deletions weldx/transformations/local_cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ def __init__(
Cartesian coordinate system
"""
time = self._build_time(coordinates, time, time_ref)
orientation = self._build_orientation(orientation, time)
coordinates = self._build_coordinates(coordinates, time)
time_cls = self._build_time(coordinates, time, time_ref)
orientation = self._build_orientation(orientation, time_cls)
coordinates = self._build_coordinates(coordinates, time_cls)

# warn about dropped time data
if (
time is not None
and "time" not in orientation.coords
Expand Down Expand Up @@ -105,10 +106,14 @@ def __init__(

self._dataset = xr.merge(dataset_items, join="exact")

self._time_ref = time.reference_time if isinstance(time, Time) else None
self._time_ref = time_cls.reference_time if isinstance(time_cls, Time) else None
if "time" in self._dataset and self._time_ref is not None:
self._dataset.weldx.time_ref = self._time_ref

# warn about dropped reference time
if time_ref is not None and time is None and self._time_ref is None:
warnings.warn("Reference time dropped. The system is not time dependent.")

def __repr__(self):
"""Give __repr_ output in xarray format."""
# todo: rewrite if expressions are fully supported
Expand Down

0 comments on commit 914a2d4

Please sign in to comment.