def pointTimeSeries(): # GENERATE POINT TIME SERIES # -- INPUT -------------------------------------------------------------------------------------- # Files fileDir = "/Users/ellisvavra/Thesis/insar/asc/f1/intf_all/Attempt1/SBAS_SMOOTH_0.0000e+00/" fileType = "LOS_*_INT3.grd" outDir = '/Users/ellisvavra/Thesis/insar/asc/f1/intf_all/Attempt1/' outputName_ts = "timeseries_RDOM_est.eps" # Figure settings track = 'asc' colors = 'viridis' save = 'yes' # Region settings boxWidth = 50 # Time-series region width in pixels boxHeight = 50 # Time-series region height in pixels # -- EXECUTE -------------------------------------------------------------------------------------- # Get list of filenames fileNames = getFileNames(fileDir, fileType) # Extract data [xdata, ydata, zCube, dates] = readStack(fileNames) # Get coordinates for point analysis # boxIndex, boxCoords = insarPlots.getPoint(xdata, ydata, zCube[-2], colors, track, boxWidth, boxHeight) # RADAR POINTS: # region = [505, 510, 675, 685] # RDOM # region = [285, 305, 1265, 1285] # region = [75, 85, 1230, 1240] # P649 RDOM_est = [15700, 5400] # LAT/LON POINTS: # RDOM = [-118.898, 37.677] # CA99 = [-118.897, 37.645] # P649 = [] # Make timeseries from selected point rangeChange = timeSeries(np.array(xdata), np.array(ydata), zCube, RDOM_est, 10) plotTimeSeries(dates, rangeChange) # plt.grid() # plt.title('RDOM') plt.xlabel('Date') plt.ylabel('LOS displacement (m)') plt.show() ax = plt.subplot() insarPlots.map(xdata, ydata, zCube[-2], colors, [-0.05, 0.05], 'asc', 'orig', ax) # plt.scatter([RDOM[0], CA99[0]], [RDOM[1], CA99[1]], marker='^', c='black') # seismoPlots.configMap() # plt.axis([-119.2,-118.5, 37.5, 37.8]) plt.show()
def insarPanels(xdata, ydata, zCube, num_plots_x, num_plots_y, dates, colors, vlim, CRS, fileDir, outputName, save, track, subFigID): rows = num_plots_y cols = num_plots_x count = 0 fig = plt.figure(figsize=(cols + cols, rows + rows)) fig = plt.figure(figsize=(cols * 5, rows * 4)) grid = ImageGrid(fig, 111, nrows_ncols=(rows, cols), axes_pad=0.25, cbar_mode='single', cbar_location='right', cbar_pad=0.2, cbar_size='5%') print() print('Number of files: ' + str(len(zCube))) for ax in grid: if count == len(zCube): break ax.set_axis_off() im = insarPlots.map(xdata, ydata, zCube[count], colors, vlim, track, CRS, ax) ax.set_title(dates[count].strftime('%Y-%m-%d'), fontsize=10, color='black') # ax.invert_yaxis() # ax.invert_xaxis() count += 1 cbar = ax.cax.colorbar(im) cbar.ax.set_yticks(np.arange(-0.05, 0.051, 0.01)) cbar.ax.tick_params(labelsize=20) cbar.ax.set_label('LOS displacement (m)') if save == 'yes': print() print('Saving InSAR panels to ' + fileDir + outputName) plt.savefig(fileDir + outputName) plt.close() subprocess.call("open " + fileDir + outputName, shell=True) else: plt.show()
intfDir = '/Users/ellisvavra/Thesis/insar/des/f2/intf_all/' gridType = 'phase' # Read in list of interferogram directories intfs = readIntfList(intfList, 'date_pairs') # Iteratavely display list of grids qualityList = [] for file in intfs: # Identify full path to target grid and read in it's data tempGrid = intfDir + file[0].strftime('%Y%m%d') + '_' + file[1].strftime( '%Y%m%d') + '/' + gridType + '.grd' x, y, z = readInSAR(tempGrid) # Establish figure and plot grid fig = plt.figure(figsize=(10, 15)) ax = plt.gca() insarPlots.map(x, y, z, 'jet', [-3.1459, 3.1459], 'des', 'ra', ax) plt.title(file[0].strftime('%Y/%m/%d') + ' - ' + file[1].strftime('%Y/%m/%d')) plt.show() # qualityList.append(input('Label interferogram as good (g) or bad (b)')) # print(len(qualityList)) # if __name__ == '__main__':
save = 'no' # Figure settings num_plots_x = 10 num_plots_y = 10 colors = 'jet' track = 'asc' CRS = 'orig' vlim = [-0.05, 0.05] [xdata, ydata, zdata] = readInSAR(fileDir + fileType) fig = plt.figure(figsize=(10, 10)) grid = ImageGrid(fig, 111, nrows_ncols=(1, 1), axes_pad=0.25, cbar_mode='single', cbar_location='right', cbar_pad=0.2, cbar_size='5%') im = insarPlots.map(xdata, ydata, zdata, colors, vlim, track, CRS, grid[0]) cbar = grid[0].cax.colorbar(im) cbar.ax.set_yticks(np.arange(-0.05, 0.051, 0.01)) cbar.ax.tick_params(labelsize=20) cbar.ax.set_label('LOS displacement (m)') grid[0].scatter(200, 1200, 100) plt.show()
# Iteratavely display list of grids qualityList = [] for file in intfs: # Identify full path to target grid and read in it's data tempGrid = intfDir + file[0].strftime('%Y%m%d') + '_' + file[1].strftime( '%Y%m%d') + '/' + gridType + '.grd' x, y, z = readInSAR(tempGrid) # Establish figure and plot grid fig = plt.figure(figsize=(10, 15)) ax = plt.gca() if 'phase' in gridType: im = insarPlots.map(x, y, z, 'jet', [-3.1459, 3.1459], 'des', 'orig', ax) print(min(x)) elif 'unwrap' in gridType: im = insarPlots.map(x, y, z, 'Spectral', [], 'des', 'orig', ax) print(min(x)) elif 'corr' in gridType: im = insarPlots.map(x, y, z, 'viridis_r', [0, 1], 'des', 'orig', ax) im.set_clim([0, 0.1]) plt.colorbar(im) plt.title(file[0].strftime('%Y%m%d') + '_' + file[1].strftime('%Y%m%d')) plt.plot([1000, 13000, 13000, 1000, 1000], [2000, 2000, 4500, 4500, 2000]) plt.axis([20000, 0, 6000, 0]) plt.show()