[ncl-talk] Problem with ind_resolve() and getting average around a gridpoint
Dave Allured - NOAA Affiliate
dave.allured at noaa.gov
Tue Sep 21 11:53:50 MDT 2021
It looks like the error is occurring at the *if (num())* statement, not the
*ind_resolve* statement. You have *if (num (...))*, but I think you meant
to say *if (num (...) .gt. 0)*. Without this change, you are sending an
integer to the if statement. If requires a logical.
Otherwise it looks like you are applying *ind_resolve* correctly for this
purpose.
On Tue, Sep 21, 2021 at 11:05 AM Lyndz via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:
> Dear NCL experts,
>
> I would like to ask for help in applying the *ind_resolve()* in my ncl
> script:
>
> My sample data can be found here:
> https://www.dropbox.com/sh/t88oab9txej73u1/AAAkDCcsTC3_eHg8uBc0vhtda?dl=0
>
> -----------------------------------------------------------------------------------------------------
> Here's my script so far:
>
> ;************************************************
> ; variable and file handling
> ;************************************************
> fvr = addfile("vort_ndjf_2008.nc","r") ; open netcdf file
> fwspd = addfile("wspd_ndjf_2008.nc","r")
>
> ;**************************************************
> ;Extract over a region
> ;**************************************************
> latS = 12.5
> latN = 20.0
> lonL = 120.0
> lonR = 135.0
>
> vr_region=fvr->vr(:,{latS:latN},{lonL:lonR}) ;select subregion
> wspd_region=fwspd->wspd(:,{latS:latN},{lonL:lonR})
>
> if (num((vr_region .gt. 3e-5) .and. (wspd_region .ge. 5))) then
> x1D = ndtooned(vr_region)
> y1D = ndtooned(wspd_region)
> * i1D = ind(x1D.gt.3e-5 .and. y1D.ge.5)*
> * i = ind_resolve(i1D, dimsizes(vr_region) )*
> print(time(i(:,0)) +" "+ lat(i(:,1)) +" "+lon(i(:,2)) )
> delete(x1D)
> delete(i1D)
> end if
>
> -------------------------------------------------------------------------------------
> I would like to:
>
> 1. Get the lat lon (location) of the grids with vorticity >3e-5 AND wind
> speed >= 5 5. I am getting an error fatal:Conditional statements (if and
> do while) require SCALAR logical values, see all and any function, at the
> ind_resolve() line. Any suggestions on how to fix this in NCL?
>
> 2. The output of the above script should be a list of coordinates. How can
> I get the average of the gridpoints around (4 gridpoints) these coordinates
> per time step, while *excluding* these coordinates in the averaging?
>
> I'll appreciate any help on this matter..
>
> -Lyndz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210921/8e3cafba/attachment.html>
More information about the ncl-talk
mailing list