nLay = len(LAYERLIST) BGC_CLASS4_NIT_RMS_LAYER_BASIN = np.ones((nSUB, nLay), dtype=np.float32) * np.NaN BGC_CLASS4_PHOS_RMS_LAYER_BASIN = np.ones((nSUB, nLay), dtype=np.float32) * np.NaN BGC_CLASS4_CHL_RMS_LAYER_BASIN = np.ones((nSUB, nLay), dtype=np.float32) * np.NaN BGC_CLASS4_O2_RMS_LAYER_BASIN = np.ones((nSUB, nLay), dtype=np.float32) * np.NaN VARLIST = ["N1p", "N3n", "O2o"] #'chl'] for modelvarname in VARLIST: OUTPUT = np.ones((nSUB, nLay), dtype=np.float32) * np.NaN for isub, sub in enumerate(SUBlist): Profilelist = N.Selector(NUTRVARS[modelvarname], T_INT, sub) nP = len(Profilelist) Matchup_basin = M.getMatchups(Profilelist, nav_lev, modelvarname, read_adjusted=True) for ilayer, layer in enumerate(LAYERLIST): Mlayer = Matchup_basin.subset(layer) OUTPUT[isub, ilayer] = Mlayer.RMSE() if modelvarname == "N1p": BGC_CLASS4_PHOS_RMS_LAYER_BASIN = OUTPUT.copy() if modelvarname == "N3n": BGC_CLASS4_NIT_RMS_LAYER_BASIN = OUTPUT.copy() if modelvarname == "O2o": BGC_CLASS4_O2_RMS_LAYER_BASIN = OUTPUT.copy() import pickle LIST = [ BGC_CLASS4_PHOS_RMS_LAYER_BASIN, BGC_CLASS4_NIT_RMS_LAYER_BASIN,
for i in SubProfilelist_1: Pres, Profile, Qc = i.read( 'CHLA', read_adjusted[0]) #Profile.shape,Profile.size, np.mean(Profile) if (Profile.size != 0): Goodlist.append(i) # AllProfiles matrix: 0 Model, 1 Ref, 2 Misfit,3 Lat,4 Lon,5 ID FLOAT # NOTE: the number of profile per float is len(Goodlist) print "number of Goodlist Profiles:", len(Goodlist) #AllProfiles = np.zeros((len(Goodlist),dimnewpress,6),np.float64) OneProfile = np.zeros((1, dimnewpress, 6), np.float64) # PROFILES FOR FLOAT AND MODEL for ip, pp in enumerate(Goodlist): #print ip,pp.time singlefloatmatchup = M.getMatchups([pp], nav_lev, VARLIST[0]) s200 = singlefloatmatchup.subset(layer) #values NOT interpolated #vertical interpolation at the grid defined in NewPress (1meter) s200intmodel = np.interp(NewPres, s200.Depth, s200.Model) #MODEL (201 values) s200intobs_noqc = np.interp(NewPres, s200.Depth, s200.Ref) #ARGO (201 values) s200intobs = qualitycheck.test(s200intobs_noqc, wmo, pp.lat, pp.lon) # TEMPORARY MATRIX WITH ALL THE MATCHUP if (ip == 0): ind = 0 count = 1 ix0, jy0 = TheMask.convert_lon_lat_to_indices(pp.lon, pp.lat) AllProfiles = OneProfile AllProfiles[ind, :, 0] = s200intmodel #ONLY MODEL
RMSE = np.zeros((nVar,nSub,nDepth), np.float32) NPOINTS = np.zeros((nVar,nSub,nDepth), np.int32) TI =R.time_interval M = Matchup_Manager(TI,INPUTDIR,BASEDIR) for ivar, var in enumerate(VARLIST): print var for isub, sub in enumerate(OGS.NRT3): Profilelist = bio_float.FloatSelector(FLOATVARS[var], TI, sub) nProfiles = len(Profilelist) print sub.name, nProfiles Matchup_object_list=[] for ip in range(nProfiles): floatmatchup = M.getMatchups([Profilelist[ip]], TheMask.zlevels, var, read_adjusted=read_adjusted[ivar]) Matchup_object_list.append(floatmatchup) for ilayer, layer in enumerate(LAYERLIST): MODEL_LAYER_MEAN = [] # one value for each suitable profile in (subbasin, layer) REF_LAYER_MEAN = [] for floatmatchup in Matchup_object_list: m_layer = floatmatchup.subset(layer) #print ilayer, m_layer.number() if m_layer.number() > 0: REF_LAYER_MEAN.append(m_layer.Ref.mean()) MODEL_LAYER_MEAN.append(m_layer.Model.mean()) NPOINTS[ivar,isub,ilayer] = len(MODEL_LAYER_MEAN) if len(MODEL_LAYER_MEAN) > 0: M_LAYER = matchup(np.array(MODEL_LAYER_MEAN), np.array(REF_LAYER_MEAN))