html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/899#issuecomment-241470249,https://api.github.com/repos/pydata/xarray/issues/899,241470249,MDEyOklzc3VlQ29tbWVudDI0MTQ3MDI0OQ==,1217238,2016-08-22T16:31:19Z,2016-08-22T16:31:19Z,MEMBER,"Looks like we could use the `bounds` attribute in this dataset to set the bound variables as coordinates automatically: ``` In [2]: ds = xarray.open_dataset('/Users/shoyer/Downloads/20100101120000-ESACCI-L4_GHRSST-SSTdepth-OSTIA-GLOB_LT-v02.0-fv01.1.nc') In [3]: ds Out[3]: <xarray.Dataset> Dimensions: (bnds: 2, lat: 3600, lon: 7200, time: 1) Coordinates: * time (time) datetime64[ns] 2010-01-01T12:00:00 * lat (lat) float32 -89.975 -89.925 -89.875 -89.825 ... * lon (lon) float32 -179.975 -179.925 -179.875 ... * bnds (bnds) int64 0 1 Data variables: time_bnds (time, bnds) datetime64[ns] 2010-01-01 2010-01-02 lat_bnds (lat, bnds) float32 -90.0 -89.95 -89.95 -89.9 ... lon_bnds (lon, bnds) float32 -180.0 -179.95 -179.95 ... analysed_sst (time, lat, lon) float64 nan nan nan nan nan nan ... analysis_error (time, lat, lon) float64 nan nan nan nan nan nan ... sea_ice_fraction (time, lat, lon) float64 nan nan nan nan nan nan ... sea_ice_fraction_error (time, lat, lon) float64 nan nan nan nan nan nan ... mask (time, lat, lon) float64 2.0 2.0 2.0 2.0 2.0 2.0 ... In [5]: ds.time.attrs Out[5]: OrderedDict([('standard_name', 'time'), ('axis', 'T'), ('bounds', 'time_bnds'), ('comment', ''), ('long_name', 'reference time of sst file')]) In [9]: xarray.concat([ds], dim='time') Out[9]: <xarray.Dataset> Dimensions: (bnds: 2, lat: 3600, lon: 7200, time: 1) Coordinates: * lat (lat) float32 -89.975 -89.925 -89.875 -89.825 ... * lon (lon) float32 -179.975 -179.925 -179.875 ... * bnds (bnds) int64 0 1 * time (time) datetime64[ns] 2010-01-01T12:00:00 Data variables: sea_ice_fraction (time, lat, lon) float64 nan nan nan nan nan nan ... time_bnds (time, bnds) datetime64[ns] 2010-01-01 2010-01-02 mask (time, lat, lon) float64 2.0 2.0 2.0 2.0 2.0 2.0 ... lat_bnds (time, lat, bnds) float32 -90.0 -89.95 -89.95 ... analysis_error (time, lat, lon) float64 nan nan nan nan nan nan ... analysed_sst (time, lat, lon) float64 nan nan nan nan nan nan ... sea_ice_fraction_error (time, lat, lon) float64 nan nan nan nan nan nan ... lon_bnds (time, lon, bnds) float32 -180.0 -179.95 -179.95 ... In [11]: xarray.concat([ds.set_coords(['time_bnds', 'lat_bnds', 'lon_bnds'])], dim='time') Out[11]: <xarray.Dataset> Dimensions: (bnds: 2, lat: 3600, lon: 7200, time: 1) Coordinates: * lat (lat) float32 -89.975 -89.925 -89.875 -89.825 ... lat_bnds (lat, bnds) float32 -90.0 -89.95 -89.95 -89.9 ... * lon (lon) float32 -179.975 -179.925 -179.875 ... lon_bnds (lon, bnds) float32 -180.0 -179.95 -179.95 ... * bnds (bnds) int64 0 1 * time (time) datetime64[ns] 2010-01-01T12:00:00 time_bnds (time, bnds) datetime64[ns] 2010-01-01 2010-01-02 Data variables: sea_ice_fraction (time, lat, lon) float64 nan nan nan nan nan nan ... mask (time, lat, lon) float64 2.0 2.0 2.0 2.0 2.0 2.0 ... analysis_error (time, lat, lon) float64 nan nan nan nan nan nan ... analysed_sst (time, lat, lon) float64 nan nan nan nan nan nan ... sea_ice_fraction_error (time, lat, lon) float64 nan nan nan nan nan nan ... ``` There's also a bigger issue with stacking vs concatenating, though. I'll open a new issue for that. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,165540933 https://github.com/pydata/xarray/issues/899#issuecomment-238054193,https://api.github.com/repos/pydata/xarray/issues/899,238054193,MDEyOklzc3VlQ29tbWVudDIzODA1NDE5Mw==,1217238,2016-08-06T23:26:12Z,2016-08-06T23:26:12Z,MEMBER,"Sorry for the delay getting back to you -- could you please share a concrete example of what a single file looks like, and what you want the combined dataset to look like? There might be a cleaner fix for this by either adjusting the inference logic for which variables to concatenate in `concat` and/or by adjusting the heuristics we use for choosing data variables / coordinates to ensure that `lat_bnds` is correctly picked as a coordinate. For example, perhaps we should use the `bounds` attribute as well as the `coordinates` attribute for inferring coordinate variables when reading netCDF files. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,165540933