[ncl-talk] Mean with same lat and lon

Dennis Shea shea at ucar.edu
Sun Jul 5 08:04:49 MDT 2020


Please see attached script.

%> ncl test_LatLon.ncl

Good Luck

On Mon, Jun 29, 2020 at 10:58 AM Vanúcia Schumacher via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Thanks Rick for your time, but it didn't work.
> ------------------------------
> *De:* Rick Brownrigg <brownrig at ucar.edu>
> *Enviado:* segunda-feira, 29 de junho de 2020 12:33
> *Para:* Vanúcia Schumacher <vanucia-schumacher at hotmail.com>
> *Cc:* ncl-talk at ucar.edu <ncl-talk at ucar.edu>
> *Assunto:* Re: [ncl-talk] Mean with same lat and lon
>
> I don't really know for certain, but what about something like this (i.e.,
> explicitly computing the average):
>
> data           :=  new((/nlat,mlon/),"float"
> data           =  0
> dataCount := new((/nlat,mlon/), "integer")
> dataCount = 0
>
> do i=.....
>    data({lat(i)},{lon(i)}) = data({lat(i)},{lon(i)}) + var(i)
>   dataCount({lat(i)},{lon(i)}) = data({lat(i)},{lon(i)}) + 1
> end do
>
> data = where(dataCount.ne.0, data/dataCount, data)
>
> Hope that helps...
> Rick
>
>
> On Sat, Jun 27, 2020 at 6:01 PM Vanúcia Schumacher via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
> Hi users,
>
> I need some help to figure out how I could get the average of the
> variable when there is more than 1 value for the same pixel (lat and lon
> values that are within the same pixel).
>
> In this data example (attached), 3 values of lat and lon are very close,
> so in my script (attached) I get the sum of these values, but I would like
> to change it to get the average value when this happens (lat and lon close).
>
> Variable: var
> Type: float
> Total Size: 48 bytes
>             12 values
> Number of Dimensions: 1
> Dimensions and sizes: [12]
> Coordinates:
> (0) -64.611
> (1) -23.999
> (2) 12.76
> (3) -22.784
> (4) -16.24
> .....
>
> Variable: xvalid
> Type: float
> Total Size: 40 bytes
>             10 values
> Number of Dimensions: 1
> Dimensions and sizes: [10]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue : -999
> (0) -75.85      ======>>>>> sum of  -64.611, -23.999, 12.76 values
> (1) -22.784
> .......
>
> I appreciate some help
>
>
> _______________________________________________
> 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/20200705/3b46b0ba/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_LatLon.ncl
Type: application/octet-stream
Size: 2646 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200705/3b46b0ba/attachment.obj>


More information about the ncl-talk mailing list