def funcM(): figM, axM = figplot.scatter121Batch( xMat, yMat, cMat, labelLst, nXY, optCb=1, cR=cR) figM.suptitle('corr of LSTM vs WRTDS colored by {}'.format(cVar)) figP = plt.figure(figsize=[12, 6]) gsP = gridspec.GridSpec(3, 6) axP = list() axP.append(figP.add_subplot(gsP[0, :3])) axP.append(figP.add_subplot(gsP[0, 3:])) axP.append(figP.add_subplot(gsP[1, :4])) axP.append(figP.add_subplot(gsP[2, :4])) axP.append(figP.add_subplot(gsP[1:, 4:])) return figM, axM, figP, axP, xMat, yMat, labelLst
def funcM(): figM, axM = figplot.scatter121Batch(xMat, yMat, cMat, labelLst, nXY, optCb=1, cR=cR, ticks=[0, 0.5, 1]) figM.suptitle('Seasonality vs Linearity colored by {}'.format(cVar)) figP = plt.figure(figsize=[12, 6]) gsP = gridspec.GridSpec(3, 6) axP = list() axP.append(figP.add_subplot(gsP[0, :3])) axP.append(figP.add_subplot(gsP[0, 3:])) axP.append(figP.add_subplot(gsP[1, :4])) axP.append(figP.add_subplot(gsP[2, :4])) axP.append(figP.add_subplot(gsP[1:, 4:])) return figM, axM, figP, axP, xMat, yMat, labelLst
dfG = gageII.readData(siteNoLst=siteNoLst) dfG = gageII.updateRegion(dfG) dfG = gageII.updateCode(dfG) fileGlim = os.path.join(kPath.dirData, 'USGS', 'GLiM', 'tab_1KM') tabGlim = pd.read_csv(fileGlim, dtype={'siteNo': str}).set_index('siteNo') matV = np.argmax(tabGlim.values, axis=1) labelLst = [ '{} {}'.format(code, usgs.codePdf.loc[code]['shortName']) for code in codeLst2 ] icLst = [codeLst.index(code) for code in codeLst2] figM, axM = figplot.scatter121Batch(rMat[:, icLst, 1], rMat[:, icLst, 0], matV, labelLst, [nfx, nfy], optCb=1, ticks=[0, 0.5, 1]) figM.show() temp = ['00930', '00940'] ic1 = codeLst.index(temp[0]) ic2 = codeLst.index(temp[1]) nameLst = [usgs.codePdf.loc[code]['shortName'] for code in temp] fig, axes = plt.subplots(1, 2) axplot.scatter121(axes[0], rMat[:, ic1, 0], rMat[:, ic2, 0], qMat, vR=[0, .6]) axes[0].set_xlabel('Linearity of {}'.format(nameLst[0])) axes[0].set_ylabel('Linearity of {}'.format(nameLst[1])) axplot.scatter121(axes[1], rMat[:, ic1, 1], rMat[:, ic2, 1], qMat, vR=[0, .6]) axes[1].set_xlabel('Seasonality of {}'.format(nameLst[0])) axes[1].set_ylabel('Seasonality of {}'.format(nameLst[1]))
axplot.titleInner(ax, titleStr) fig.show() indC = [codeLst.index(code) for code in codeLst2] labelLst = [ '{} {}'.format(code, usgs.codePdf.loc[code]['shortName']) for code in codeLst2 ] xMat = rMat[:, indC, 1] yMat = rMat[:, indC, 0] nXY = [nfx, nfy] figM, axM = figplot.scatter121Batch(xMat, yMat, qMat, labelLst, nXY, optCb=1, cR=[0, 0.6], ticks=[0, 0.5, 1], s=20) figM.show() ic1 = codeLst.index('00915') ic2 = codeLst.index('00955') fig, axes = plt.subplots(1, 2) # axplot.plot121(axes[0], rMat[:, ic1, 0], rMat[:, ic2, 0], vR=[0, 1]) # axplot.plot121(axes[1], rMat[:, ic1, 1], rMat[:, ic2, 1], vR=[0, 1]) axplot.scatter121(axes[0], rMat[:, ic1, 0], rMat[:, ic2, 0], qMat, vR=[0, .5]) axplot.scatter121(axes[1], rMat[:, ic1, 1], rMat[:, ic2, 1], qMat, vR=[0, .5]) fig.show()
bMat2 = np.full([len(siteNoLst), len(codeLst)], np.nan) bMat2[bMat > 0] = np.log(bMat[bMat > 0]+1) bMat2[bMat <= 0] = -np.log(-bMat[bMat <= 0]+1) importlib.reload(figplot) indC = [codeLst.index(code) for code in codeLst2] labelLst = ['{} {}'.format(code, usgs.codePdf.loc[code]['shortName']) for code in codeLst2] xMat = rMat[:, indC, 1] yMat = rMat[:, indC, 0] cMat = bMat2[:, indC] nXY = [nfx, nfy] figM, axM = figplot.scatter121Batch( xMat, yMat, cMat, labelLst, nXY, optCb=1, ticks=[0, 0.5, 1], s=20, cmap='jet') figM.show() ############### ic1 = codeLst.index('00915') ic2 = codeLst.index('00955') fig, axes = plt.subplots(1, 2) # axplot.plot121(axes[0], rMat[:, ic1, 0], rMat[:, ic2, 0], vR=[0, 1]) # axplot.plot121(axes[1], rMat[:, ic1, 1], rMat[:, ic2, 1], vR=[0, 1]) axplot.scatter121(axes[0], rMat[:, ic1, 0], rMat[:, ic2, 0], qMat, vR=[0, .5]) axplot.scatter121(axes[1], rMat[:, ic1, 1], rMat[:, ic2, 1], qMat, vR=[0, .5]) fig.show() temp = ['00915', '00955']