【发布时间】:2021-10-26 06:42:57
【问题描述】:
我打开了以下 netcdf 文件作为 xarray 数据集,其中包含月降水量值。以下是数据集 (ds3) 的样子:
我想隔离高于某个阈值的值并返回每个值的索引。例如:
outliers = ds3.where(ds3.tp > 0.08, drop=True)
for x in outliers.tp:
print(x)
当我遍历异常值时,它会为我提供每个“tp”值的信息,但我需要相关的索引。 例如,取一个 tp 值为 0.08361223(在上图中),我想返回 time_index(1981-03-01 的索引)、lat_index(8.25 的索引)和 lon_index(38.25 的索引)。 我是 netcdf 文件和 python 的新手,希望得到任何指导。
【问题讨论】:
标签: multidimensional-array indexing netcdf python-xarray