Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gt.load.seaglider_show_variables doesn't work from command line #133

Open
callumrollo opened this issue Jul 8, 2021 · 0 comments
Open

Comments

@callumrollo
Copy link
Member

callumrollo commented Jul 8, 2021

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

  1. Start a Python session from the command line and load glidertools import glidertools as gt
  2. Get some Seaglider .nc files and point at them filenames = 'data_marina/p*.nc'
  3. gt.load.seaglider_show_variables(filenames)
  4. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant