Re: Plotting errors using ExplicitLevels

From: Rick Brownrigg <brownrig_at_nyahnyahspammersnyahnyah>
Date: Mon Mar 14 2011 - 11:15:17 MDT

Hi Agnes,

I think you may need to delete the attribute cnLevels before setting it to some else:

   delete(res@cnLevels)

(although that said, I'm surprised ncl did not complain about every plot after the first).

Hope that helps...
Rick

On Mar 14, 2011, at 10:30 AM, Agnes Lim wrote:

> Hi
>
> I had the following code segment for plotting a panel plot. However,
> when making plot(1), it returns error saying "Dimension size of
> attribute and right-hand side of assignment do not match".
> I tested with AtumaticLevels and everything was plotted nicely.
>
> Does not seem to find any possible problems. Please advise.
>
> Thanks
> Agnes
>
> =========================================================
> res=True
> res@gsnDraw=False
> res@gsnFrame=False
> res@cnMonoLineColor=False
> res@gsnContourNegLineDashPattern=1
> res@cnFillOn = True ; turn on color
> res@gsnSpreadColors = True ; use entire color map
> res@pmLabelBarDisplayMode="Always"
>
> min_xy=min((/min_DT_wrf_xy,min_DT_gfs_xy/))
> max_xy=max((/max_DT_wrf_xy,max_DT_gfs_xy/))
> res@cnMinLevelValF = min_xy
> res@cnMaxLevelValF = max_xy
> print(min_xy)
> print(max_xy)
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = (/-0.05, 0.00, 0.05, 0.10, 0.15, 0.20, 0.25,
> 0.30, 0.35,\
> 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70/)
> plot(0)=gsn_contour(wks, DT_wrf(kmax,:,:), res)
>
> min_xz=min((/min_DT_wrf_xz,min_DT_gfs_xz/))
> max_xz=max((/max_DT_wrf_xz,max_DT_gfs_xz/))
> res@cnMinLevelValF = min_xz
> res@cnMaxLevelValF = max_xz
> print(min_xz)
> print(max_xz)
> printVarSummary(DT_wrf(:,jmax,:))
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = (/-0.60, -0.50, -0.40, -0.30, -0.20, -0.10, 0.00, \
> 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70/)
> plot(1)=gsn_contour(wks, DT_wrf(:,jmax,:), res)
>
> min_yz=min((/min_DT_wrf_yz,min_DT_gfs_yz/))
> max_yz=max((/max_DT_wrf_yz,max_DT_gfs_yz/))
> res@cnMinLevelValF = min_yz
> res@cnMaxLevelValF = max_yz
> print(min_yz)
> print(max_yz)
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = (/-0.60, -0.55, -0.50, 0.45, -0.40, -0.35, -0.30,
> -0.25, -0.20, -0.15, -0.10, -0.05, 0.00,\
> 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35,
> 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75,\
> 0.80/)
> plot(2)=gsn_contour(wks, DT_wrf(:,:,imax), res)
>
> min_xy=min((/min_DU_wrf_xy,min_DU_gfs_xy/))
> max_xy=max((/max_DU_wrf_xy,max_DU_gfs_xy/))
> res@cnMinLevelValF = min_xy
> res@cnMaxLevelValF = max_xy
> print(min_xy)
> print(max_xy)
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = (/-0.50, 0.45, -0.40, -0.35, -0.30, -0.25, -0.20,
> -0.15, -0.10, -0.05, 0.00,\
> 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35,
> 0.40, 0.45, 0.50, 0.55/)
> plot(3)=gsn_contour(wks, DU_wrf(kmax,:,:), res)
>
> min_xz=min((/min_DU_wrf_xz,min_DU_gfs_xz/))
> max_xz=max((/max_DU_wrf_xz,max_DU_gfs_xz/))
> res@cnMinLevelValF = min_xz
> res@cnMaxLevelValF = max_xz
> print(min_xz)
> print(max_xz)
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = (/-0.11, -0.10, -0.09, -0.08, -0.07, -0.06,
> -0.05, -0.04, -0.03, -0.02, -0.01, 0.00, \
> 0.01, 0.02, 0.03, 0.04/)
> plot(4)=gsn_contour(wks, DU_wrf(:,jmax,:), res)
>
> min_yz=min((/min_DU_wrf_yz,min_DU_gfs_yz/))
> max_yz=max((/max_DU_wrf_yz,max_DU_gfs_yz/))
> res@cnMinLevelValF = min_yz
> res@cnMaxLevelValF = max_yz
> print(min_yz)
> print(max_yz)
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = (/-0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1,
> 0.00, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, \
> 0.7, 0.8, 0.9/)
> plot(5)=gsn_contour(wks, DU_wrf(:,:,imax), res)
>
> min_xy=min((/min_DV_wrf_xy,min_DV_gfs_xy/))
> max_xy=max((/max_DV_wrf_xy,max_DV_gfs_xy/))
> res@cnMinLevelValF = min_xy
> res@cnMaxLevelValF = max_xy
> print(min_xy)
> print(max_xy)
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = (/-0.50, 0.45, -0.40, -0.35, -0.30, -0.25, -0.20,
> -0.15, -0.10, -0.05, 0.00,\
> 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35,
> 0.40, 0.45, 0.50, 0.55/)
> plot(6)=gsn_contour(wks, DV_wrf(kmax,:,:), res)
>
> min_xz=min((/min_DV_wrf_xz,min_DV_gfs_xz/))
> max_xz=max((/max_DV_wrf_xz,max_DV_gfs_xz/))
> res@cnMinLevelValF = min_xz
> res@cnMaxLevelValF = max_xz
> print(min_xz)
> print(max_xz)
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = (/-0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1,
> 0.00, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, \
> 0.7, 0.8, 0.9/)
> plot(7)=gsn_contour(wks, DV_wrf(:,jmax,:), res)
>
> min_yz=min((/min_DV_wrf_yz,min_DV_gfs_yz/))
> max_yz=max((/max_DV_wrf_yz,max_DV_gfs_yz/))
> res@cnMinLevelValF = min_yz
> res@cnMaxLevelValF = max_yz
> print(min_yz)
> print(max_yz)
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = (/-0.05, -0.045, -0.04, -0.035, -0.03, -0.025,
> -0.02, -0.015, -0.01, -0.005, 0.00, \
> 0.005, 0.01, 0.015, 0.02, 0.025, 0.03/)
> plot(8)=gsn_contour(wks, DV_wrf(:,:,imax), res)
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Mar 14 11:15:24 2011

This archive was generated by hypermail 2.1.8 : Wed Mar 16 2011 - 09:22:37 MDT