Skip to content

Can dims be auto-inferred during to_dataset? #189

Description

@ahuang11
import xarray as xr
import xarray_sql as xql

ds = xr.tutorial.open_dataset('air_temperature')

ctx = xql.XarrayContext()
ctx.from_dataset('air', ds, chunks=dict(time=100))

clim = ctx.sql('''
  SELECT
    "time", AVG("air") AS air
  FROM
    "air"
  GROUP BY
    "time"
''')

clim_ds = clim.to_dataset()

To my surprise: ValueError: dims cannot be inferred: no registered Dataset has all of its dims present in the result columns. Pass dims=[...] explicitly.

I imagine the value for group by would become the dim here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions