; RMS_timeseries_plot_2D.ncl ; ; usage: ; ; 1) user should enter values for the following variables ; fname1, fname2 : full pathnames of model output ; varname : variable being compared ; desc_title : descriptive text that will be place in plot title ; plotname : root of filename of generated plot, format is hardcoded to be PDF ; ; 2) run the following command at the shell prompt ; ncl surf2d_RMS_timeseries_plot.ncl ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" begin ; ; user edits start here ; fname1 = "/ptmp/dbailey/archive/D_cntle/ice/hist/D_cntle.cice.h_inst.nc" fname2 = "/ptmp/dbailey/archive/D_cntlej/ice/hist/D_cntlej.cice.h_inst.nc" desc_title = "Ice thickness bluefire vs jaguar" varname = "hisnap" plotname = "hisnap" ; ; user should not need to edit below this point ; fid1 = addfile(fname1, "r") fid2 = addfile(fname2, "r") vardimsizes = filevardimsizes(fid1, varname) tlen = vardimsizes(0) vartype = getfilevartypes(fid1, varname) rmsdiff = new(tlen, vartype) rmsdiff@long_name = fid1->$varname$@long_name rmsdiff@units = fid1->$varname$@units time = fid1->time tarea = fid1->tarea var1 = fid1->$varname$ var2 = fid2->$varname$ ; loop over time index to avoid memory cost of ; having entire array in memory at once opt = 0 do tind = 0, tlen-1 rmsdiff(tind) = wgt_arearmse2(var1(tind,:,:), \ var2(tind,:,:), \ tarea, opt) end do ; create plot wks = gsn_open_wks("pdf", plotname) res = True res@tiMainString = rmsdiff@long_name+"~C~"+"RMS diff, "+desc_title res@tiMainFuncCode = "~" res@tiXAxisString = time@units res@tiXAxisFuncCode = "~" res@tiYAxisString = rmsdiff@units if (any(rmsdiff .gt. 0.0)) then res@trYLog = True if (any(rmsdiff .eq. 0.0)) then rmsdiff(ind(rmsdiff .eq. 0.0)) = rmsdiff@_FillValue end if res@trYMinF = min(rmsdiff) end if plot = gsn_xy(wks, time, rmsdiff, res) end