[ncl-talk] Curly Vector issue

David Brown dbrown at ucar.edu
Tue Aug 12 10:05:15 MDT 2014


Hi Yohan,
Actually your data does have NaNs at two identical locations in both the U
and V data files:

ncl 19> var1 = f1->va850_dtrend_Mean
ncl 20> print(var1(84,127))


Variable: var1 (subsection)
Type: float
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:   [1]
Coordinates:
Number Of Attributes: 4
  lon : 318.75
  lat : 79.88764
  average_op_ncl :      dim_avg_n over dimension(s): time
  _FillValue :  -1e+10
(0)     nan
ncl 21> print(var1(63,18))


Variable: var1 (subsection)
Type: float
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:   [1]
Coordinates:
Number Of Attributes: 4
  lon : 46.25
  lat : 37.41573
  average_op_ncl :      dim_avg_n over dimension(s): time
  _FillValue :  -1e+10
(0)     nan

CurlyVector drawing is more sensitive than ordinary vector drawing to the
presence of NaNs because more than one grid point is involved in producing
each glyph. NCL graphics are not documented to be NaN-proof, so you need to
remove all the NaNs prior to calling any graphics routines.
It is easily done using replace_nanieee:

  var1    = f1->$varname1$
  var2    = f2->$varname2$
  replace_ieeenan(var1,var1 at _FillValue,0)
  replace_ieeenan(var2,var2 at _FillValue,0)
  lat     = f1->$"lat"$
  lon     = f1->$"lon"$

Your script works fine in CurlyVector mode after adding the replace_ieeenan
lines.
 -dave


On Mon, Aug 11, 2014 at 11:25 AM, David Brown <dbrown at ucar.edu> wrote:

> Thanks Yohan,
>
> I have reproduced the seg fault with your script and data. I'll let you
> know what the problem is as soon as I figure it out.
>  -dave
>
>
> On Fri, Aug 8, 2014 at 12:22 PM, <ruprich at cerfacs.fr> wrote:
>
>> Hi Dave,
>>
>> I put my u and v component files on the ftp site. Their name are:
>> CM2.1_DJFM_501_4000_ua850_dtrend_Mean.nc
>> CM2.1_DJFM_501_4000_va850_dtrend_Mean.nc
>>
>> And please see attached my simplify script that target the problem, or you
>> can find it on the ftp site as well:
>> Plot_Clim_Test_For_Dave.ncl
>>
>> Many thanks,
>> Yohan
>>
>> > Well as I said, I would like to run your script here. There should not
>> be
>> > a
>> > seg fault, so there must be a bug somewhere that I would like to fix. So
>> > if
>> > you can upload your data and script to the ftp site as described in the
>> > bug
>> > report page, I would appreciate it. I am going to be off work for the
>> rest
>> > of this week, but I will take a look at this first thing next Monday if
>> I
>> > have the files.
>> >  -dave
>> >
>> >
>> > On Wed, Aug 6, 2014 at 7:09 PM, <ruprich at cerfacs.fr> wrote:
>> >
>> >> Hi Dave,
>> >>
>> >> thank you for your answer.
>> >>
>> >> Actually, my data look fine. I already ploted the u and v components
>> >> with
>> >> ferret to verify it and I also print the Min and Max of those
>> components
>> >> with NCL and everything look normal.
>> >> When I run the same script with the standard option "LineArrow" of the
>> >> vcGlyphStyle resource my script works and I obtain a nice plot with
>> >> westerlies and esterlies at good places. An excpetion should be note at
>> >> the longitude 0 where vectors seem to overlap each other.
>> >> But, if I switch the vcGlyphStyle option to "CurlyVector", it leads to
>> a
>> >> segmentation fault.
>> >>
>> >> Also, I tried to plot it with a different approach, using the SfXArray
>> >> and
>> >> SfYArray resources. Again, I obtain good results when I run my script
>> >> with
>> >> the standard vcGlyphStyle option but a segmentation fault when I use
>> the
>> >> "CurlyVector" option.
>> >>
>> >> Many thanks,
>> >> Yohan
>> >>
>> >>
>> >> > Hi Yohan,
>> >> >
>> >> > I would first want to make sure your data is valid: try printing the
>> >> max
>> >> > and min of each variable. Also make sure that there are no NaN values
>> >> in
>> >> > the data. You can use isnan_ieee to discover whether there are NaNs
>> in
>> >> the
>> >> > data. If the data seems okay, then I would like to take a look at
>> your
>> >> > complete script along with the data. Please look at "Report bugs"
>> >> under
>> >> > the "Support" tab on the NCL web site. Let me know offline when you
>> >> have
>> >> > uploaded the relevant files. Thank you.
>> >> >  -dave
>> >> >
>> >> >
>> >> > On Wed, Aug 6, 2014 at 5:33 PM, <ruprich at cerfacs.fr> wrote:
>> >> >
>> >> >> Dear NCL users,
>> >> >>
>> >> >> I have some problem using the vcGlyphStyle resource. When I chose
>> the
>> >> >> option "CurlyVector", my script leads to a Segmentation fault.
>> >> >> Do you know any reason for that?
>> >> >>
>> >> >> Here is some pieces of my script:
>> >> >>
>> >> >> 1) I load 2 variables:
>> >> >>
>> >> >>   Variable: var1
>> >> >>   Type: float
>> >> >>   Total Size: 51840 bytes
>> >> >>               12960 values
>> >> >>   Number of Dimensions: 2
>> >> >>   Dimensions and sizes:   [lat | 90] x [lon | 144]
>> >> >>   Coordinates:
>> >> >>               lat: [-89.49438..89.49438]
>> >> >>               lon: [1.25..358.75]
>> >> >>   Number Of Attributes: 2
>> >> >>     _FillValue :  -1e+10
>> >> >>     average_op_ncl :      dim_avg_n over dimension(s): time
>> >> >>
>> >> >>
>> >> >>   Variable: var2
>> >> >>   Type: float
>> >> >>   Total Size: 51840 bytes
>> >> >>               12960 values
>> >> >>   Number of Dimensions: 2
>> >> >>   Dimensions and sizes:   [lat | 90] x [lon | 144]
>> >> >>   Coordinates:
>> >> >>               lat: [-89.49438..89.49438]
>> >> >>               lon: [1.25..358.75]
>> >> >>   Number Of Attributes: 2
>> >> >>     _FillValue :  -1e+10
>> >> >>     average_op_ncl :      dim_avg_n over dimension(s): time
>> >> >>
>> >> >>
>> >> >>
>> >> >> 2) I define the resources for my plot:
>> >> >>   res                         = True
>> >> >>
>> >> >>   res at gsnDraw                 = False              ; don't draw
>> >> >>   res at gsnFrame                = False              ; don't advance
>> >> frame
>> >> >>   res at gsnAddCyclic            = True
>> >> >>   res at vcGlyphStyle            = "CurlyVector"
>> >> >>
>> >> >>
>> >> >>
>> >> >> 3) I plot:
>> >> >>   wks     = gsn_open_wks(pltTypeLocal, plotDir+plotName)
>> >> >>   plot    = new(1, "graphic")
>> >> >>
>> >> >>   plot(0) = gsn_csm_vector_map(wks, var1, var2, res)
>> >> >>
>> >> >>   draw(wks)
>> >> >>   frame(wks)
>> >> >>
>> >> >>
>> >> >>
>> >> >> That's pretty much it... And if I run this script without the
>> >> >> "CurlyVector" option it works.
>> >> >>
>> >> >> Than you,
>> >> >> Yohan
>> >> >>
>> >> >> PS: I am running this script with the 6.1.2 ncl version
>> >> >>
>> >> >> _______________________________________________
>> >> >> ncl-talk mailing list
>> >> >> List instructions, subscriber options, unsubscribe:
>> >> >> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140812/47f697d3/attachment.html 


More information about the ncl-talk mailing list