home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 111525165

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
111525165 MDU6SXNzdWUxMTE1MjUxNjU= 625 Best way to copy data layout? 167164 closed 0     3 2015-10-15T01:09:47Z 2015-10-20T17:00:25Z 2015-10-20T17:00:25Z NONE      

I have a dataset that represents some observed variables at a particular site.

For example:

python <xray.Dataset> Dimensions: (time: 70128, x: 1, y: 1, z: 1) Coordinates: * x (x) float64 1.0 * y (y) float64 1.0 * time (time) datetime64[ns] 2003-01-01T00:30:00 ... * z (z) float64 1.0 Data variables: latitude (y, x) float64 41.9 longitude (y, x) float64 13.61 SWdown (time, y, x) float64 0.0 0.01205 0.0 0.0 0.0 0.0 0.0 ... Tair (time, z, y, x) float64 276.8 276.4 276.4 276.7 276.7 ... Rainf (time, y, x) float64 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... elevation (y, x) float64 884.2 reference_height (y, x) float64 4.0 Attributes: Production_time: 2012-09-27 11:34:52 Production_source: ...

I want to use this data as input to a model, and then output a data structure that is the same, except that it contains different output variables.

I tried doing

python new_ds = old_ds[['latitude', 'longitude', 'elevation', 'reference height']]

and then adding the new variables, but this drops the time coordinate, so you have to re-create it manually. Is there a better way? It would be quite nice if it was possible to do something like

python new_ds = old_ds[vars, drop_coords=False]

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/625/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
  • 3 rows from issue in issue_comments
Powered by Datasette · Queries took 7.937ms · About: xarray-datasette