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

spedas / pyspedas / 23369877357

21 Mar 2026 02:13AM UTC coverage: 90.512% (+0.02%) from 90.497%
23369877357

push

github

web-flow
Merge pull request #1342 from spedas/t_1341

Adds support to load USGS Variometer data, adds test cases for loading variometer data.

13 of 48 new or added lines in 3 files covered. (27.08%)

10491 existing lines in 260 files now uncovered.

44303 of 48947 relevant lines covered (90.51%)

1.6 hits per line

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

82.61
/pyspedas/tplot_tools/convert_tplotxarray_to_pandas_dataframe.py
1
# Copyright 2018 Regents of the University of Colorado. All Rights Reserved.
2
# Released under the MIT license.
3
# This software was developed at the University of Colorado's Laboratory for Atmospheric and Space Physics.
4
# Verify current version before use at: https://github.com/MAVENSDC/PyTplot
5

6
import datetime
2✔
7
import numpy as np
2✔
8
from dateutil.parser import parse
2✔
9
import pyspedas
2✔
10
import copy
2✔
11

12

13
def convert_tplotxarray_to_pandas_dataframe(name, no_spec_bins=False):
2✔
14
    import pandas as pd
2✔
15
    # This function is not final, and will presumably change in the future
16
    # This function sums over all dimensions except for the second non-time one.
17
    # This collapses many dimensions into just a single "energy bin" dimensions
18

19
    matrix = pyspedas.tplot_tools.data_quants[name].values
2✔
20
    while len(matrix.shape) > 3:
2✔
21
        matrix = np.nansum(matrix, 3)
×
22
    if len(matrix.shape) == 3:
2✔
23
        matrix = np.nansum(matrix, 1)
×
24
    return_data = pd.DataFrame(matrix)
2✔
25
    return_data = return_data.set_index(pd.Index(pyspedas.tplot_tools.data_quants[name].coords['time'].values))
2✔
26

27
    if no_spec_bins:
2✔
28
        return return_data
2✔
29

UNCOV
30
    if 'spec_bins' in pyspedas.tplot_tools.data_quants[name].coords:
1✔
UNCOV
31
        spec_bins = pd.DataFrame(pyspedas.tplot_tools.data_quants[name].coords['spec_bins'].values)
1✔
UNCOV
32
        if len(pyspedas.tplot_tools.data_quants[name].coords['spec_bins'].shape) == 1:
1✔
33
            spec_bins = spec_bins.transpose()
×
34
        else:
UNCOV
35
            spec_bins = spec_bins.set_index(pd.Index(pyspedas.tplot_tools.data_quants[name].coords['time'].values))
1✔
36

UNCOV
37
        return return_data, spec_bins
1✔
38

39
    return return_data
×
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