gt.load.seaglider_show_variables uses pandas dataframe .style to make a pretty return. This will not work if run from plain python/command line application
To Reproduce
- Start a Python session from the command line and load glidertools
import glidertools as gt
- Get some Seaglider .nc files and point at them
filenames = 'data_marina/p*.nc'
gt.load.seaglider_show_variables(filenames)
- Get the return:
<pandas.io.formats.style.Styler at 0x7fe6bbf98af0>
Expected behavior
Print out a pretty table with all the variables in those .nc files
Cause
The styling commands at lines 53-59 of gt.load.seaglider:
vars = (
vars.sort_values(["dims", "name"])
.reset_index(drop=True)
.loc[:, ["dims", "name", "units", "comment"]]
.set_index("name")
.style
)
System
- Linux Ubuntu 20.04
- Python from terminal session
Proposed fix
- Detect if user is running jupyter-like environment. If not, simply print the table, don't style it.
Credit to Marina Azaneu at UEA for discovering this.
gt.load.seaglider_show_variables uses pandas dataframe .style to make a pretty return. This will not work if run from plain python/command line application
To Reproduce
import glidertools as gtfilenames = 'data_marina/p*.nc'gt.load.seaglider_show_variables(filenames)<pandas.io.formats.style.Styler at 0x7fe6bbf98af0>Expected behavior
Print out a pretty table with all the variables in those .nc files
Cause
The styling commands at lines 53-59 of gt.load.seaglider:
System
Proposed fix
Credit to Marina Azaneu at UEA for discovering this.