Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 什么是&x201C;未索引尺寸”;为什么坐标是空的?_Python_Python Xarray - Fatal编程技术网

Python 什么是&x201C;未索引尺寸”;为什么坐标是空的?

Python 什么是&x201C;未索引尺寸”;为什么坐标是空的?,python,python-xarray,Python,Python Xarray,我正在读取一个NetCDF文件,得到了未索引的维度。这意味着什么?我应该担心什么?它是否与坐标为*空*相关?这是否意味着源文件中的某些内容不整洁 In [33]: ds Out[33]: <xarray.Dataset> Dimensions: (hirs-n17_nx: 7, hirs-n17_ny: 7, hirs-n18_nx: 7, hirs-n18_ny: 7, matchup_count: 11969) Coordinates:

我正在读取一个NetCDF文件,得到了
未索引的维度
。这意味着什么?我应该担心什么?它是否与坐标为
*空*
相关?这是否意味着源文件中的某些内容不整洁

In [33]: ds
Out[33]: 
<xarray.Dataset>
Dimensions:                     (hirs-n17_nx: 7, hirs-n17_ny: 7, hirs-n18_nx: 7, hirs-n18_ny: 7, matchup_count: 11969)
Coordinates:
    *empty*
Unindexed dimensions:
    hirs-n17_nx, hirs-n17_ny, hirs-n18_nx, hirs-n18_ny, matchup_count
Data variables:
(...)
    hirs-n18_counts_ch12        (matchup_count, hirs-n18_ny, hirs-n18_nx) float64 -2.147e+09 ...
(...)

In [35]: ds["hirs-n17_radiance_ch12"]
Out[35]: 
<xarray.DataArray 'hirs-n17_radiance_ch12' (matchup_count: 11969, hirs-n17_ny: 7, hirs-n17_nx: 7)>
[586481 values with dtype=float64]
Unindexed dimensions:
    matchup_count, hirs-n17_ny, hirs-n17_nx
Attributes:
    units: mW m^-2 sr^-1 cm
[33]中的
:ds
出[33]:
尺寸:(hirs-n17\u nx:7,hirs-n17\u ny:7,hirs-n18\u nx:7,hirs-n18\u ny:7,配对计数:11969)
协调:
*空的*
未索引尺寸:
hirs-n17_nx,hirs-n17_ny,hirs-n18_nx,hirs-n18_ny,配对计数
数据变量:
(...)
hirs-n18\u计数\u ch12(配对计数,hirs-n18\u ny,hirs-n18\u nx)浮动64-2.147e+09。。。
(...)
In[35]:ds[“hirs-n17_辐射度_ch12”]
出[35]:
[586481数据类型为float64的值]
未索引尺寸:
配对计数,hirs-n17,hirs-n17
属性:
单位:兆瓦米^-2兆瓦^-1厘米
“未编制索引的尺寸”只是没有关联坐标变量的尺寸。更好的章节标题可能是“没有坐标的尺寸”。这并没有本质上的错误:有时候维度没有有意义的坐标值,而xarray处理得很好

这是xarray对象的
repr
中的一个新部分。从v0.9.0开始,在xarray数据模型中,而不是使用默认值填写
[0,1,2,…,N-1]

旧行为/报告(xarray v0.8.2):

数据集({'foo':('x',),[1,2,3])) >>>ds 尺寸:(x:3) 协调: *x(x)int64 0 1 2 数据变量: 富(x)int64 1 2 3 >>>ds.coords中的“x” 真的 新行为/报告(xarray v0.9.0):

数据集({'foo':('x',),[1,2,3])) >>>ds 尺寸:(x:3) 协调: *空的* 未索引尺寸: x 数据变量: 富(x)int64 1 2 3 >>>ds.coords中的“x” 假的
我很高兴你提出了这个问题。我们最近一直在调整th
repr
(请参阅),试图以最清晰的方式传达数据模型的这一新方面,但我们可能还没有做到这一点。非常欢迎提出改进建议(请对链接的GitHub问题发表评论)。

我明白了。我还在学习索引/坐标系统如何映射到NetCDF模型。
>>> ds = xarray.Dataset({'foo': (('x',), [1, 2, 3])})
>>> ds
<xarray.Dataset>
Dimensions:  (x: 3)
Coordinates:
  * x        (x) int64 0 1 2
Data variables:
    foo      (x) int64 1 2 3
>>> 'x' in ds.coords
True
>>> ds = xarray.Dataset({'foo': (('x',), [1, 2, 3])})
>>> ds
<xarray.Dataset>
Dimensions:  (x: 3)
Coordinates:
    *empty*
Unindexed dimensions:
    x
Data variables:
    foo      (x) int64 1 2 3
>>> 'x' in ds.coords
False