[ncl-talk] can't seem to make my arrows bigger
David Brown
dbrown at ucar.edu
Mon Apr 27 23:25:31 MDT 2015
Hi Lesley, Kyle, et al.,
In fact there is a maximum vector length, which is set to twice the
width of the viewport. It's possible that this restriction could be
relaxed, but it was setup with the idea that vectors longer than this
would make for a fairly meaningless plot since you would end up with
vectors where you could see neither the head or the tail, just a line
through the plot.
The problem with plotting this data as vectors is that the range of
the component values is very wide, and it is not distributed in
anything like a linear fashion.
I used the stat_dispersion function to calculate statistics on the U
(xT20), V (zT20), and the vector magnitude of these components. The
maximum value of the vector magnitudes is 5.77226e+09, but the upper
1% of values is only 8.79354e+07, the median is 1.25068e+06, and the
lower 1% is 0.25. Since the VectorPlot uses linear scaling to size
the vector arrow, if the maximum magnitude is the reference, then most
of the visible vectors will have a negligible size. Also the
horizontal component seems to have a much wider range and a larger
magnitude in general such that they mostly overwhelm the vertical
component.
You can make the small vectors have some length by setting the
vcMinFracLengthF resource -- .5 will make the smallest vector half the
size of the ref length vector. 1.0 makes all the vectors the same
size.
You might also choose to set the reference magnitude to the upper 1
percentile value. You could eliminate the largest vectors by setting
vcMaxMagnitudeF.
I played around with this script, but not knowing the science, I am
not sure what is really appropriate. Anyway I am attaching a modified
version of the script that may help suggest further improvements.
-dave
On Mon, Apr 27, 2015 at 2:22 PM, Lesley Smith - NOAA Affiliate
<lesley.l.smith at noaa.gov> wrote:
> Hi Kyle and other NCL-ers,
> Thanks for the ideas.
> I had already tried the default values and got tiny arrows.
> I had already tried printing out the default values to see what they were so
> I could tweak them.
> Attached are the data, pared-down program, and resulting plot.
> Let me know if I need to use the NCL ftp site.
>
> Here's the output from this program:
>
> (0) ref len is 0.0106101
>
> (0) ref mag is 5.77226e+09
>
> (0) ref dist is 0.03
>
>
> I'm open to any and all suggestions.
> I suspect I need to scale the Z values and/or do some kind of
> pressure-weighting (my attempts at this so far haven't worked)
> or there's something obvious I'm missing...
> Thanks for any insights!
> -Lesley
>
> On Mon, Apr 27, 2015 at 10:12 AM, Kyle Griffin <ksgriffin2 at wisc.edu> wrote:
>>
>> Hi Lesley,
>>
>> First, please make sure ncl-talk is included in future replies, as others
>> may also have useful insights.
>>
>> My next suggestion would be to try unsetting the vcRefMagnitudeF and
>> vcRefLenghtF - NCL has the ability to calculate these by default to create a
>> plot that at least looks somewhat reasonable. Although the resultant plot is
>> not likely to be the results you actually want, you can look at the settings
>> it chooses and use that as guidance.
>>
>> Some code like this after the plot is drawn might be insightful:
>>
>> getvalues plot ; plot is whatever you have saved your vector plot as,
>> e.g. plot=gsn_csm_vector(....)
>> vcRefMagnitueF : calc_ref_mag
>> vcRefLengthF : calc_ref_length
>> end getvalues
>>
>> print("Mag: "+calc_ref_mag+" Length: "+calc_ref_length)
>>
>>
>> If this doesn't provide the insight you are looking for, please include
>> your code (even if simplified) and data in a response if you can, using the
>> NCL FTP site if necessary, and someone can take a look at it. I'm also
>> wondering if there might be some internal limits to vector size settings,
>> but at the moment, I can't think of any good reason why this would be the
>> case (but I'm also not a developer, either).
>>
>>
>> Kyle
>>
>> ----------------------------------------
>> Kyle S. Griffin
>> Department of Atmospheric and Oceanic Sciences
>> University of Wisconsin - Madison
>> Room 1421
>> 1225 W Dayton St, Madison, WI 53706
>> Email: ksgriffin2 at wisc.edu
>>
>> On Mon, Apr 27, 2015 at 10:38 AM, Lesley Smith - NOAA Affiliate
>> <lesley.l.smith at noaa.gov> wrote:
>>>
>>> Hi Kyle,
>>> I appreciate you writing me back.
>>> I'm plotting meridional and vertical EP flux with my arrows, not winds.
>>> The values are of magnitude 1.e10 and 1.e8
>>> For example, meridional_EP_flux: min=-1.6812e+10 max=1.07296e+10
>>>
>>> vertical_EP_flux: min=-1.53672e+08 max=1.33486e+08
>>>
>>> Thus, my values are on the order of 2,000,000,000
>>>
>>>
>>> Your suggestions result in:
>>>
>>> fatal:VectorPlotDraw: VVECTR - VECTOR NDC LENGTH TOO GREAT
>>>
>>> fatal:VectorPlotDraw: error drawing vectors
>>>
>>> fatal:VectorPlotDraw: draw error
>>>
>>> fatal:PlotManagerDraw: error in plot draw
>>>
>>> fatal:_NhlPlotManagerDraw: Draw error
>>>
>>>
>>> Do you have any other suggestions?
>>> Thanks,
>>> -Lesley
>>>
>>> On Fri, Apr 24, 2015 at 7:40 PM, Kyle Griffin <ksgriffin2 at wisc.edu>
>>> wrote:
>>>>
>>>> Hi Lesley,
>>>>
>>>> I think you've switched your reference vector settings around. You
>>>> should be either making vcRefMagnitudeF *smaller* or making vcRefLengthF
>>>> *larger*. These act in concert to control the size of the vectors in your
>>>> plot. Each actually controls the magnitude and length of the vector in the
>>>> reference vector box in the bottom right of your attached image. You'll note
>>>> that in this current setting, you would need a wind speed of 2,000,000,000
>>>> m/s to have a vector plotted at that size. In reality, you might want to set
>>>> vcRefMagnitudeF to a value somewhere between 10.0 and 50.0. If this still
>>>> doesn't make your vectors large enough, reduce the vcRefMagnitudeF to 1.0
>>>> and I'm sure you'll see some EP flux arrows appear. You can always check the
>>>> max() and min() of your vector field if you aren't sure the actual
>>>> magnitudes you are dealing with.
>>>>
>>>> Let us know if you have any more questions.
>>>>
>>>>
>>>> Kyle
>>>>
>>>> ----------------------------------------
>>>> Kyle S. Griffin
>>>> Department of Atmospheric and Oceanic Sciences
>>>> University of Wisconsin - Madison
>>>> Room 1421
>>>> 1225 W Dayton St, Madison, WI 53706
>>>> Email: ksgriffin2 at wisc.edu
>>>>
>>>> On Fri, Apr 24, 2015 at 4:20 PM, Lesley Smith - NOAA Affiliate
>>>> <lesley.l.smith at noaa.gov> wrote:
>>>>>
>>>>> Hi gang,
>>>>> I'm using gsn_csm_pres_hgt_vector to make a plot.
>>>>> In the past it has worked great for me.
>>>>>
>>>>> This time, I can't seem to make my arrows big enough to see
>>>>> anything. I attach a plot of contoured EP Divergence with the
>>>>> corresponding 2 EP components in vector form overlaid. The components
>>>>> are many orders of magnitude greater than the divergence.
>>>>> I've tried changing vcRefMagnitudeF and vcRefMagnitudeF to
>>>>> a variety of values and the arrows look the same.
>>>>> I tried scaling the vertical component (like one of the examples on the
>>>>> NCL website) to no effect.
>>>>>
>>>>> Eventually when I make vcRefMagnitudeF too small it suddenly gives the
>>>>> error:
>>>>>
>>>>> fatal:VectorPlotDraw: VVECTR - VECTOR NDC LENGTH TOO GREAT
>>>>>
>>>>> fatal:VectorPlotDraw: error drawing vectors
>>>>>
>>>>> fatal:VectorPlotDraw: draw error
>>>>>
>>>>> fatal:PlotManagerDraw: error in plot draw
>>>>>
>>>>> fatal:_NhlPlotManagerDraw: Draw error
>>>>>
>>>>>
>>>>>
>>>>> I'd love any suggestions!
>>>>>
>>>>> Thanks!
>>>>>
>>>>> -Lesley
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_vector_EP_flux.ncl
Type: application/octet-stream
Size: 2085 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150427/041bef61/attachment.obj
More information about the ncl-talk
mailing list