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

spedas / pyspedas / 25391193746

05 May 2026 05:15PM UTC coverage: 76.027% (+19.6%) from 56.446%
25391193746

push

github

jameswilburlewis
Restore Cluster tests -- CSA seems to be back online

37244 of 48988 relevant lines covered (76.03%)

2.41 hits per line

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

96.15
/pyspedas/tplot_tools/tplot_names.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 pyspedas
4✔
7

8
def tplot_names(quiet=False):
4✔
9
    """
10
    This function will print out and return a list of all current Tplot Variables stored in the memory.  
11
    
12
    Parameters
13
    ----------
14
        quiet : bool
15
            If True, does not print out the variables (only returns the list variables)
16
         
17
    Returns
18
    -------
19
        list of str
20
            A list of all Tplot Variables stored in the memory
21
            
22
    Examples
23
    --------
24
        >>> import pyspedas
25
        >>> x_data = [1,2,3,4,5]
26
        >>> y_data = [1,2,3,4,5]
27
        >>> pyspedas.store_data("Variable1", data={'x':x_data, 'y':y_data})
28
        >>> tnames = pyspedas.tplot_names()
29
        0 : Variable 1
30

31
    """
32
    
33
    index = 0
4✔
34
    return_names=[]
4✔
35

36
    # TODO: Print out links as well?
37

38
    for key, _ in pyspedas.tplot_tools.data_quants.items():
4✔
39
        if isinstance(pyspedas.tplot_tools.data_quants[key], dict):
4✔
40
            # non-record varying variables are stored as dictionaries
41
            if isinstance(key, str):
4✔
42
                names_to_print = key
4✔
43

44
            if quiet != True:
4✔
45
                print(index, ":", names_to_print)
×
46

47
            return_names.append(names_to_print)
4✔
48
            index += 1
4✔
49
            continue
4✔
50

51
        if len(pyspedas.tplot_tools.data_quants[key].attrs['plot_options']['overplots_mpl']) != 0:
4✔
52
            if quiet:
4✔
53
                # In this context we only want variable names, and no other formatting
54
                names_to_print = pyspedas.tplot_tools.data_quants[key].name
4✔
55
            else:
56
                names_to_print = pyspedas.tplot_tools.data_quants[key].name + "  data from: "
3✔
57
                for oplot_name in pyspedas.tplot_tools.data_quants[key].attrs['plot_options']['overplots_mpl']:
3✔
58
                    names_to_print = names_to_print + " " + oplot_name
3✔
59
        else:
60
            if isinstance(key, str):
4✔
61
                names_to_print = pyspedas.tplot_tools.data_quants[key].name
4✔
62

63
        if quiet != True:
4✔
64
            print(index, ":", names_to_print)
4✔
65
            
66
        index += 1
4✔
67

68
        return_names.append(names_to_print)
4✔
69
    return return_names
4✔
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