home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 446722089

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
446722089 MDU6SXNzdWU0NDY3MjIwODk= 2976 Confusing handling of NetCDF coordinates 1828519 closed 0     6 2019-05-21T16:47:47Z 2019-05-21T23:36:22Z 2019-05-21T23:36:21Z CONTRIBUTOR      

Code Sample, a copy-pastable example if possible

I'm currently trying to figure out why some coordinates of a netcdf file are included in the resulting Dataset object and why some are not. I've tried looking at the open_dataset source code and think I'm kind of stuck.

To reproduce:

Download GOES-16 ABI L1b NetCDF file from (click the link to have google redirect you to the actual file):

https://storage.cloud.google.com/gcp-public-data-goes-16/ABI-L1b-RadC/2019/140/18/OR_ABI-L1b-RadC-M6C01_G16_s20191401801336_e20191401804109_c20191401804156.nc?_ga=2.44800740.-1513329882.1547344783

python import xarray as xr a = xr.open_dataset('OR_ABI-L1b-RadC-M6C01_G16_s20191401801336_e20191401804109_c20191401804156.nc') print(a.coords)

Results in:

In [5]: a['Rad'].coords Out[5]: Coordinates: t datetime64[ns] ... * y (y) float32 0.151844 0.151788 0.151732 ... -0.151788 -0.151844 * x (x) float32 -0.151844 -0.151788 -0.151732 ... 0.151788 0.151844 y_image float32 ... x_image float32 ...

Even though ncdump -h <file>.nc shows:

variables: short Rad(y, x) ; ... Rad:coordinates = "band_id band_wavelength t y x" ; ...

and:

a.coords

shows:

Coordinates: t datetime64[ns] ... * y (y) float32 0.151844 0.151788 ... -0.151844 * x (x) float32 -0.151844 -0.151788 ... 0.151844 y_image float32 ... x_image float32 ... band_id (band) int8 ... band_wavelength (band) float32 ... t_star_look (num_star_looks) datetime64[ns] ... band_wavelength_star_look (num_star_looks) float32 ...

Problem description

I would have expected the 'Rad' variable/DataArray to include the band_id and band_wavelength coordinate variables but not the x_image and y_image variables since they are not listed in the NetCDF variables coordinates attribute.

Can someone summarize the rules on how xarray came up with these coordinates? Or is this a bug?

Output of xr.show_versions()

``` INSTALLED VERSIONS ------------------ commit: None python: 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 02:16:08) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] python-bits: 64 OS: Darwin OS-release: 18.5.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.4 libnetcdf: 4.6.2 xarray: 0.12.1 pandas: 0.24.2 numpy: 1.14.3 scipy: 1.2.1 netCDF4: 1.5.0.1 pydap: None h5netcdf: 0.7.1 h5py: 2.9.0 Nio: None zarr: 2.3.1 cftime: 1.0.3.4 nc_time_axis: None PseudonetCDF: None rasterio: 1.0.22 cfgrib: None iris: None bottleneck: 1.2.1 dask: 1.1.5 distributed: 1.26.1 matplotlib: 3.0.3 cartopy: 0.17.0 seaborn: None setuptools: 41.0.0 pip: 19.0.3 conda: None pytest: 4.4.0 IPython: 7.4.0 sphinx: 2.0.1 ```
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2976/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
  • 6 rows from issue in issue_comments
Powered by Datasette · Queries took 0.925ms · About: xarray-datasette