示例#1
0
文件: calval.py 项目: inogs/bit.sea
MODEL_DIR="/gpfs/work/OGS_prod/CalVal/Q_REP_MODEL_FORECAST/"
REF_DIR  = "/gss/gss_work/DRES_OGS_BiGe/Observations/TIME_RAW_DATA/ONLINE/SAT/MODIS/WEEKLY/"

Timestart="20150701"
Time__end="20151001"
TI    = TimeInterval(Timestart,Time__end,"%Y%m%d")
model_TL = TimeList.fromfilenames(TI, MODEL_DIR,"*.nc",prefix='',dateformat='%Y%m%d')

IonamesFile = '../postproc/IOnames_sat.xml'
IOname = IOnames.IOnames(IonamesFile)

ngib=52

for itime, time in enumerate(model_TL.Timelist[:1]):
    satfile = REF_DIR + time.strftime(IOname.Input.dateformat) + IOname.Output.suffix + ".nc"
    modfile = model_TL.filelist[itime]
     
    ncIN = NC.netcdf_file(modfile,'r')
    For = ncIN.variables['chl'].data[0,0,:,:].copy().astype(np.float64)
    ncIN.close()
    
    Sat16 = Sat.convertinV4format(Sat.readfromfile(satfile)).astype(np.float64)
    Sat16 = Sat16[:,ngib:]
    
    cloudsLand = np.isnan(Sat16)
    modelLand  = For > 1.0e+19
    nodata     = cloudsLand | modelLand
    M = matchup.matchup(For[~nodata], Sat16[~nodata])
    print M.bias()
    
    
示例#2
0
    print modeltime
    CoupledList = sat_TL.couple_with([modeltime])
    sattime = CoupledList[0][0]
    satfile = REF_DIR + sattime.strftime(IOname.Input.dateformat) + IOname.Output.suffix + ".nc"
    modfile = model_TL.filelist[itime]
     
    De         = DataExtractor(TheMask,filename=modfile, varname='P_i')
    Model      = MapBuilder.get_layer_average(De, surf_layer)
    #ncIN = NC.netcdf_file(modfile,'r')
    #Model = ncIN.variables['P_i'].data[0,0,:,:].copy()#.astype(np.float64)
    #Model = ncIN.variables['lchlm'].data.copy()
    #ncIN.close()
    
    Sat16 = Sat.readfromfile(satfile,var='lchlm') #.astype(np.float64)
    
    
    cloudsLand = (np.isnan(Sat16)) | (Sat16 > 1.e19)
    modelLand  = np.isnan(Model) #lands are nan
    nodata     = cloudsLand | modelLand
    selection = ~nodata & mask200_2D 
    M = matchup.matchup(Model[selection], Sat16[selection])
    
    for isub, sub in enumerate(OGS.P):
        selection = SUB[sub.name] & (~nodata) & mask200_2D
        M = matchup.matchup(Model[selection], Sat16[selection])
        BGC_CLASS4_CHL_RMS_SURF_BASIN[itime,isub]  = M.RMSE()
        BGC_CLASS4_CHL_BIAS_SURF_BASIN[itime,isub] = M.bias()
    
BGC_CLASS4_CHL_EAN_RMS_SURF_BASIN  = BGC_CLASS4_CHL_RMS_SURF_BASIN.mean(axis=0)
BGC_CLASS4_CHL_EAN_BIAS_SURF_BASIN = BGC_CLASS4_CHL_BIAS_SURF_BASIN.mean(axis=0)
示例#3
0
    De         = DataExtractor(TheMask,filename=modfile, varname='P_i')
    Model      = MapBuilder.get_layer_average(De, surf_layer)
    #ncIN = NC.netcdf_file(modfile,'r')
    #Model = ncIN.variables['P_i'].data[0,0,:,:].copy()#.astype(np.float64)
    #Model = ncIN.variables['lchlm'].data.copy()
    #ncIN.close()

    Sat16 = Sat.readfromfile(satfile,var='lchlm') #.astype(np.float64)


    cloudsLand = (np.isnan(Sat16)) | (Sat16 > 1.e19) | (Sat16<0)
    modelLand  = np.isnan(Model) #lands are nan
    nodata     = cloudsLand | modelLand
    selection = ~nodata & masksel_2D
    M = matchup.matchup(Model[selection], Sat16[selection])

    for isub, sub in enumerate(OGS.P):
        selection = SUB[sub.name] & (~nodata) & masksel_2D
        M = matchup.matchup(Model[selection], Sat16[selection])
        BGC_CLASS4_CHL_RMS_SURF_BASIN[itime,isub]  = M.RMSE()
        BGC_CLASS4_CHL_BIAS_SURF_BASIN[itime,isub] = M.bias()
        weight = TheMask.area[selection]
        MODEL_MEAN[itime,isub] = weighted_mean( M.Model,weight)
        SAT___MEAN[itime,isub] = weighted_mean( M.Ref,  weight)

        Mlog = matchup.matchup(np.log10(Model[selection]), np.log10(Sat16[selection])) #add matchup based on logarithm
        BGC_CLASS4_CHL_RMS_SURF_BASIN_LOG[itime,isub]  = Mlog.RMSE()
        BGC_CLASS4_CHL_BIAS_SURF_BASIN_LOG[itime,isub] = Mlog.bias()

BGC_CLASS4_CHL_EAN_RMS_SURF_BASIN  = BGC_CLASS4_CHL_RMS_SURF_BASIN.mean(axis=0)