LCOV - code coverage report
Current view: top level - dataset - to_unit.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 8 8 100.0 %
Date: 2024-04-28 01:25:40 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: BSD-3-Clause
       2             : // Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
       3             : /// @file
       4             : /// @author Jan-Lukas Wynen
       5             : 
       6             : #include "scipp/dataset/to_unit.h"
       7             : #include "scipp/units/unit.h"
       8             : #include "scipp/variable/to_unit.h"
       9             : 
      10             : namespace scipp::dataset {
      11             : 
      12          18 : DataArray to_unit(const DataArray &array, const units::Unit &unit,
      13             :                   const CopyPolicy copy) {
      14          18 :   auto new_data = to_unit(array.data(), unit, copy);
      15          18 :   auto new_masks = new_data.is_same(array.data())
      16           3 :                        ? array.masks()
      17          21 :                        : dataset::copy(array.masks());
      18          54 :   return DataArray(std::move(new_data), array.coords(), std::move(new_masks),
      19          90 :                    array.attrs(), array.name());
      20          18 : }
      21             : 
      22             : } // namespace scipp::dataset

Generated by: LCOV version 1.14