home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 117262604

This data as json

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
117262604 MDU6SXNzdWUxMTcyNjI2MDQ= 660 time slice cannot be list 7799184 closed 0     3 2015-11-17T01:53:15Z 2015-11-18T02:25:36Z 2015-11-18T02:25:29Z CONTRIBUTOR      

Not sure this is a problem or expected behaviour. When slicing a variable from dataset using sel() method, if I only want one time, the time slice cannot be in a list (in my case, it failed when level slice had more than one value). However, with a scalar float, it works. Please see example below where I try to slice from CFSR currents file.

This does not work:

dset['uo'].sel(latitude=-49, longitude=162.75, lev=[0,100,1000], time=[1.41747840e+09], method='nearest')

*** IndexError: The indexing operation you are attempting to perform is not valid on netCDF4.Variable object. Try loading your data into memory first by calling .load().

Original traceback: Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/xray-0.6.1_15_g5109f4f-py2.7.egg/xray/backends/netCDF4_.py", line 47, in getitem data = getitem(self.array, key) File "netCDF4.pyx", line 2991, in netCDF4.Variable.getitem (netCDF4.c:36676) File "/usr/lib64/python2.7/site-packages/netCDF4_utils.py", line 245, in _StartCountStride raise IndexError("Indice mismatch. Indices must have the same length.") IndexError: Indice mismatch. Indices must have the same length.

This works:

dset['uo'].sel(latitude=-49, longitude=162.75, lev=[0,100,1000], time=1.41747840e+09, method='nearest')

<xray.DataArray 'uo' (lev: 3)> array([ 0.024, 0.012, -0.008]) Coordinates:      latitude float64 -48.75      lev (lev) float64 5.0 105.0 949.0      longitude float64 162.8      time float64 1.417e+09 Attributes:      short_name: uo      long_name: U-Component of Current      level: Depth below sea surface      units: m/s

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/660/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 3 rows from issue in issue_comments
Powered by Datasette · Queries took 0.661ms · About: xarray-datasette