Utils.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:aerosol 作者: tomasalex 项目源码 文件源码
def GetDeseasonalizedData(period, aodvalues, allLats, allLongs, months, meanAOD, rejectzeros=True, uprof=0):

    mlist=[]
    for m in months:
        if int(m.split('-')[0]) in period:
            mlist.append(m.split('-')[1]+m.split('-')[0])
    mlist.sort()

    data = np.zeros((len(allLats), len(allLongs), len(mlist)))

    slopedata = np.zeros((len(allLats), len(allLongs)))
    interceptdata = np.zeros((len(allLats), len(allLongs)))

    for e in aodvalues:
        i=allLats.index(e.latitude)
        j=allLongs.index(e.longitude)
        if not rejectzeros :
            numcheck=isfloat(e.aod_12)
        else :
            numcheck=False
            if isfloat(e.aod_12):
                if float(e.aod_12)>0.0 :
                    numcheck=True

        if e.month in period and numcheck and int(e.uprofiles)>=uprof:
            k=mlist.index(str(e.year)+str(e.month).zfill(2))
            if meanAOD[i][j]>0 :
                data[i][j][k]=(float(e.aod_12)-meanAOD[i][j])/meanAOD[i][j]*100

    x = np.arange(0,len(mlist))
    for ind, e in np.ndenumerate(data[:,:,-1]) :
        slope, intercept, r_value, p_value, std_err = linregress(x,data[ind[0]][ind[1]])
        slopedata[ind[0]][ind[1]]=slope
        interceptdata[ind[0]][ind[1]]=intercept

    return slopedata, interceptdata, data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号