issues: 370183554
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
370183554 | MDU6SXNzdWUzNzAxODM1NTQ= | 2488 | gridding data with groupby_bins in 2 dim | 16838898 | closed | 0 | 5 | 2018-10-15T14:13:39Z | 2020-10-04T16:01:53Z | 2020-10-04T16:01:53Z | NONE | Dear everybody, I am just starting to get to know the xarray datastructures and python so I am really still a beginner. I am working with scattered data wich need to be brought to a regular grid. Now i found your function groupby_bins which only works in one dimension - on github I couldn't find anything to wether grouping in 2d is now possible or not. It would be very helpful to get some more info about that. Here is just a code example with a small data set: geop1 = <xarray.Dataset> Dimensions: (pos_compl: 44229) Coordinates: lon (pos_compl) float64 -29.8 -31.14 -32.65 ... -25.26 -16.4 -43.75 lat (pos_compl) float64 46.48 46.07 45.66 46.18 ... 45.34 61.06 53.19 z (pos_compl) float64 -3.205e+03 -3.197e+03 ... -3.758e+03 time (pos_compl) float64 7.299e+05 7.299e+05 ... 7.367e+05 7.367e+05 * pos_compl (pos_compl) complex128 (-29.805+46.485j) ... (-43.75400000000002+53.188j) Data variables: geopot (pos_compl) float64 9.363 7.93 8.218 8.621 ... 10.44 4.293 0.4243 ---- groupby bins ---- 0.25 lat_bin = np.arange(mat4['lat_range'][0,0]-0.25/2,mat4['lat_range'][0,1]+0.25,0.25) ----0.5 lon_bin = np.arange(mat4['lon_range'][0,0]-0.5/2,mat4['lon_range'][0,1]+0.5,0.5) ----define bin center ---- 0.25 lat_cent = np.arange(mat4['lat_range'][0,0],mat4['lat_range'][0,1]+0.25,0.25) -0.5 lon_cent = np.arange(mat4['lon_range'][0,0],mat4['lon_range'][0,1]+0.5,0.5) ---- Now only these two options are possible geop_mean_lon = geop1.geopot.groupby_bins('lon', lon_bin, labels=lon_cent) geop_mean_lat = geop1.geopot.groupby_bins('lat', lat_bin, labels=lat_cent) It would be really nice to have all the information in each grid box - Or is there some other way gridding like this on big datasets is recommended? Thank you for your help! |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2488/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |