[ncl-talk] cnConstFEnableFill to enable fill

Md. Jalal Uddin dmjalal90 at gmail.com
Sun Sep 1 18:55:43 MDT 2019


The following function still gives me constant 0 value.

undef ("fftwavenumber")
function fftwavenumber (in[*]:numeric)

local in,p,a,b,f,output

begin
    N=dimsizes(in)

   if mod(N,2).eq.0 then
         p=N/2     ; N even
   else
         p=(N-1)/2 ; N odd
   end if

pi=3.1416

a = new((/ p /), typeof(in),getVarFillValue(in))
b = new((/ p /), typeof(in),getVarFillValue(in))

do k=0,p-1
  do t=0,N-1
      a(k) = (2/N)*( in(t)*cos(2*pi*k*t/N) )
      b(k) = (2/N)*( in(t)*sin(2*pi*k*t/N) )
  end do
end do

f = new((/ k,t /), typeof(in),getVarFillValue(in))
output = new((/ t /), typeof(in),getVarFillValue(in))

do t=0,N-1
   do k=0,p-1
        f(k,t) = a(k)*cos(2*pi*k*t/N)+ b(k)*sin(2*pi*k*t/N)
   end do
   output(t)=(sum(f(0,t)))  ; 0 used for Fourier Decomposition (wave number
1)
   return(output)
end do
end

On Sat, 31 Aug 2019 at 01:09, Rashed Mahmood <rashidcomsis at gmail.com> wrote:

> In addition, I am also not sure about the outer loop in the following, it
> seems that after every iteration a and will be zero, if so, why do you need
> the outer loop::
>
> do k=0,p-1
>    a(k) = 0
>    b(k) = 0
>   do t=0,N-1
>       a(k) = a(k) +(2/N)*( in(t)*cos(2*pi*k*t/N) )
>       b(k) = b(k) +(2/N)*( in(t)*sin(2*pi*k*t/N) )
>   end do
> end do
>
>
>
> On Fri, Aug 30, 2019 at 8:37 AM Dennis Shea <shea at ucar.edu> wrote:
>
>> function fftwavenumber (in)    ==> function fftwavenumber
>> (in[*]:numeric)
>> ====
>>  add
>>       return(outpuy)
>> ====
>>
>> Ypu should test the function.
>>
>>
>>
>> On Thu, Aug 29, 2019 at 7:53 PM Md. Jalal Uddin <dmjalal90 at gmail.com>
>> wrote:
>>
>>> Sorry, sir. It was my mistake as I am making a function in NCL for the
>>> first time. The following function,  I used for rainfall analysis, produced
>>> a constant 0 value.
>>>
>>> undef ("fftwavenumber")
>>> function fftwavenumber (in)
>>>
>>> local in,p,a,b,c,d,f,output
>>>
>>> begin
>>>     N=dimsizes(in)
>>>
>>>    if mod(N,2).eq.0 then
>>>          p=N/2     ; N even
>>>    else
>>>          p=(N-1)/2 ; N odd
>>>    end if
>>>
>>> pi=3.1416
>>>
>>> a = new((/ p /), typeof(in),getVarFillValue(in))
>>> b = new((/ p /), typeof(in),getVarFillValue(in))
>>>
>>> do k=0,p-1
>>>    a(k) = 0
>>>    b(k) = 0
>>>   do t=0,N-1
>>>       a(k) = a(k) +(2/N)*( in(t)*cos(2*pi*k*t/N) )
>>>       b(k) = b(k) +(2/N)*( in(t)*sin(2*pi*k*t/N) )
>>>   end do
>>> end do
>>>
>>> f = new((/ k,t /), typeof(in),getVarFillValue(in))
>>> output = new((/ t /), typeof(in),getVarFillValue(in))
>>>
>>> do t=0,N-1
>>>    do k=0,p-1
>>>         f(k,t) = a(k)*cos(2*pi*k*t/N)+ b(k)*sin(2*pi*k*t/N)
>>>    end do
>>>    output(t)=(sum(f(0,t)))  ; 0 used for wave number one
>>> end do
>>>
>>> end
>>>
>>> Any advice would be appreciated.
>>>
>>> On Thu, 29 Aug 2019 at 22:02, Dennis Shea <shea at ucar.edu> wrote:
>>>
>>>> Your response makes no sense to me.
>>>> *ezfftf_n*
>>>> <https://www.ncl.ucar.edu/Document/Functions/Built-in/ezfftf_n.shtml>
>>>> *ezfftb_n*
>>>> <https://www.ncl.ucar.edu/Document/Functions/Built-in/ezfftb_n.shtml>
>>>>
>>>> There are other FFT woutines ... look for them
>>>>
>>>> On Wed, Aug 28, 2019 at 9:20 PM Md. Jalal Uddin via ncl-talk <
>>>> ncl-talk at ucar.edu> wrote:
>>>>
>>>>> Yes, sir. The variable got 0 value. Actually, it was a function in
>>>>> Matlab for Fourier Decomposition (wavenumber 1). I am trying to transfer
>>>>> into NCL. I would be happy to know if such function is available in NCL.
>>>>>
>>>>> On Wed, 28 Aug 2019 at 15:33, Rashed Mahmood <rashidcomsis at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> There is not enough information to say for sure, however, this is
>>>>>> likely due to missing data values. Did you check if the variable that you
>>>>>> trying to plot got missing values?
>>>>>>
>>>>>> Cheers,
>>>>>> Rashed
>>>>>>
>>>>>> On Wed, Aug 28, 2019 at 6:49 AM Md. Jalal Uddin via ncl-talk <
>>>>>> ncl-talk at ucar.edu> wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I got the following error message with a blank figure (attached).
>>>>>>> *warning:ContourPlotInitialize: scalar field is constant; no contour
>>>>>>> lines will appear; use cnConstFEnableFill to enable fill*
>>>>>>>
>>>>>>> I set a resource that did not work.
>>>>>>> cnres at cnConstFEnableFill  = True
>>>>>>>
>>>>>>> Any advice?
>>>>>>>
>>>>>>> Jalal
>>>>>>> --
>>>>>>> *Md. Jalal Uddin*
>>>>>>> MSc in Applied Meteorology
>>>>>>> Nanjing University of Information, Science and Technology, China
>>>>>>> B.Sc. in Disaster Management (Hons.)
>>>>>>> Patuakhali Science and Technology University, Bangladesh.
>>>>>>> Cell: +8613260859092, +8801792052662
>>>>>>> Web: www.dmjalal90.weebly.com
>>>>>>> Facebook: jalal.hossen.39
>>>>>>> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
>>>>>>> _______________________________________________
>>>>>>> ncl-talk mailing list
>>>>>>> ncl-talk at ucar.edu
>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> *Md. Jalal Uddin*
>>>>> MSc in Applied Meteorology
>>>>> Nanjing University of Information, Science and Technology, China
>>>>> B.Sc. in Disaster Management (Hons.)
>>>>> Patuakhali Science and Technology University, Bangladesh.
>>>>> Cell: +8613260859092, +8801792052662
>>>>> Web: www.dmjalal90.weebly.com
>>>>> Facebook: jalal.hossen.39
>>>>> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>> --
>>> *Md. Jalal Uddin*
>>> MSc in Applied Meteorology
>>> Nanjing University of Information, Science and Technology, China
>>> B.Sc. in Disaster Management (Hons.)
>>> Patuakhali Science and Technology University, Bangladesh.
>>> Cell: +8613260859092, +8801792052662
>>> Web: www.dmjalal90.weebly.com
>>> Facebook: jalal.hossen.39
>>> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
>>>
>>

-- 
*Md. Jalal Uddin*
MSc in Applied Meteorology
Nanjing University of Information, Science and Technology, China
B.Sc. in Disaster Management (Hons.)
Patuakhali Science and Technology University, Bangladesh.
Cell: +8613260859092, +8801792052662
Web: www.dmjalal90.weebly.com
Facebook: jalal.hossen.39
LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190902/cfcc8d97/attachment.html>


More information about the ncl-talk mailing list