You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Dask调用compute生成地震属性数据集时触发NoneType无__array_wrap__属性错误

报错原因
  • AttributeError: 'NoneType' object has no attribute '__array_wrap__' 本质是某一个地震属性计算函数未返回预期的数组对象,反而返回了None,Dask做数组运算时尝试访问None不存在的__array_wrap__方法触发报错。
  • 常见的触发场景有两个:一是属性函数的必填入参缺失,内部逻辑执行失败返回空值;二是导入的模块/实例化的对象异常,调用方法时无有效返回。
修复方案
  1. 先排查返回空值的函数
    单独对每个函数做小样本测试,定位问题函数:
test_cube_slice = cube[:10, :10, :10] # 取极小切片测试,避免冗余计算
for attr_name, attr_func, attr_kwargs in funcs:
    output = attr_func(test_cube_slice, **attr_kwargs)
    if output is None:
        print(f"属性{attr_name}对应函数返回空值,需检查入参或调用逻辑")
    else:
        print(f"属性{attr_name}返回正常,类型:{type(output)},形状:{output.shape}")
  1. 补全属性函数的必填参数
    你当前所有函数的入参字典都为空,但d2geo库中频率类属性计算要求必须传入采样间隔dt参数,参考你数据的实际采样间隔补全参数即可:
# 替换为你的地震数据实际采样间隔,单位为秒
sample_interval = 0.002
funcs = [
    ('Amplitude', amplitude_arr, {}),
    ('Envelope', complex_att.envelope, {}),
    ('Instantaneous Phase', complex_att.instantaneous_phase, {}),
    # 频率类属性补全dt参数
    ('Instantaneous Frequency', complex_att.instantaneous_frequency, {"dt": sample_interval}),
    ('Instantaneous Bandwidth', complex_att.instantaneous_bandwidth, {"dt": sample_interval}),
    ('Dominant Frequency', complex_att.dominant_frequency, {"dt": sample_interval}),
    ('Cosine Instantaneous Phase', complex_att.cosine_instantaneous_phase, {}),
    ('Second Derivative', signal_process.second_derivative, {}),
    ('Reflection Intensity', signal_process.reflection_intensity, {})
]
  1. 修正导入路径拼写错误
    你原代码中导入模块名拼写有误,CompleTrace少了字母x,正确的导入语句为:
from d2geo.attributes.ComplexTrace import ComplexAttributes
  1. 小范围验证后再全量计算
    确认所有函数返回正常后,先取部分数据测试计算逻辑,无异常再执行全量计算:
# 先取部分数据测试,确认无空值后再全量执行
test_df = run_attributes(cube[:100, :100, :100], funcs).compute()
print(test_df.isnull().sum())

# 测试无问题再执行全量计算
# full_df = run_attributes(cube, funcs).compute()

内容的提问来源于stack exchange,提问作者Yosmely Bermúdez

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.05 03:33:01