[ncl-talk] Getting location and dates of a point(s) that satisfy certain conditions

Lyndz olagueralyndonmark429 at gmail.com
Sat Apr 17 05:16:55 MDT 2021


Hi Rashed,

Thank you for this!

I checked all the values and Sir Dennis is correct. There is no exact 0
from the derivatives.
This is why the ncol line is not working.

Sincerely,
Lyndz

On Sat, Apr 17, 2021 at 6:14 PM Rashed Mahmood <rashidcomsis at gmail.com>
wrote:

> Hi Lyndz,
> I think the problem is that one of your ind conditions results in missing
> and hence this error message. You have to decide what to do when this sort
> of situation arises. The attached adds an if statement that could be useful
> in such scenarios but I am not sure if that is what you want.
> Cheers,
> Rashed
>
>
> On Sat, Apr 17, 2021 at 6:30 AM Lyndz via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Dear Sir Dennis and NCL-experts,
>>
>> I am getting this error:
>>
>> *fatal:Argument type mismatch on argument (0) of (ind_resolve) can not
>> coerce*
>>
>>
>>
>> occurring near at the ncol line..
>>
>>
>> Here's a sample file that I am using:
>>
>>
>> https://www.dropbox.com/s/4nu4jh2v7uz6r45/mslp_jan16_2017.nc?dl=0
>>
>>
>> Attached is the updated script.
>>
>>
>>
>> Any ideas on how to solve this?
>>
>>
>>
>> --Lyndz
>>
>>
>> On Sat, Apr 17, 2021 at 2:52 AM Dennis Shea <shea at ucar.edu> wrote:
>>
>>> [1] The following has an error
>>>
>>>   dpdx_region=dpdx(:,{latS:latN},{lonL:lonR})
>>>   *dpdx_region*=dpdy(:,{latS:latN},{lonL:lonR})   ;   should be *dpdy_region
>>> <=====*
>>>   px2py2_region=px2py2(:,{latS:latN},{lonL:lonR})
>>>
>>> [2] I don't see the need for your use of *dim_num_n*
>>> <http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_num_n.shtml>
>>>
>>> [4]  *ind_resolve*
>>> <http://www.ncl.ucar.edu/Document/Functions/Built-in/ind_resolve.shtml>
>>> is what you should use. Arrays must be made 1D.
>>>       **** LOOK AT THE EXAMPLES****
>>>
>>>      dpdx_region_1d = *ndtooned*(dpdx_region)
>>>      dpdy_region_1d = *ndtooned*(dpdy_region)
>>>      px2py2_region_1d = *ndtooned*(px2py2_region)
>>>
>>> [5]    It is *highly* unlikely that the derivatives will be exactly 0.0
>>> but ....
>>>
>>>   n_col  = ind_resolve(ind(dpdx_region_1d.eq. 0) .and.
>>> ind(dpdy_region_1d .eq. 0) .and. ind(px2py2_region_1d.eq. 0) )
>>>
>>>   printVarSummary(n_col)
>>>
>>>
>>> I'll stop there!
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Fri, Apr 16, 2021 at 2:38 AM Lyndz via ncl-talk <
>>> ncl-talk at mailman.ucar.edu> wrote:
>>>
>>>> Dear NCL-experts,
>>>>
>>>> *[1] Details*
>>>> I have three variables dpdx, dpdy, and px2py2 with the following
>>>> dimensions and sizes:
>>>> *Dimensions and sizes: [time | 124] x [lat | 73] x [lon | 144]*
>>>> These variables were derived using spherical harmonics.
>>>>
>>>> *[2] Problem and what I have done so far*
>>>>
>>>> (a) I want to get the dates when any gridpoint in a specified domain
>>>> satisfies the following conditions:
>>>> dpdx = 0 *.and.* dpdy = 0 *.and. *px2py2 *.lt.* 0
>>>>
>>>> (b) get the coordinates of these points, if possible.
>>>>
>>>> I have the following lines in my script:
>>>>
>>>>   latS = 5.0
>>>>
>>>>   latN = 30.0
>>>>
>>>>   lonL = 120.0
>>>>
>>>>   lonR = 160.0
>>>>
>>>>   dpdx_region=dpdx(:,{latS:latN},{lonL:lonR})
>>>>
>>>>   dpdx_region=dpdy(:,{latS:latN},{lonL:lonR})
>>>>
>>>>   px2py2_region=px2py2(:,{latS:latN},{lonL:lonR})
>>>>
>>>> I am stuck here. I dont know what index I should use to get the dates
>>>> and how to get their coordinates.
>>>>
>>>>   dpdx_thres  = dim_num_n((dpdx_region .eq. 0),(/1,2/))
>>>>
>>>>   dpdy_thres  = dim_num_n((dpdy_region .eq. 0),(/1,2/))
>>>>
>>>>   px2py2_thres  = dim_num_n((px2py2_region .lt. 0),(/1,2/))
>>>>
>>>>   n_thres  = ind(dpdx_thres .gt. 0 .and. dpdy_thres .gt. 0 .and.
>>>> px2py2_thres .gt. 0 ) ;time indices but i'm not sure if this is correct!
>>>>
>>>>
>>>>   print(n_thres)
>>>>
>>>>   print("=====")
>>>>
>>>>
>>>>   if(ismissing(nt_thres(0))) then
>>>>
>>>>      print("++++++++++++++")
>>>>
>>>>      print(" NO values exceed threshold="+threshold)
>>>>
>>>>      print("++++++++++++++")
>>>>
>>>>   exit
>>>>
>>>>   end if
>>>>
>>>>
>>>>
>>>> I am attaching my script.
>>>>
>>>>
>>>> I'll appreciate any help on this!
>>>>
>>>>
>>>> Sincerely,
>>>>
>>>> *Lyndz*
>>>>
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at mailman.ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at mailman.ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210417/66abfc50/attachment.html>


More information about the ncl-talk mailing list