[ncl-talk] gsn_csm_streamline_scalar_map segmentation fault

Alan Brammer abrammer at albany.edu
Thu Jul 6 16:31:21 MDT 2017


ok, it's not my contribution to this function causing the problem. So I'm
off the hook :)

You've got some NaNs hiding in the data.

print(any(isnan_ieee(Uwavghist)))
print(num(isnan_ieee(Uwavghist)))


You can simply switch the nans for FillValues with
replace_ieeenan(Uwavghist, Uwavghist at _FillValue, 0)
replace_ieeenan(Vwavghist, Vwavghist at _FillValue, 0)
replace_ieeenan(windwavghist, windwavghist at _FillValue, 0)

The map functions will handle the fillvalue and just skip over those cells.
There are only 3 cells with nans, so if you didn't want to break the
streamlines you could poisson_grid_fill() to smooth over the gaps or
similar.

There's also the question of understanding why there are nans in there.


Good luck.



On Thu, Jul 6, 2017 at 6:09 PM, Meina Wang <mnawang at ucdavis.edu> wrote:

> Dear Alan,
>
> Thank you for your reply! I've also previously used this function before
> and had no problem. I ran the code on our university cluster, so there is
> enough RAM to store the variable.
>
> Below attached is the outputted .nc file that goes into the function.
> I've gave it a quick "ncview" check and didn't see any problem with the
> data. Please let me know if you found anything wrong.  Thank you very much
> for your help!
>
> Best regards,
> Meina
>
>
>
> On Thu, Jul 6, 2017 at 11:54 AM, Alan Brammer <abrammer at albany.edu> wrote:
>
>> Would probably help to see the data.   I’ve used this function a lot,
>> with bigger domains than yours and not had issue.  However the function
>> will duplicate domains, so if you’re on a laptop with very limited RAM it
>> may struggle.
>>
>> You could save your plotting data to a small netcdf and send it to the
>> list, based on the summary, the netcdf should be small than 1 MB.
>>
>> ncout= addfile(“ncl_talk_streamline_data.ncl”,”c”)
>> ncout->Uwavghist = Uwavghist
>> ncout->Vwavghist = Vwavghist
>> ncout->windwavghist = windwavghist
>>
>>
>> the ftp server is also an option if the output ends up too big.
>>
>>
>>
>> Alan
>>
>>
>>
>>
>> ##############################
>> Alan Brammer,
>> Post-Doc Researcher
>>
>> Department of Atmospheric and Environmental Sciences,
>> University at Albany, State University of New York, Albany, NY, 12222
>> abrammer at albany.edu
>> ##############################
>>
>> On 6 Jul 2017, at 14:05, Meina Wang <mnawang at ucdavis.edu> wrote:
>>
>> Dear Mary,
>>
>> Thank you very much for your reply, and for running the test case! The
>> variable is not a very large one, and I also tried to do the vector plot
>> using "vcres at vcGlyphStyle = "CurlyVector"" but also got the "Segmentation
>> fault". The only option that works is the vcres at vcGlyphStyle =
>> "WindBarb". Please see below for the printVarSummary info and the
>> resources setting.  Thank you very much again for your help, and please let
>> me know if you spot anything suspicious.
>>
>> Output from printVarSummary(Uwavghist):
>> Variable: Uwavghist
>> Type: float
>> Total Size: 76800 bytes
>>             19200 values
>> Number of Dimensions: 2
>> Dimensions and sizes: [lat | 120] x [lon | 160]
>> Coordinates:
>>             lat: [30.0625..44.9375]
>>             lon: [-132.9375..-113.0625]
>> Number Of Attributes: 1
>>
>>   _FillValue : 9.96921e+36
>>
>> My resources setting:
>>   mpres                       = True
>>   mpres at gsnMaximize           = True
>>   mpres at mpOutlineOn           = True
>>   mpres at mpDataBaseVersion     = "MediumRes"   ; slightly better outlines
>>   mpres at mpLandFillColor = "gray91"
>> ;---Data is regional
>>   mpres at gsnAddCyclic          = False
>> ;---Change the streamline levels
>>   mpres at stLevelSpacingF       = 30.
>>   mpres at stLevelPalette        = "ncl_default" ; "MPL_Spectral"
>>   mpres at stLineThicknessF      = 5.0         ; default is 1.0
>>   mpres at stLevelSelectionMode  = "ManualLevels"
>>   mpres at stMinLevelValF        = 1
>>   mpres at stMaxLevelValF        = 15.
>>   mpres at stLevelSpacingF       = 1.
>>   mpres at mpMinLonF            =  min(lon)               ; select a
>> subregion
>>   mpres at mpMaxLonF            =  max(lon)
>>   mpres at mpMinLatF            =   min(lat)
>>   mpres at mpMaxLatF            =  max(lat)
>>   mpres at pmTickMarkDisplayMode = "Always"    ; more detailed tickmarks
>> printVarSummary(Uwavghist)
>>
>>   plot4 = gsn_csm_vector_scalar_map_ce(wks,
>> Uwavghist,Vwavghist,windwavghist,mpres)
>>
>> Best regards,
>> Meina
>>
>>
>>
>> On Thu, Jul 6, 2017 at 8:58 AM, Mary Haley <haley at ucar.edu> wrote:
>>
>>> Hi Meina,
>>>
>>> One thing that might cause gsn_csm_streamline_scalar_map to seg fault is
>>> if you are trying to plot really large data arrays.
>>>
>>> It's always important to look at your data when NCL isn't plotting it
>>> correctly, and we recommend using "printVarSummary" for this.
>>>
>>> How big are U and V? Please insert a "printVarSummary" command and let
>>> us know what it reports:
>>>
>>> printVarSummary(U)
>>>
>>> Also, it would help to see how you are calling
>>> gsn_csm_streamline_scalar_map, and what resources you're setting.
>>>
>>> I verified that a small test code works just fine, which I've attached
>>> here, along with the data file.
>>>
>>> --Mary
>>>
>>>
>>> On Wed, Jul 5, 2017 at 6:14 PM, Meina Wang <mnawang at ucdavis.edu> wrote:
>>>
>>>> Dear All,
>>>>
>>>> I wanted to use the function "gsn_csm_streamline_scalar_map" to plot
>>>> wind streamline using U and V, with color-coded scaler field sqrt(U^2+V^2),
>>>> but got "segmentation fault".  I then switched to function "gsn_csm
>>>> _vector_scalar_map_ce" to do wind barb plot instead using the same
>>>> data and it worked well.  I have previously used the streamline function
>>>> and had no problem at all, so I'm wondering if any of you recently ran into
>>>> the same "segmentation fault" issue as I did.  Is it the internal code
>>>> of the function crashed?  Thank you.
>>>>
>>>> P.S. I'm using the NCL version 6.4.0. and ran on Linux machine with gcc
>>>>  (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
>>>>
>>>> Best,
>>>> Meina
>>>>
>>>> --
>>>> Meina Wang
>>>> PhD candidate in Atmospheric Science
>>>> Department of Land, Air and Water Resources
>>>> University of California, Davis
>>>> Davis, CA 95616
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>
>>
>> --
>> Meina Wang
>> PhD candidate in Atmospheric Science
>> Department of Land, Air and Water Resources
>> University of California, Davis
>> Davis, CA 95616
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>
>
> --
> Meina Wang
> PhD candidate in Atmospheric Science
> Department of Land, Air and Water Resources
> University of California, Davis
> Davis, CA 95616
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170706/c5b16970/attachment.html 


More information about the ncl-talk mailing list