load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin ; define file name wkdir = "./" pldir = "./" fil_dat = "AOT_550_all" ; read data ; list all AOT files for different years files = systemfunc("ls " + wkdir +"AOT_550*.txt") print(files) ; number of files nfiles = dimsizes(files) nday = 365 ; number days in a year ; define fields with number of years (files) and number days per year AOT_550_all = new((/nfiles,nday/),"float") day_all = new((/nfiles,nday/),"float") ; loop through different years to read the files do n= 0,nfiles-1 print(files(n)) z1 = asciiread(files(n),(/nday+1/),"string") printVarSummary(z1) new_str = str_split_csv(z1,",",1) printVarSummary(new_str) variables = new_str(0,0:6) print(variables) Day = stringtoint(new_str(1:nday,0)) AOT_675 = stringtofloat(new_str(1:nday,1)) AOT_500 = stringtofloat(new_str(1:nday,2)) AOT_440 = stringtofloat(new_str(1:nday,3)) AOT_440_675 = stringtofloat(new_str(1:nday,4)) AOT_550 = stringtofloat(new_str(1:nday,5)) x = Day printVarSummary(x) ;************************************************** ; create plot ;************************************************** ;define the workstation (plot type and name) wks = gsn_open_wks("png","AOT_550_"+n) ;set resources res = True res@gsnDraw = False res@gsnFrame = False res@tiMainString = "AOT_550_all_years Examples" res@xyLineThicknessF = 5 res@trYMinF = 0.0 res@trYMaxF = 4.0 res@trXMinF = 1 res@trXMaxF = 400 res@xyDashPattern = 0 ;-- make lines all solid res@xyLineColor = (/"blue", "red", "green", "black", "orange", "gray", "purple", "orange", "yellow"/) plot = gsn_csm_xy(wks, x, AOT_550, res) draw(plot) frame(wks) end