detrend

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()

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 10,127评论 0 23
  • 萧萧雨声打在仄闷的雨衣上,纷纷扰扰,俗尘、俗事、俗人。熙熙攘攘擦肩而过,注定一转身就一世。坎坎坷坷路漫漫,一...
    艾美人阅读 245评论 1 4
  • 好奇 文箐在贵妇的照顾下喝了一大碗粥,把贵妇高兴的眼睛都弯成了月牙。 之后又嘱咐丫头好生照顾文箐,便安心的与夫君出...
    茶果果麻麻阅读 490评论 1 1
  • 我出生在一个普通的农民家庭,很感谢爸爸妈妈让我从小生活的很富足,除了偶尔被老爸揍以外,我基本上是逍遥自在的...
    开启之光阅读 471评论 0 1
  • 如图,高德地图上的POI新区快速采集方式: 第一步:通过同企数据首页(http://www.tongqishu...
    扎西卓玛_ee77阅读 1,078评论 0 0