;Sara Martinez-Alonso, 06.2014 ; ;Produces two ASCII files with relevant daily MOPITT statistics: ;one for all latitudes, the other for retrievals between latmin and latmax; ;latmin and latmax are set in MOPITTv6_daily_means_for_time_series.pro. ;It can be used to create new ASCII files or to append to pre-existing ASCII files. ;Call like this: i_call_MOPITTv6_daily_means_for_time_series, istart, iend, icreate ;where istart='MM DD YYYY', iend='MM DD YYYY', icreate=1 or 0 (1=create, 0=update) ; @MOPITTv6_daily_means_for_time_series pro i_call_MOPITTv6_daily_means_for_time_series, istart, iend, icreate nada=strsplit(istart, /extract) mm=fix(nada(0)) dd=fix(nada(1)) yy=fix(nada(2)) istart=julday(mm, dd, yy) nada=strsplit(iend, /extract) mm=fix(nada(0)) dd=fix(nada(1)) yy=fix(nada(2)) iend=julday(mm, dd, yy) if icreate eq 1 then begin openw, 1, 'MOPITTV6_daily_means_for_time_series_all_lats.txt' printf, 1, $ 'Date Mean_CO Stdv Mean_DFS Stdv #Retr Mean_CO Stdv Mean_DFS Stdv #Retr Mean_CO Stdv Mean_DFS Stdv #Retr' printf, 1, $ ' TIR NIR TIR+NIR' printf, 1, $ '------------------------------------------------------------------------------------------------------------------------------------------' openw, 2, 'MOPITTV6_daily_means_for_time_series_-60+60.txt' printf, 2, $ 'Date Mean_CO Stdv Mean_DFS Stdv #Retr Mean_CO Stdv Mean_DFS Stdv #Retr Mean_CO Stdv Mean_DFS Stdv #Retr' printf, 2, $ ' TIR NIR TIR+NIR' printf, 2, $ '------------------------------------------------------------------------------------------------------------------------------------------' endif else begin openu, 1, 'MOPITTV6_daily_means_for_time_series_all_lats.txt', /append openu, 2, 'MOPITTV6_daily_means_for_time_series_-60+60.txt', /append endelse for i=istart, iend do begin caldat, i, mm, dd, yy smm=strtrim(string(mm),2) & if (mm lt 10) then smm='0'+smm sdd=strtrim(string(dd),2) & if (dd lt 10) then sdd='0'+sdd syy=strtrim(string(yy),2) date=smm+' '+sdd+' '+syy result=MOPITTv6_daily_means_for_time_series(date) if total(finite(result, /nan)) ne n_elements(result) then begin ;won't write result if it's all NaN printf, 1, format='(a,x,3(4(f0,x),i0,x))', date, result(0,*,0), result(1,*,0), result(2,*,0) printf, 2, format='(a,x,3(4(f0,x),i0,x))', date, result(0,*,1), result(1,*,1), result(2,*,1) endif endfor close, 1 close, 2 end