【问题标题】:What if the number of values in dataset is different from total dimension of dataset in python?如果数据集中值的数量与 python 中数据集的总维数不同怎么办?
【发布时间】:2023-01-29 15:25:25
【问题描述】:

我正在研究“从 1950 年到现在的 ERA5-Land 月平均数据”以获得总降水量和蒸发量。

我发现数据集中值的数量是 1,306,863,104。 [dtype=float32 的 1306863104 个值] 但是,数据集的总维度是86418013600(分别为时间、纬度、经度)=5,601,830,400。

你们曾经处理过这样的数据吗?

我想计算 SPEI 指数(使用 climate_indices 包),但错误代码是他们无法将 1,306,863,104 数据重塑为 (864,1801,3600)。由于这个问题,我陷入了.. 请帮我。

【问题讨论】:

    标签: python dataset dimension


    【解决方案1】:

    我自己解决了这个问题。 这是因为数据类型。 内置函数的默认 dtype 是 int 类型。 值的个数超出了整数所能表示的范围。 5,601,830,400 > 2^32

    因此,我将 dtype 设置为 float。

    然后,它运作良好。

    【讨论】:

      猜你喜欢
      • 2021-11-05
      • 2020-04-12
      • 1970-01-01
      • 2013-10-10
      • 1970-01-01
      • 2020-05-01
      • 2020-08-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多