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

Unreliable display of xarray Dataset metadata #6054

Open
milesalanmoore opened this issue Jan 19, 2025 · 0 comments
Open

Unreliable display of xarray Dataset metadata #6054

milesalanmoore opened this issue Jan 19, 2025 · 0 comments
Labels
area: console Issues related to Console category. lang: python

Comments

@milesalanmoore
Copy link

milesalanmoore commented Jan 19, 2025

System details:

2020 Macbook Pro M1, Sonoma 14.1.1

Positron and OS details:

Positron Version: 2024.12.0 (Universal) build 96
Code - OSS Version: 1.93.0
Commit: c5ce275
Date: 2024-11-28T02:47:29.898Z
Electron: 30.4.0
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.1.0

Interpreter details:

Python 3.12.0

Describe the issue:

xarray datasets have a bit of a quirky behavior when printed to the Python console as in:

Steps to reproduce the issue:

Send the following code to console, or enter it directly:

import numpy as np
import pandas as pd
import xarray as xr

np.random.seed(123)

times = pd.date_range("2000-01-01", "2001-12-31", name="time")
annual_cycle = np.sin(2 * np.pi * (times.dayofyear.values / 365.25 - 0.28))

base = 10 + 15 * annual_cycle.reshape(-1, 1)
tmin_values = base + 3 * np.random.randn(annual_cycle.size, 3)
tmax_values = base + 10 + 3 * np.random.randn(annual_cycle.size, 3)

ds = xr.Dataset(
    {
        "tmin": (("time", "location"), tmin_values),
        "tmax": (("time", "location"), tmax_values),
    },
    {"time": times, "location": ["IA", "IN", "IL"]},
)

ds
positron-xarray-record.mov

Expected or desired behavior:

In VS Code, (Jupyter Notebook) the output looks like this:

Image

Notice how some drop downs are darkened if they can't be expanded, but all with content can be expanded. Additionally, in Positron when expanded, drop down titles disappear.

In Python Console from system terminal:

>>> ds
<xarray.Dataset>
Dimensions:   (time: 731, location: 3)
Coordinates:
  * time      (time) datetime64[ns] 2000-01-01 2000-01-02 ... 2001-12-31
  * location  (location) <U2 'IA' 'IN' 'IL'
Data variables:
    tmin      (time, location) float64 -8.037 -1.788 -3.932 ... -1.346 -4.544
    tmax      (time, location) float64 12.98 3.31 6.779 ... 6.636 3.343 3.805

Were there any error messages in the UI, Output panel, or Developer Tools console?

N/A

@milesalanmoore milesalanmoore changed the title Unreliable display of xarray dataset metadata Unreliable display of xarray Dataset metadata Jan 19, 2025
@lionel- lionel- added area: console Issues related to Console category. lang: python labels Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: console Issues related to Console category. lang: python
Projects
None yet
Development

No branches or pull requests

2 participants