Example #1
0
def regression(x, y, value_min, value_max, flag, ICFG, MCFG, Band):

    # FY4分布
    MainPath, _ = os.path.split(ICFG.ofile)
    if not os.path.isdir(MainPath):
        os.makedirs(MainPath)

    meanbais = (np.mean(x - y) / np.mean(y)) * 100.

    p = dv_plt.dv_scatter(figsize=(7, 5))
    p.easyplot(x, y, None, None, marker='o', markersize=5)

    p.xlim_min = p.ylim_min = value_min
    p.xlim_max = p.ylim_max = value_max

    p.title = u'%s' % (ICFG.ymd)
    p.xlabel = u'%s %s %s' % (ICFG.sat1, ICFG.sensor1, flag)
    p.ylabel = u'%s %s %s' % (ICFG.sat2, ICFG.sensor2, flag)
    # 计算AB
    ab = np.polyfit(x, y, 1)
    p.regression(ab[0], ab[1], 'b')

    # 计算相关性
    p.show_leg = True
    r = np.corrcoef(x, y)
    rr = r[0][1] * r[0][1]
    nums = len(x)
    # 绘制散点
    strlist = [[r'$%0.4fx%+0.4f (R=%0.4f) $' % (ab[0], ab[1], rr),
                r'count:%d' % nums, r'%sMeanBias: %0.4f' % (flag, meanbais)]]
    p.annotate(strlist, 'left', 'r')
    ofile = os.path.join(MainPath, '%s+%s_%s+%s_%s_%s_%s.png' %
                         (ICFG.sat1, ICFG.sensor1, ICFG.sat2, ICFG.sensor2, ICFG.ymd, Band, flag))
    p.savefig(ofile, dpi=300)
Example #2
0
        self.G_pos = G_pos
        self.P_pos = self.hiras_pos
        self.L_pos = G_pos - self.P_pos


if __name__ == '__main__':
    BandLst = ['CH_20', 'CH_21', 'CH_22', 'CH_23', 'CH_24', 'CH_25']
    L1File = 'D:/data/FY3D+MERSI_HIRAS/FY3D_HIRAS_GBAL_L1_20180326_0045_016KM_MS.HDF'
    hiras = CLASS_HIRAS_L1(BandLst)
    hiras.Load(L1File)
    hiras.gapFilling()

    print hiras.radiance.shape
    print hiras.radiance_old.shape

    p = dv_plt.dv_scatter(figsize=(6, 5))
    p.easyplot(hiras.wavenumber,
               hiras.radiance[0],
               'b',
               'after',
               marker='o',
               markersize=5)
    p.easyplot(hiras.wavenumber_old,
               hiras.radiance_old[0],
               'r',
               'before',
               marker='o',
               markersize=5)
    oFile = 'C:/Users/wangpeng/Desktop/test.png'
    p.savefig(oFile, dpi=300)