Re: "Zero field" message while trying to plot a vector field (continued)

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Jun 25 2012 - 08:31:58 MDT

Dear Quentin,

You didn't indicate how you were reading in the U_ctl_1 and W_ctl_1 variables. If you're getting a zero field, this is likely because something is wrong with the data.

You might want to look at it with "printMinMax" to make sure the values look okay:

; Required at top of script after gsn_csm.ncl load:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
. . .

   printMinMax(u_ctl_1(0,:,:),0)
   printMinMax(v_ctl_1(0,:,:),0)

Also, I'm not sure why you are setting:

> r3@vfUDataArray = U_ctl_1(0,:,:)
> r3@vfVDataArray = W_ctl_1(0,:,:)

This is being done internally by gsn_csm_vector, so need to remove these lines.

I don't think setting:

r3@trGridType = "TriangularMesh"

is going to have any effect.

--Mary

On Jun 25, 2012, at 8:17 AM, Lejeune Quentin Gaël Léo wrote:

> Dear all,
>
> I' m currently facing a problem while trying to make a plot with the version 6.0.0 of NCL. I've attached the script I'm running and the plot I get to this mail.
>
> I'm trying to plot together 2 contour fields and a vector field on a vertical cross-section, using the functions "overlay", gsn_csm_contour and gsn_csm_vector. My data are 2D and have 2-dimensional vertical and longitudinal coordinates (height_1 and lon_1). I am also using the grid type "TriangularMesh" to make the topography appear at the bottom.
> My problem is that I get a ZERO FIELD error message in the middle of my plot instead of the vectors, even if I could plot the 2 contour fields. Here is part of my script:
>
> ;;;;;;;
> ; Plot of the transects
> wks = gsn_open_wks("x11","trans_lon_ctl_DJF")
> gsn_define_colormap(wks,"hotcold_18lev")
>
> ;; 1st transect
> r = True
> r@trGridType = "TriangularMesh" ; To plot the topography
> r@gsnMaximize = True
> r@gsnDraw = False
> r@gsnFrame = False
> r@cnLinesOn = False ; no contour lines
> r@cnFillOn = True
> r@cnLevelSelectionMode = "ExplicitLevels"
> r@cnLevels = (/-5,-2.5,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30/)
> r@gsnSpreadColors = True
> r@sfXArray = lon_1
> r@sfYArray = height_1
> r@trYMaxF = 6000
> cn_1 = gsn_csm_contour(wks,T_ctl_1(0,:,:),r)
>
>
> r2 = True
> r2@trGridType = "TriangularMesh" ; To plot the topography
> r2@gsnMaximize = True
> r2@gsnDraw = False
> r2@gsnFrame = False
> r2@cnLevelSelectionMode = "ExplicitLevels"
> r2@cnLevels = (/0.05,0.1,0.15,0.2,0.25,0.3/)
> r2@cnLineColor = "black"
> r2@cnLineLabelPerimOn = False
> r2@sfXArray = lon_1
> r2@sfYArray = height_1
> cn_2 = gsn_csm_contour(wks,QC_ctl_1(0,:,:),r2)
>
> r3 = True
> r3@trGridType = "TriangularMesh" ; To plot the topography
> r3@gsnMaximize = True
> r3@gsnDraw = False
> r3@gsnFrame = False
> r3@vfUDataArray = U_ctl_1(0,:,:)
> r3@vfVDataArray = W_ctl_1(0,:,:)
> r3@vfXArray = lon_1
> r3@vfYArray = height_1
> cn_3 = gsn_csm_vector(wks,U_ctl_1(0,:,:),W_ctl_1(0,:,:),r3)
>
> overlay(cn_1,cn_2)
> overlay(cn_1,cn_3)
> draw(cn_1)
> frame(wks)
>
>
> I haven't found any information on how to manage this error in such a case, so any help would be really appreciated.
> Regards,
>
> Quentin
> <cross_section_copy.ncl><trans_lon_ctl_DJF.eps>_______________________________________________
> 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 Jun 25 08:32:11 2012

This archive was generated by hypermail 2.1.8 : Mon Jun 25 2012 - 09:57:23 MDT