[ncl-talk] How to get the result for each grid?
Rashed Mahmood
rashidcomsis at gmail.com
Mon Sep 9 05:16:02 MDT 2019
Why there are no values for min and max of x variable?
I suspect that there is something wrong with your data file, however, you
should do some more checking... e.g.
printVarSummary(x)
printVarSummary(X)
print(x at _FillValue)
print(X at _FillValue)
On Mon, Sep 9, 2019 at 1:11 PM Atul Saini <atulsainimail at gmail.com> wrote:
> Rashed sir,
> It gives the following answer-
>
>
>
>
>
>
> *ncl 4> printMinMax(x,True)(0) (0) GRIDDED RAINFALLncl 5>
> printMinMax(X,True)(0) (0) min=5050 max=5050*
>
> Regards,
>
>
>
>
>
> On Mon, Sep 9, 2019 at 4:38 PM Rashed Mahmood <rashidcomsis at gmail.com>
> wrote:
>
>> I do not see any problem with the lines you just posted.
>> Can you add following in the above code you wrote and let me know:
>>
>> printMinMax(x,True)
>> printMinMax(X,True)
>>
>>
>> On Mon, Sep 9, 2019 at 12:18 PM Atul Saini <atulsainimail at gmail.com>
>> wrote:
>>
>>> 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/5c82c0ef/attachment.html>
More information about the ncl-talk
mailing list