detrend

作者: Rex_Diego | 来源:发表于2017-04-24 19:52 被阅读0次

import cdms,sys,cdutil,genutil,MV

f=cdms.open(sys.prefix+'/sample_data/clt.nc')
s=f('clt')

Make sure bounds are correct!

cdutil.times.setTimeBoundsMonthly(s)

Remove AC

dep = cdutil.times.ANNUALCYCLE.departures(s)

Which is equivalent of doing:

ac = cdutil.times.ANNUALCYCLE.climatlogy(s)

dep = cdutil.times.ANNUALCYCLE.departures(s,ref=ac)

The second case shows how to remove climatology computed on a different period (computing ac over a different period)

trend,intercept = genutil.statistics.linearregression(dep)
time = MV.array(dep.getTime()) # makes an array of time dimension
time.setAxis(0,dep.getTime()) # passes itslef as axis...

The following "grows" trend and time so they are 3D

detrender,time = genutil.grower(time,trend)

detrended = dep - detrender*time
f=cdms.open("out.nc",'w')
f.write(detrended,id=dep.id,typecode='f')
f.close()

相关文章

  • detrend

    import cdms,sys,cdutil,genutil,MV f=cdms.open(sys.prefix+...

  • Fits~ Overview –Simulation-2

    • Detrend(去除线性趋势)— 从仿真,预测以及误差数据中移除线性趋势。此选项允许检查实际数据的变化是否仍然...

网友评论

      本文标题:detrend

      本文链接:https://www.haomeiwen.com/subject/ppewwttx.html