; PRO PLOT_DATA_GAP, X_CONT, X_PLOT, Y_DATA, GAP_SIZE ; ; PLOT_DATA_GAP.PRO Matthew DeLand 01/17/95 ; ; Procedure to plot time series of daily data, leaving gaps if more than a ; specified number of consecutive days are missing; Since all data are ; plotted using OPLOT, the plot axes must already be in place ; ; X_CONT: X-axis array of consecutive values from which data gap is ; calculated; Running day number often used ; X_PLOT: X-axis data array used for plotting; Does not have to be same ; as X_CONT ; ; Check for large data gaps; Find subscripts for endpoints of such gaps by ; comparing with shifted array; If gaps are present, plot data in continuous ; sections only ; X_CONT_SHIFT = shift( X_CONT, 1 ) SUB_DIFF = where(((X_CONT - X_CONT_SHIFT) GT GAP_SIZE), n_gap) ; ; If no data gaps are found, go ahead and plot the time series ; IF (SUB_DIFF(0) EQ -1) THEN BEGIN OPLOT, X_PLOT, Y_DATA ; ; If 1 or more data gaps are found, need to get the total number of good data ; values and data gaps; Next, construct an array of subscripts to use for ; plotting the sections of good data ; ENDIF ELSE BEGIN N_GOOD = n_elements(X_CONT) ; SUB_DIFF_PLOT = [0, SUB_DIFF, N_GOOD] ; ; Now plot each continuous section of data separately ; FOR I = 0, N_GAP DO BEGIN SUB1 = SUB_DIFF_PLOT(I) & SUB2 = SUB_DIFF_PLOT(I+1) - 1 OPLOT, X_PLOT(SUB1:SUB2), Y_DATA(SUB1:SUB2) ENDFOR ENDELSE ; END