[ncl-talk] segfault error with wavelet function.
Dipti Sharma
sdipti596 at gmail.com
Tue Apr 18 09:39:22 MDT 2017
Dear All,
I am trying to understand how to do the wavelet analysis and started using
an example code and the data available online. But I got an error message
as "segmentation fault (core dumped)" when I ran the program. I have given
the code that I used as below for you to review. Also I have attached the
data I used in the email.
So, could you please suggest me how I solve this problem?
Thanks in advance.
THE CODE is here and the data is attached in the email,
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
;--------------------------------------------------------------------
; CREATE SAME WAVELET FIGURE AS TORRENCE & COMPO using seasonal Nino3
; from 1871-1997
begin
ninoseas = asciiread("C:\diptic\sst\sst_nino3.dat",-1,"float")
ninoseas!0 = "time"
ntime = dimsizes(ninoseas)
timeo = fspan(1871.25,1996.,ntime)
print(ntime)
ninoseas&time = timeo
ninomam = dim_avg_Wrap(ninoseas(0::4))
ninojja = dim_avg_Wrap(ninoseas(1::4))
ninoson = dim_avg_Wrap(ninoseas(2::4))
ninodjf = dim_avg_Wrap(ninoseas(3::4))
ninoseas(0::4) = ninoseas(0::4) - ninomam
ninoseas(1::4) = ninoseas(1::4) - ninojja
ninoseas(2::4) = ninoseas(2::4) - ninoson
ninoseas(3::4) = ninoseas(3::4) - ninodjf
time = timeo
N = dimsizes(time)
;_FillValue=1e+36
;printMinMax(ninoseas,False)
;return
;************************************
; compute wavelet
;************************************
mother = 0
param = 6.0
dt = 0.25 ;timesteps in units of years
s0 = dt
dj = 0.25
jtot = 1+floattointeger(((log10(N*dt/s0))/dj)/log10(2.))
npad = N
nadof = 0.0
noise = 1
siglvl = 0.05
isigtest= 0
;print(nadof)
w
=wavelet(ninoseas,mother,dt,param,s0,dj,jtot,npad,noise,isigtest,siglvl,nadof)
;printVarSummary(w)
return
end
segmentation fault (core dumped)
On Tue, Apr 18, 2017 at 3:29 AM, <ncl-talk-request at ucar.edu> wrote:
> Send ncl-talk mailing list submissions to
> ncl-talk at ucar.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> or, via email, send a message with subject or body 'help' to
> ncl-talk-request at ucar.edu
>
> You can reach the person managing the list at
> ncl-talk-owner at ucar.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ncl-talk digest..."
>
>
> Today's Topics:
>
> 1. Re: Problem with gsn_add_text (Stavros Dafis)
> 2. Problem with contour plot (Guilherme Martins)
> 3. Re: Problem with gsn_add_text (Rick Brownrigg)
> 4. Re: Problem with contour plot (Mary Haley)
> 5. how to draw this kind of plot (wen)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 17 Apr 2017 21:48:31 +0300
> From: Stavros Dafis <sdafis at cc.uoi.gr>
> Subject: Re: [ncl-talk] Problem with gsn_add_text
> To: Rick Brownrigg <brownrig at ucar.edu>
> Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
> Message-ID: <1492454911.58f50dffc9203 at webmail.uoi.gr>
> Content-Type: text/plain; charset=ISO-8859-7
>
> Dear Rick, thank you for your suggestion, I have tried to assign both the
> FillValue and the missing value (@missing_value) but nothing seems to work.
>
> I forgot to mention that I am using NCL 6.2.0, 6.3.0 and 6.4.0, on
> different
> machines.
>
>
> --
> Stavros NTAFIS (DAFIS)
> -----------------------------------------------
> Physicist - Meteorologist, M.Sc.
> Research Associate, National Observatory of Athens
> (+33)9 81 94 22 12, Mobile: +30 697 04 20 242
> ---------------
> Weather charts:
> http://www.meteo.gr
> http://www.meteo.gr/meteomaps/
>
>
> Quoting Rick Brownrigg <brownrig at ucar.edu>:
>
> > Hi Stavros,
> >
> > I don't know for certain, but I suspect you need to assign the _FillValue
> > to the string array "points" that you constructed from "t2" (I don't see
> > how the attributes from t2 would carry to points via the sprintf() ).
> >
> > Hope that helps...
> > Rick
> >
> > On Sun, Apr 16, 2017 at 12:56 PM, Stavros Dafis <sdafis at cc.uoi.gr>
> wrote:
> >
> > > Hello everyone, I am facing a problem with the function gsn_add_text.
> In
> > > the
> > > description of the function, it is mentioned that no missing values
> will be
> > > plotted:
> > >
> > > “This function attaches a list of text strings to the given plot.
> > > The text
> > > strings will be drawn only when the plot is drawn. If a missing value
> is
> > > encountered in the text strings or x/y values, then no text string
> will be
> > > drawn at this pair.”
> > >
> > > My script reads a netCDF file with 3 variables t2(lat,lon), lat(lat),
> > > lon(lon),
> > > so in order to attach values on the plot using this function, I have to
> > > make
> > > new 2-D variables for lat/lon and define the string to be plotted on
> the
> > > map.
> > > Values are assigned just fine on the plot, over the land, but missing
> > > values
> > > are also printed over the sea. I tried to use landsea masking but my
> data
> > > have
> > > high horizontal resolution (5km). Any suggestions?
> > >
> > > I have the same problem with WRF data, with already 2-D lat/lon arrays.
> > >
> > > This is the part of the code which prints the values:
> > > .
> > > .
> > > .
> > > contour = gsn_csm_contour_map(wks,t2,res)
> > >
> > > t2 at missing_value = -1
> > > t2 at _FillValue = -1
> > > (default missing values = -999)
> > >
> > > lat2 = new(dimsizes(t2),typeof(lat),-1)
> > > lon2 = new(dimsizes(t2),typeof(lon),-1)
> > >
> > > nb = dimsizes(t2)
> > >
> > > do nl=0,nb(0)-1,1
> > > do ml=0,nb(1)-1,1
> > >
> > > lat2(nl,ml) = lat(nl)
> > > lon2(nl,ml) = lon(ml)
> > >
> > > end do
> > > end do
> > >
> > > points = sprintf("%3.0f", t2)
> > > ;points = ""+t2(:,:)+""
> > >
> > > values = gsn_add_text(wks,contour,points,lon2(:,:),lat2(:,:),True)
> > >
> > >
> > >
> > > --
> > > Stavros NTAFIS (DAFIS)
> > > -----------------------------------------------
> > > Physicist - Meteorologist, M.Sc.
> > > Research Associate, National Observatory of Athens
> > > (+33)9 81 94 22 12, Mobile: +30 697 04 20 242
> > > ---------------
> > > Weather charts:
> > > http://www.meteo.gr
> > > http://www.meteo.gr/meteomaps/
> > >
> > >
> > >
> > > _______________________________________________
> > > ncl-talk mailing list
> > > ncl-talk at ucar.edu
> > > List instructions, subscriber options, unsubscribe:
> > > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> > >
> >
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 17 Apr 2017 19:00:02 +0000
> From: Guilherme Martins <jgmsantos at gmail.com>
> Subject: [ncl-talk] Problem with contour plot
> To: NCL <ncl-talk at ucar.edu>
> Message-ID:
> <CAH+t_hMaRUDHM0wMkLC9cz2pFmMYGXgGC+X+bcxDLo=+8fgWQg at mail.gmail.
> com>
> Content-Type: text/plain; charset="utf-8"
>
> Dear users,
>
> After searching extensively on the NCL website I was not able to find a
> solution to my problem. I only want values within the contour of the
> continent, but some edges appear in the figure that are stemming from the
> mask that I applied and I do not know how to remove this. The figure is
> attached for a better view of my problem.
>
> Best regards,
>
> Guilherme.
> --
> ------------------------------------------------------------
> ------------------------------------
> Instituto Nacional de Pesquisas Espaciais (INPE)
> Centro de Previs?o de Tempo e Estudos Clim?ticos (CPTEC)
> Divis?o de Sat?lites e Sistemas Ambientais (DSA)
> Programa de Monitoramento de Queimadas
> Telefone (INPE/CP): +55 12 3186-9205 || Celular (TIM): +55 12 98111-4292
> E-mail: guilherme.martins at inpe.br || jgmsantos at gmail.com
> Skype: guilherme.martins.
> Homepage: https://sites.google.com/site/jgmsantos
> Curr?culo Lattes: http://lattes.cnpq.br/5997657584785803
> ------------------------------------------------------------
> ------------------------------------
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.ucar.edu/pipermail/ncl-talk/
> attachments/20170417/c3215b0e/attachment-0001.html
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: figure.png
> Type: image/png
> Size: 58495 bytes
> Desc: not available
> Url : http://mailman.ucar.edu/pipermail/ncl-talk/
> attachments/20170417/c3215b0e/attachment-0001.png
>
> ------------------------------
>
> Message: 3
> Date: Mon, 17 Apr 2017 14:32:43 -0600
> From: Rick Brownrigg <brownrig at ucar.edu>
> Subject: Re: [ncl-talk] Problem with gsn_add_text
> To: Stavros Dafis <sdafis at cc.uoi.gr>
> Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
> Message-ID:
> <CAGKRhbHX1v-1sJ3G=QrXGA+0wSJ2KKsBB_7GqbCnp9krh9fkkQ@
> mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi,
>
> You used -1 as _FillValue for variable "t2". Note it is an integer value --
> what type is the array t2 -- float or int? In any case, you created the
> formatted string array "points" from t2 as "%3.0f", so that any data values
> in t2 that were -1 are now " -1", and thus it seems your _FillValue should
> be " -1". Did you do this, and do the types between data and _FillValue
> agree everywhere?
>
> If that's not the issue, I think we may need to see script and dataset to
> figure out what the issue is.
>
> HTH...
> Rick
>
> On Mon, Apr 17, 2017 at 12:48 PM, Stavros Dafis <sdafis at cc.uoi.gr> wrote:
>
> > Dear Rick, thank you for your suggestion, I have tried to assign both the
> > FillValue and the missing value (@missing_value) but nothing seems to
> work.
> >
> > I forgot to mention that I am using NCL 6.2.0, 6.3.0 and 6.4.0, on
> > different
> > machines.
> >
> >
> > --
> > Stavros NTAFIS (DAFIS)
> > -----------------------------------------------
> > Physicist - Meteorologist, M.Sc.
> > Research Associate, National Observatory of Athens
> > (+33)9 81 94 22 12, Mobile: +30 697 04 20 242
> > ---------------
> > Weather charts:
> > http://www.meteo.gr
> > http://www.meteo.gr/meteomaps/
> >
> >
> > Quoting Rick Brownrigg <brownrig at ucar.edu>:
> >
> > > Hi Stavros,
> > >
> > > I don't know for certain, but I suspect you need to assign the
> _FillValue
> > > to the string array "points" that you constructed from "t2" (I don't
> see
> > > how the attributes from t2 would carry to points via the sprintf() ).
> > >
> > > Hope that helps...
> > > Rick
> > >
> > > On Sun, Apr 16, 2017 at 12:56 PM, Stavros Dafis <sdafis at cc.uoi.gr>
> > wrote:
> > >
> > > > Hello everyone, I am facing a problem with the function gsn_add_text.
> > In
> > > > the
> > > > description of the function, it is mentioned that no missing values
> > will be
> > > > plotted:
> > > >
> > > > “This function attaches a list of text strings to the given
> plot.
> > > > The text
> > > > strings will be drawn only when the plot is drawn. If a missing value
> > is
> > > > encountered in the text strings or x/y values, then no text string
> > will be
> > > > drawn at this pair.”
> > > >
> > > > My script reads a netCDF file with 3 variables t2(lat,lon), lat(lat),
> > > > lon(lon),
> > > > so in order to attach values on the plot using this function, I have
> to
> > > > make
> > > > new 2-D variables for lat/lon and define the string to be plotted on
> > the
> > > > map.
> > > > Values are assigned just fine on the plot, over the land, but missing
> > > > values
> > > > are also printed over the sea. I tried to use landsea masking but my
> > data
> > > > have
> > > > high horizontal resolution (5km). Any suggestions?
> > > >
> > > > I have the same problem with WRF data, with already 2-D lat/lon
> arrays.
> > > >
> > > > This is the part of the code which prints the values:
> > > > .
> > > > .
> > > > .
> > > > contour = gsn_csm_contour_map(wks,t2,res)
> > > >
> > > > t2 at missing_value = -1
> > > > t2 at _FillValue = -1
> > > > (default missing values = -999)
> > > >
> > > > lat2 = new(dimsizes(t2),typeof(lat),-1)
> > > > lon2 = new(dimsizes(t2),typeof(lon),-1)
> > > >
> > > > nb = dimsizes(t2)
> > > >
> > > > do nl=0,nb(0)-1,1
> > > > do ml=0,nb(1)-1,1
> > > >
> > > > lat2(nl,ml) = lat(nl)
> > > > lon2(nl,ml) = lon(ml)
> > > >
> > > > end do
> > > > end do
> > > >
> > > > points = sprintf("%3.0f", t2)
> > > > ;points = ""+t2(:,:)+""
> > > >
> > > > values = gsn_add_text(wks,contour,points,lon2(:,:),lat2(:,:),True)
> > > >
> > > >
> > > >
> > > > --
> > > > Stavros NTAFIS (DAFIS)
> > > > -----------------------------------------------
> > > > Physicist - Meteorologist, M.Sc.
> > > > Research Associate, National Observatory of Athens
> > > > (+33)9 81 94 22 12, Mobile: +30 697 04 20 242
> > > > ---------------
> > > > Weather charts:
> > > > http://www.meteo.gr
> > > > http://www.meteo.gr/meteomaps/
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > ncl-talk mailing list
> > > > ncl-talk at ucar.edu
> > > > 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/20170417/01bd2242/attachment-0001.html
>
> ------------------------------
>
> Message: 4
> Date: Mon, 17 Apr 2017 15:02:08 -0600
> From: Mary Haley <haley at ucar.edu>
> Subject: Re: [ncl-talk] Problem with contour plot
> To: Guilherme Martins <jgmsantos at gmail.com>
> Cc: NCL <ncl-talk at ucar.edu>
> Message-ID:
> <CACNN_CJz1yvpMXMABZ8FhSEov1T0qN63rzs
> NBBVXBhLos3UKjg at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Guilherme,
>
> Please see examples shapefiles_21.ncl at:
>
> http://www.ncl.ucar.edu/Applications/shapefiles.shtml#ex21
>
> It explains why you see these "blocky" contours in NCL.
>
> Simply put, if you have four points that represent a box at the edge of a
> domain, and three of them have data one them and one is missing, then NCL
> will only draw contours in half of the box, because it won't extrapolate to
> that missing point.
>
> The real question is: do you simply want the graphics not to have gaps, or
> do you actually want there to be data in locations that fall just outside
> the geographical boundary? You can do things to force values just outside
> the geographical boundary, but this depends on how you are masking in the
> first place.
>
> If you are masking based on a shapefile, then see example shapefiles_18.ncl
> on the same page:
>
> http://www.ncl.ucar.edu/Applications/shapefiles.shtml#ex18
>
> Note, however, that this mask is now returning values outside the range of
> interest.
>
> If you are simply trying to mask your data *graphically* by some
> geographical area, then instead of trying to use a mask function, you can
> draw the full data, and then draw polygons filled in with white in the
> areas you don't want to see graphically. That's what example 21 is
> showing.
>
> --Mary
>
>
> On Mon, Apr 17, 2017 at 1:00 PM, Guilherme Martins <jgmsantos at gmail.com>
> wrote:
>
> > Dear users,
> >
> > After searching extensively on the NCL website I was not able to find a
> > solution to my problem. I only want values within the contour of the
> > continent, but some edges appear in the figure that are stemming from the
> > mask that I applied and I do not know how to remove this. The figure is
> > attached for a better view of my problem.
> >
> > Best regards,
> >
> > Guilherme.
> > --
> > ------------------------------------------------------------
> > ------------------------------------
> > Instituto Nacional de Pesquisas Espaciais (INPE)
> > Centro de Previs?o de Tempo e Estudos Clim?ticos (CPTEC)
> > Divis?o de Sat?lites e Sistemas Ambientais (DSA)
> > Programa de Monitoramento de Queimadas
> > Telefone (INPE/CP): +55 12 3186-9205 <+55%2012%203186-9205> || Celular
> > (TIM): +55 12 98111-4292 <+55%2012%2098111-4292>
> > E-mail: guilherme.martins at inpe.br || jgmsantos at gmail.com
> > Skype: guilherme.martins.
> > Homepage: https://sites.google.com/site/jgmsantos
> > Curr?culo Lattes: http://lattes.cnpq.br/5997657584785803
> > ------------------------------------------------------------
> > ------------------------------------
> >
> > _______________________________________________
> > ncl-talk mailing list
> > ncl-talk at ucar.edu
> > 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/20170417/96b2b947/attachment-0001.html
>
> ------------------------------
>
> Message: 5
> Date: Tue, 18 Apr 2017 15:29:04 +0800 (CST)
> From: wen <wenguanhuan at 163.com>
> Subject: [ncl-talk] how to draw this kind of plot
> To: ncl-list <ncl-talk at ucar.edu>
> Message-ID: <5de3ed86.9f7f.15b7ff6fb6f.Coremail.wenguanhuan at 163.com>
> Content-Type: text/plain; charset="gbk"
>
> Hi all,
> I am trying to use TRMM 3B42 data to draw this kind of plot. I haven't
> found a example on the website to draw it. Do anyone know how to make it.
> Which function should I
> use. Thank you!
>
>
>
>
>
>
>
>
> --
>
> ??
> ???
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.ucar.edu/pipermail/ncl-talk/
> attachments/20170418/b09be439/attachment.html
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: ??1.png
> Type: image/png
> Size: 249741 bytes
> Desc: not available
> Url : http://mailman.ucar.edu/pipermail/ncl-talk/
> attachments/20170418/b09be439/attachment.png
>
> ------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> End of ncl-talk Digest, Vol 161, Issue 23
> *****************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170418/53e2480e/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sst_nino3.dat
Type: application/octet-stream
Size: 3526 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170418/53e2480e/attachment.obj
More information about the ncl-talk
mailing list