filename = "/home/smrati/WORK/RS_RO_EXP/LOG_FILE_STATS/averages_atms.csv" ;---Read in file as array of strings so we can parse each line lines = asciiread(filename,-1,"string") delim = "," ;---Read fields The "var" suffix is used because "group" is a keyword. obs = str_get_field(lines,1,delim) Obs_cntl = tofloat(str_get_field(lines,2,delim)) RMSE_back_cntl = str_get_field(lines,4,delim) RMSE_anal_cntl = str_get_field(lines,6,delim) Obs_ro = tofloat(str_get_field(lines,7,delim)) RMSE_back_ro = str_get_field(lines,9,delim) RMSE_anal_ro = str_get_field(lines,11,delim) Index = ispan(0,28,1)*1. ;max_obs = where((tofloat(Obs_cntl)).gt.(tofloat(Obs_ro)),(tofloat(Obs_cntl)),(tofloat(Obs_ro))) diff_obs = (tofloat(Obs_cntl) - tofloat(Obs_ro))*100/(tofloat(Obs_cntl)) ;max_back = where((tofloat(RMSE_back_cntl)).gt.(tofloat(RMSE_back_ro)),(tofloat(RMSE_back_cntl)),(tofloat(RMSE_back_ro))) diff_back = (tofloat(RMSE_back_cntl) - tofloat(RMSE_back_ro))*100/(tofloat(RMSE_back_cntl)) ;max_anal = where((tofloat(RMSE_anal_cntl)).gt.(tofloat(RMSE_anal_ro)),(tofloat(RMSE_anal_cntl)),(tofloat(RMSE_anal_ro))) diff_anal = (tofloat(RMSE_anal_cntl) - tofloat(RMSE_anal_ro))*100/(tofloat(RMSE_anal_cntl)) ;printVarSummary(diff_obs) ;print(diff_obs) ;printVarSummary(diff_anal) ;print(" " + RMSE_anal_cntl+" "+RMSE_anal_ro) ;---To plot multiple lines, you must put them into a mulidimensional array. data = new((/3,dimsizes(diff_back)/),float) data(0,:) = diff_back data(1,:) = diff_anal data(2,:) = diff_obs wks = gsn_open_wks ("png","avg_back_anal_obs_rms_normaldiff_atms") ; send graphics to PNG file ;---Set plotting parameters res = True ; plot mods desired ; res@tiMainString = "Difference plot" ; add title ; res@gsnFrame = False ; don't advance frame yet res@vpHeightF= 0.4 ; change aspect ratio of plot res@vpWidthF = 0.7 res@trYMinF = min(data)-0.5 ; min value on y-axis res@trYMaxF = max(data)+0.5 ; max value on y-axis res@trXMinF = -1.0 ; min value on y-axis res@trXMaxF = 29.0 ; max value on y-axis res@tmXMajorGrid = True ; implement x grid res@tmXMajorGridThicknessF = 0.5 ; 2.0 is default res@vpXF = 0.2 ; start plot at x ndc coord res@tmXTOn = False res@tmXBOn = True ; have tick marks res@tmXBMode = "Explicit" ; label independently res@tmXBValues = Index ; location of labels res@tmXBLabelFontHeightF = 0.01 res@tmXBLabels = obs ; labels themselves res@tmXBLabelAngleF = 90.0 res@tiYAxisString = "Normalised Difference (%)" res@tiXAxisString = "Observations" res@gsnYRefLine = 0.0 res@xyMarkLineMode = "Markers" ; choose which have markers res@xyMarkers := (/16,16,15/) ; choose type of marker res@xyMarkerColors := (/"blue","red","black"/) ; Marker color res@xyMarkerSizes := (/0.005,0.007,0.01/) ; Marker size (default 0.01) ; add a legend res@pmLegendDisplayMode = "Always" ; turn on legend res@pmLegendSide = "Top" ; Change location of res@pmLegendParallelPosF = .90 ; move units right res@pmLegendOrthogonalPosF = 0.05 ; more neg = down res@xyExplicitLegendLabels = (/"Background","Analysis","OBS"/) res@pmLegendWidthF = 0.12 ; Change width and res@pmLegendHeightF = 0.15 ; height of legend. res@lgLabelFontHeightF = .015 ; change font height res@lgPerimOn = False ; no box around plot = gsn_csm_xy(wks,Index,data(1,:),res) ; create plot