[ncl-talk] How to get the result for each grid?
Rashed Mahmood
rashidcomsis at gmail.com
Mon Sep 9 05:33:50 MDT 2019
Are you sure about the data file? Why got no values for x min and max? Also
why was the min and max same value for X, 5050?
There is no problem with function, I am sure. It's the data file that need
to be checked thoroughly? If you cannot find issue with the file you would
need provide the data file to the list.
On Mon, Sep 9, 2019 at 1:26 PM Atul Saini <atulsainimail at gmail.com> wrote:
> I got the following answer-
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *ncl 6> printVarSummary(x)Variable: xType: floatTotal Size: 6966000 bytes
> 1741500 valuesNumber of Dimensions: 3Dimensions and sizes: [time
> | 100] x [lat | 129] x [lon | 135]Coordinates: time: [ 1..
> 100] lat: [6.5..38.5] lon: [66.5..100]Number Of
> Attributes: 3 long_name : GRIDDED RAINFALL _FillValue : -999
> missing_value : -999ncl 7> printVarSummary(X)Variable: XType: floatTotal
> Size: 69660 bytes 17415 valuesNumber of Dimensions: 2Dimensions
> and sizes: [129] x [135]Coordinates: Number Of Attributes: 1 _FillValue :
> -999ncl 8> ncl 9> print(x at _FillValue)(0) -999ncl 10> print(X at _FillValue)(0)
> -999*
> Regards,
>
>
>
>
>
> On Mon, Sep 9, 2019 at 4:46 PM Rashed Mahmood <rashidcomsis at gmail.com>
> wrote:
>
>> 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/a105ca20/attachment.html>
More information about the ncl-talk
mailing list