home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

1 row where user = 64480652 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date), closed_at (date)

type 1

  • issue 1

state 1

  • closed 1

repo 1

  • xarray 1
id node_id number title user state locked assignee milestone comments created_at updated_at ▲ closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1422460071 I_kwDOAMm_X85UyQSn 7211 Incorrect handle to Dagster frozenlists in Dataset object airton-neto 64480652 closed 0     4 2022-10-25T13:23:09Z 2022-10-31T12:39:05Z 2022-10-31T12:39:05Z NONE      

What happened?

Dataset object could not be fetched with Dataset[variables] when variables is a frozenlist. There is some source code that can replicate this behaviour.

What did you expect to happen?

Dataset[variables] returning a new fetched dataset. It returns a key error.

Minimal Complete Verifiable Example

```Python

%%

from dagster import Output, asset, Field, build_op_context import numpy as np import pandas as pd import xarray as xr

def retrieve_dataset(date, fct_step, lats, lons, runtime, source, variables):

dt = str(date)[0:10].replace("-", "")
year = dt[0:4]
prev_n = "{}".format(fct_step).zfill(3)

lat_toplot = np.arange(
    min(lats), max(lats), 0.25
)  # last number is exclusive
lon_toplot = (
    np.arange(min(lons), max(lons), 0.25) % 360
)  # last number is exclusive

gfs_model = "ds084.1"
URL = f"https://rda.ucar.edu/thredds/dodsC/files/g/{gfs_model}/{year}/{dt}/gfs.0p25.{dt}{runtime}.f{prev_n}.grib2"

dataset = xr.open_dataset(URL, cache=True, engine="netcdf4")[variables]

# Select required data via xarray
dataset = dataset.sel(lon=lon_toplot, lat=lat_toplot)[variables]

return dataset

@asset( description="GFS dataset fetched for NOAA Forecast data from NOAA NOMADS server.", config_schema=dict( variables=Field(list), ), output_required=True, ) def ncar_dataset(context):

date = "2022-02-01"
fct_step = 0
lats = [-4.0, -2.75]
lons = [-41.5, -40.25]
runtime = "00"
# variables = list(context.op_config["variables"])  <--- This way it runs
variables = context.op_config["variables"]
source = "model-gfs-003"

dataset = retrieve_dataset(
    date, fct_step, lats, lons, runtime, source, variables
)

return Output(dataset)

test_variable = "u-component_of_wind_height_above_ground"

with build_op_context( op_config={ "variables": [test_variable], } ) as context:

dataset_ast = ncar_dataset(context)

dataset = dataset_ast.value ```

MVCE confirmation

  • [X] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • [ ] Complete example — the example is self-contained, including all data and the text of any traceback.
  • [X] Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • [X] New issue — a search of GitHub Issues suggests this is not a duplicate.

Relevant log output

Python I raises KeyError

Anything else we need to know?

No response

Environment

Python 3.10.4 pandas==1.5.0 xarray==0.19.0 netCDF4==1.5.7 dagster dagit
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7211/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 23.856ms · About: xarray-datasette