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

Rashed Mahmood rashidcomsis at gmail.com
Mon Sep 9 03:28:34 MDT 2019


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/5600e99f/attachment.html>


More information about the ncl-talk mailing list