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

使用SmileRandomForest降尺度GRACE数据时GEE报Invalid label -10错误求助

解决SmileRandomForest建模GRACE降尺度时的“Invalid label -10”错误
  • 错误本质:SmileRandomForest算法要求训练用的标签(即你要预测的GRACE数据)必须是非负整数,你的数据里存在-10这个无效负标签,触发了报错。

  • 具体修复方案:

    1. 过滤无效标签样本
      先给GRACE数据做掩膜,剔除所有标签为负数的像素,只保留有效样本:
      // 替换成你实际的GRACE影像变量名和波段名
      var validGrace = yourGraceImage.updateMask(yourGraceImage.select('your_grace_band').gte(0));
      
    2. 重新构建训练集
      用过滤后的GRACE数据和预测因子(predictors)生成训练样本:
      var trainingDataset = validGrace.addBands(yourPredictors).sample({
        region: yourStudyArea,
        scale: yourScale,
        numPixels: yourSampleCount
      });
      
    3. 若-10是缺失值标记,可选择填充后再训练
      如果-10代表数据缺失,也可以用有效像素的均值填充缺失值:
      // 计算GRACE有效像素的均值
      var graceMean = validGrace.reduceRegion({
        reducer: ee.Reducer.mean(),
        region: yourStudyArea,
        scale: yourScale,
        maxPixels: 1e13
      }).getNumber('your_grace_band');
      // 将-10替换为均值
      var filledGrace = yourGraceImage.where(yourGraceImage.select('your_grace_band').eq(-10), graceMean);
      

内容的提问来源于stack exchange,提问作者Ehsan

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.22 19:39:26