[ncl-talk] Convert Matlab code to NCL

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Fri Oct 6 11:21:17 MDT 2017


Correction to Dennis's line 1:

Old:  do m=4,0,1
New:  do m=4,0,-1

I can't confirm the rest of the code.

--Dave


On Fri, Oct 6, 2017 at 11:08 AM, Dennis Shea <shea at ucar.edu> wrote:

> A person sent me the following offline:
>
> do m=4,0,1
>    R(:,:,:,m) = dim_sum_n_Wrap(Q(:,:,:,m::,m::,m::),(/3,4,5/))
>    if m.lt.4 then
>      R(:,:,:,m) = R(:,:,:,m) - dim_sum_n_Wrap(R(:,:,:,(m+1)::),3)
>    end if
> end do
>
>
> On Thu, Oct 5, 2017 at 5:37 PM, <Arnold.Sullivan at csiro.au> wrote:
>
>> Dear all ncl users,
>>
>>
>>
>> Could someone help me to convert Matlab code using sum to NCL
>>
>>
>>
>> *R is [time] [lat] [lon] [m1]*
>>
>>
>>
>> *Q is [time] [lat] [lon] [m1] [m2] [m3]*
>>
>>
>>
>> *For m=5:-1:1*
>>
>> *    R(:,:,:,m) = sum( sum( sum( Q(:,:,:,m:end,m:end,m:end), 4), 5), 6);*
>>
>> *    if m < 5*
>>
>> *        R(:,:,:,m) = R(:,:,:,m) - sum( R(:,:,:,(m+1):end), 4);*
>>
>> *end*
>>
>> *end*
>>
>>
>>
>> Is that the same way to use dim_sum_n_Wrap ?
>>
>>
>>
>> Regards,
>>
>>
>>
>> Arnold
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171006/8093f216/attachment.html>


More information about the ncl-talk mailing list