Re: vector problem

From: Mary Haley (haley AT ucar.edu)
Date: Fri Jun 24 2005 - 10:42:41 MDT

  • Next message: James P. Edwards: "natgrid"

    Hi everybody,

    I made the answer harder than it needed to be! Adam Phillips reminded
    me that this data is cyclic and already has a cyclic pointed added.
    Since the resource "gsnAddCyclic" is set to True by default, this means
    it is trying to add another cyclic point, which is going to cause problems
    as you saw.

    The answer is to simply set "res@gsnAddCyclic = False". Meanwhile,
    I will look at the gsn_xxxx scripts to see if I can make the error
    message more user friendly in situations like this.

    --Mary

    On Fri, 24 Jun 2005, Mary Haley wrote:

    >
    > On Fri, 24 Jun 2005, jerry wrote:
    >
    >> Hi
    >> I want to draw a vector with attach file but it will have the follow error
    >> message :
    >>
    >> wrning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation
    >> for
    >> X axis failed: consider adjusting trXTensionF value
    >> warning:IrTransInitialize: error creating spline approximation for
    >> trXCoordPoints; defaulting to linear
    >> warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation
    >> for
    >> X axis failed: consider adjusting trXTensionF value
    >> warning:IrTransInitialize: error creating spline approximation for
    >> trXCoordPoints; defaulting to linear
    >>
    >> below is my ncl scripts :
    >>
    >> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
    >> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
    >>
    >> begin
    >>
    >> dir = ncargpath("data")
    >> in = addfile(dir+"/cdf/941110_UV.cdf","r")
    >> u = in->u(:,:)
    >> v = in->v(:,:)
    >>
    >> wks = gsn_open_wks("x11","xy_vector")
    >> res = True
    >> res@vcRefMagnitudeF = 10 ; make vectors larger
    >> res@vcRefLengthF = 0.045 ; ref vec length
    >> res@vcGlyphStyle = "CurlyVector" ; turn of curly vectors
    >> res@vcMinDistanceF = 0.017 ; thin out vectors
    >> plot = gsn_csm_vector_map(wks,u,v,res)
    >>
    >> end
    >>
    >> if i set res@vfXCStartV res@vfXCEndV res@vfYCStartV
    >> res@vfYCEndV that it can work
    >>
    >>
    >> Thank you
    >
    > Generally when you get an error message from NCL about attempting to
    > create spline approximation, this means that it is having a hard time
    > interpolating your coordinate variable values. This is usually due to
    > the coordinate data having "gaps" in it. One example of this is if
    > you have coordinate data near the north and south poles, but not
    > in-between, and yet you are trying to plot your data over the whole
    > map.
    >
    > In your script above, the longitude data is equally spaced by 5. It is
    > overkill to use longitude/latitude arrays if they are equally spaced,
    > so in this case, I recommend using the resources that you listed above
    > (vcXCStartV/vcXCEndV and vcYStartV/vcYEndV). I'm not sure why NCL
    > cannot handle the longitude coordinate arrays in this situation. I'll
    > ask one of the developers about this.
    >
    > If you run into this problem and you don't have equally-spaced
    > coordinate data, then you can try a couple of other things. First, you
    > can try adjusting the trXTensionF value as it suggests. Here's the
    > resource description:
    >
    > Specifies the value of the tension parameter applied to the spline
    > approximation used to set up the irregular transformation for the
    > X Axis coordinate system. Small values (less than ~1.0) imply a
    > relaxed approximation; large values (greater than ~5.0) imply a
    > tight approximation. Note that large values of this parameter
    > (>~10.0) may cause the transformation to become unstable or even
    > fail.
    >
    > Default value is 2.0.
    >
    > Secondly, you can try plotting just a subset of your data by using
    > coordinate subscripting. For example:
    >
    > plot = gsn_csm_vector_map(wks,u({0:90},{-180:0},v({0:90},{-180:0}),res)
    >
    > You'll want to use an area of your coordinate values that are
    > reasonably spaced and don't have any gaps.
    >
    > --Mary
    > _______________________________________________
    > ncl-talk mailing list
    > ncl-talk@ucar.edu
    > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
    >
    _______________________________________________
    ncl-talk mailing list
    ncl-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Fri Jun 24 2005 - 10:46:07 MDT