gpt4 book ai didi

python - 乘以掩码数组会更改numpy中的填充值

转载 作者:行者123 更新时间:2023-11-28 18:32:46 26 4
gpt4 key购买 nike

我有 2 个掩码数组,都是以下形式:

masked_array(data =
[[-- -- -- ..., -- -- --]
[-- -- -- ..., -- -- --]
[-- -- -- ..., -- -- --]
...,
[-- -- -- ..., -- -- --]
[-- -- -- ..., -- -- --]
[-- -- -- ..., -- -- --]],
mask =
[[ True True True ..., True True True]
[ True True True ..., True True True]
[ True True True ..., True True True]
...,
[ True True True ..., True True True]
[ True True True ..., True True True]
[ True True True ..., True True True]],
fill_value = -9999.0)

当我将它们相乘时,fill_value 变为 fill_value = 1e+20

为什么会这样?我怎样才能保留以前的填充值?这就是我将它们相乘的方式:

array_a * array_b

最佳答案

您所指的行为是由 this commit 引入的从 2013 年 10 月开始,从 v1.10.0 开始进入版本。

我不是 100% 确定它是否应该被视为一个错误。这对我来说似乎不合理,但文档似乎没有具体说明在应用 ufunc 时填充值应该发生什么。有一个couple相关open issues在 numpy GitHub 跟踪器上。

关于python - 乘以掩码数组会更改numpy中的填充值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35324836/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com