home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 217729216

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
217729216 MDU6SXNzdWUyMTc3MjkyMTY= 1337 ds.sel_points reassigning non-referenced coordinates as variables 6101444 closed 0     1 2017-03-29T00:14:06Z 2017-05-09T02:31:52Z 2017-05-09T02:31:52Z NONE      

Python version: 2.7 Xarray Version: 0.9.1

When callingsel_points on the data_array coordinates are preserved. However, ds.sel_points reassigns non-referenced coordinates as variables. Is this the expected behavior?

``` In [2]: ds = xr.Dataset({'tas': ...: xr.DataArray( ...: np.random.random((19, 18, 100)), ...: dims=('lat', 'lon', 'time'), ...: coords={ ...: 'lat': np.arange(-90, 91, 10), ...: 'lon': np.arange(-180, 180, 20), ...: 'time': pd.date_range('2000', '2100', freq='A')})}) ...: In [3]: ds Out[3]: <xarray.Dataset> Dimensions: (lat: 19, lon: 18, time: 100) Coordinates: * lat (lat) int64 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 ... * lon (lon) int64 -180 -160 -140 -120 -100 -80 -60 -40 -20 0 20 40 60 ... * time (time) datetime64[ns] 2000-12-31 2001-12-31 2002-12-31 ... Data variables: tas (lat, lon, time) float64 0.1865 0.1357 0.6215 0.1499 0.104 ... In [4]: ds.tas.sel_points('regions', lat=[-80, 0, 10], lon=[60, 20, -20]) Out[4]: <xarray.DataArray 'tas' (regions: 3, time: 100)> array([[ 0.319773, 0.908711, 0.584497, ..., 0.62886 , 0.080532, 0.466724], [ 0.235852, 0.40516 , 0.963833, ..., 0.589328, 0.066798, 0.80928 ], [ 0.098497, 0.287534, 0.629137, ..., 0.951644, 0.71438 , 0.40434 ]]) Coordinates: lat (regions) int64 -80 0 10 lon (regions) int64 60 20 -20 * time (time) datetime64[ns] 2000-12-31 2001-12-31 2002-12-31 ... Dimensions without coordinates: regions

In [5]: ds.sel_points('regions', lat=[-80, 0, 10], lon=[60, 20, -20]) Out[5]: <xarray.Dataset> Dimensions: (regions: 3, time: 100) Coordinates: lat (regions) int64 -80 0 10 lon (regions) int64 60 20 -20 Dimensions without coordinates: regions, time Data variables: time (time) datetime64[ns] 2000-12-31 2001-12-31 2002-12-31 ... tas (regions, time) float64 0.3198 0.9087 0.5845 0.5493 0.574 ... ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1337/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

  • 1 row from issues_id in issues_labels
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.637ms · About: xarray-datasette