; ; N09_TIME_PUBLIC_gap.PRO Matthew DeLand 02/13/07 ; ; Plot time series of NOAA-9 SBUV/2 irradiance data at any wavelength, using ; 1 nm averaged data as input; *_GAP.PRO also shows data gaps larger than ; specified size ; @plot_data_gap PROG_NAME = 'n09_time_public_gap.pro' ; PRINT, 'This program plots a time series of NOAA-9 SBUV/2 continuous scan ' PRINT, ' solar irradiance data averaged over any wavelength region between ' PRINT, ' 170-400 nm, and normalized to the start of the data set.' ; ; Load all DATA; Irradiances available for 3903 days from 1985/073 - 1997/125 ; (14 Mar 1985 - 5 May 1997), with some data gaps; Wavelength coverage is ; 170.5-399.5 nm, with 1 nm intervals ; OPENR, UNIT1, 'n09_dates_daily.unf', /get_lun INFO1 = fstat(UNIT1) & N_DY = INFO1.size / (3*4) YR = FLTARR(N_DY) & DY = YR & DNUM = YR READU, UNIT1, YR READU, UNIT1, DY READU, UNIT1, DNUM ; OPENR, UNIT2, 'n09_spec_daily.unf', /get_lun IRRAD_INP = FLTARR(230,N_DY) READU, UNIT2, IRRAD_INP IRRAD_ALL = transpose(IRRAD_INP) ; ; Select wavelength range & extract valid data; Use loop to allow repeats ; STR_NEXT = ' ' WHILE (STR_NEXT NE 'N') DO BEGIN PRINT, ' ' READ, '&&& Enter STARTING, ENDING wavelength to use [e.g. 200,208] ? ', $ WV_STRT, WV_END PRINT, ' ' READ, '%% Enter number of days for SMOOTHING function '+$ '(no smoothing = 1) ? ', N_SMTH STR_SMTH = STRTRIM(STRING(format='(I2)', fix(N_SMTH)), 2) ; ; Extract appropriate data & create average; Remember that averaged data are ; stored on 0.5 nm centers ; NUM_WV = fix(WV_END - WV_STRT) SUB_WV1 = fix(WV_STRT-170) SUB_WV2 = SUB_WV1 + (NUM_WV-1) ; IRRAD_AVG = FLTARR(N_DY) FOR I = 0, N_DY-1 DO BEGIN DUM_IRRAD = IRRAD_ALL(I, SUB_WV1:SUB_WV2) SUB_DAY = where((DUM_IRRAD GT 0.0), n_day) IF (N_DAY GT 0) THEN BEGIN IRRAD_AVG(I) = total(DUM_IRRAD(SUB_DAY)) / N_DAY ENDIF ELSE BEGIN IRRAD_AVG(I) = -999.0 ENDELSE ENDFOR ; ; Screen out dates with no good irradiance values, then apply smoothing if ; desired ; SUB_GOOD = where((IRRAD_AVG GT 0.0), n_good) IRRAD_GOOD = IRRAD_AVG(SUB_GOOD) DNUM_GOOD = DNUM(SUB_GOOD) ; IF (N_SMTH GT 1) THEN BEGIN IRRAD_SMTH = smooth(IRRAD_GOOD, N_SMTH) ENDIF ELSE BEGIN IRRAD_SMTH = IRRAD_GOOD ENDELSE ; ; Remove any unsmoothed data points, then normalize to first remaining date; ; Create approximate fractional time for plotting ; IF (N_SMTH GT 1) THEN BEGIN S1 = fix(N_SMTH+1)/2 & S2 = N_GOOD-(S1+1) ENDIF ELSE BEGIN S1 = 0 & S2 = N_GOOD-1 ENDELSE ; IRRAD_SMTH_PLOT = IRRAD_SMTH(S1:S2) IRRAD_NORM = IRRAD_SMTH_PLOT/IRRAD_SMTH_PLOT(0) PLOT_TIME = 1985.0 + (DNUM_GOOD(S1:S2)/365.25) DNUM_PLOT = DNUM_GOOD(S1:S2) ; ; PLOTTING SECTION ; **************** ; ;## 02/13/07 Allow choice of data gap size to be shown, so that periods with ;## missing NOAA-9 data are apparent ; !P.CHARSIZE = 1.2 STR_WV1 = STRING(format='(I3)', fix(WV_STRT)) STR_WV2 = STRING(format='(I3)', fix(WV_END)) !X.TITLE = '!6DATE' !Y.TITLE = '!6NORMALIZED Irradiance' !P.TITLE = '!6NOAA-9 SBUV/2 Time Series: !8'+STR_WV1+'-'+STR_WV2+' nm!6' ; PRINT, ' ' PRINT, '%% Specify NORMALIZED Y-axis minimum, maximum, # of major & '+$ 'minor ticks ' READ, '%% [e.g. 0.96,1.12,8,4] ? ', Y_MIN, Y_MAX, Y_MAJOR, Y_MINOR READ, '%% Enter minimum GAP size to show [e.g. 5 days] ? ', NUM_GAP ; ; Create plot, then ask for new plot if desired ; PLOT, PLOT_TIME, IRRAD_NORM, /nodata, /xstyle, xrange=[1985,1998], $ xticks=13, xminor=4, /ystyle, yrange=[Y_MIN,Y_MAX], yticks=Y_MAJOR, $ yminor=Y_MINOR PLOTS, [1985.0,1998.0], [1.0,1.0], lines=2 ;; OPLOT, PLOT_TIME, IRRAD_NORM plot_data_gap, DNUM_PLOT, PLOT_TIME, IRRAD_NORM, NUM_GAP ; IF (N_SMTH GT 1) THEN BEGIN XYOUTS, 0.85, 0.85, /norm, '!5'+STR_SMTH+' day running average!6', $ chars=1.1, align=1.0 ENDIF ; PRINT, ' ' READ, '%%% Another plot [Y/N] ? ', STR_NEXT STR_NEXT = STRUPCASE(STR_NEXT) ENDWHILE ; CLOSE, /all END