[ncl-talk] How to get the result for each grid?

Atul Saini atulsainimail at gmail.com
Mon Sep 9 04:17:55 MDT 2019


Hello Rashed Sir,
                           I used dim_sum_n but it could not yield the
required result at each grid point. I want to get the sum of the variable
through time for all the grid points and therefore I used -



*a=addfile("RFIM_1901_1902_days_rf_tym.nc","r")x=a->tym(0:99,:,:)X=dim_sum_n(x,0)*
*print(X)*

Printing X doesn't provide the correct result. Please guide. Your reply is
highly appreciated.



Regards,





On Mon, Sep 9, 2019 at 2:58 PM Rashed Mahmood <rashidcomsis at gmail.com>
wrote:

> I think you want to use dim_sum_n_wrap() or dim_sum_n() functions instead
> of using "sum".  "sum" would result in total of everything for a variable.
> See the docs at the following link:
>
> https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_sum_n.shtml
>
>
> On Mon, Sep 9, 2019 at 8:55 AM Atul Saini via ncl-talk <ncl-talk at ucar.edu>
> wrote:
>
>> Hi NCL Talk,
>>                     I am trying to calculate the value for each grid
>> using the function as explained in the script, but at the end the result is
>> one value only. I want the value at each grid point.
>> *Script is as follows and datafile is attached herewith.*
>> ;begin
>> a=addfile("Data_File.nc","r")
>> x=a->tym(0:4,:,:)
>> y=a->rf(0:4,:,:)
>> v=a->tym(5:9,:,:)
>> w=a->rf(5:9,:,:)
>> A1=
>> ((sum(y))*(sum(sqrt(x)))-(sum(x))*(sum(x*y)))/(5*(sum(sqrt(x)))-(sqrt(sum(x))))
>> B1= (5*(sum(x*y))-(sum(x)*sum(y))/(5*(sum(sqrt(x)))-(sqrt(sum(x)))))
>> A2=
>> ((sum(w))*(sum(sqrt(v)))-(sum(v))*(sum(v*w)))/(5*(sum(sqrt(v)))-(sqrt(sum(v))))
>> B2= (5*(sum(v*w))-(sum(v)*sum(w))/(5*(sum(sqrt(v)))-(sqrt(sum(v)))))
>> chpOnset = ((A1-A2)/(B2-B1))
>> print(chpOnset)
>> *Please, help me to find out the mistake I am making. Your reply is very
>> important to me. Thanks in advance.*
>> Regards,
>>
>>
>>
>> _______________________________________________
>> 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/20190909/687e65d9/attachment.html>


More information about the ncl-talk mailing list