• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

GFZ / EL_PASO / 22962531738

11 Mar 2026 04:14PM UTC coverage: 66.201% (-0.2%) from 66.351%
22962531738

Pull #29

github

web-flow
Merge b1b20d165 into f4c88fd66
Pull Request #29: Added wave processing from RBSP data

8 of 16 new or added lines in 2 files covered. (50.0%)

1755 of 2651 relevant lines covered (66.2%)

1.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

33.33
/el_paso/processing/create_quality_flag_from_magnetometer.py
1
# SPDX-FileCopyrightText: 2026 GFZ Helmholtz Centre for Geosciences
2
# SPDX-FileContributor: Alwin Roy
3
#
4
# SPDX-License-Identifier: Apache-2.0
5

6
import numpy as np
2✔
7
from astropy import units as u
2✔
8

9
import el_paso as ep
2✔
10

11

12
def magnetometer_quality_flags(variables: dict, threshold: int = 500) -> np.ndarray:
2✔
13
    """Compute a quality mask for magnetometer data using Bt.
14

15
    The mask flags samples that are considered valid based on two criteria:
16
    1. Magnetic field magnitude (Bt) must be positive.
17
    2. Consecutive differences |ΔBt| must be below the spike threshold.
18

19
    Args:
20
        variables (dict): Dictionary containing variable objects. Must include
21
            the key "Bt". Each variable must implement ``get_data()``.
22
        threshold(int, optional): Spike detection threshold in nT.
23
            Defaults to 500.
24

25
    Returns:
26
        np.ndarray: Boolean array where ``True`` indicates valid data and
27
        ``False`` indicates flagged samples.
28
    """
NEW
29
    bt_var = variables["Bt"]
×
NEW
30
    bt = bt_var.get_data(u.nT)
×
31

NEW
32
    mask_positive = bt > 0
×
33

NEW
34
    delta_b = np.diff(bt, prepend=bt[0])
×
NEW
35
    mask_spike = np.abs(delta_b) < threshold
×
36

NEW
37
    mask = mask_positive & mask_spike
×
38

NEW
39
    mask = ep.Variable(
×
40
        data=mask_positive & mask_spike,
41
        original_unit=u.dimensionless_unscaled,
42
    )
43

NEW
44
    return mask
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc