<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<span style="font-size: 12pt;">Thanks Rick for your time, but it didn't work.</span><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De:</b> Rick Brownrigg <brownrig@ucar.edu><br>
<b>Enviado:</b> segunda-feira, 29 de junho de 2020 12:33<br>
<b>Para:</b> Vanúcia Schumacher <vanucia-schumacher@hotmail.com><br>
<b>Cc:</b> ncl-talk@ucar.edu <ncl-talk@ucar.edu><br>
<b>Assunto:</b> Re: [ncl-talk] Mean with same lat and lon</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>I don't really know for certain, but what about something like this (i.e., explicitly computing the average):</div>
<div><br>
</div>
<div>data           :=  new((/nlat,mlon/),"float"<br>
data           =  0</div>
<div>dataCount := new((/nlat,mlon/), "integer")</div>
<div>dataCount = 0</div>
<div><br>
</div>
<div>do i=.....</div>
<div>   data({lat(i)},{lon(i)}) = data({lat(i)},{lon(i)}) + var(i)</div>
<div>  dataCount({lat(i)},{lon(i)}) = data({lat(i)},{lon(i)}) + 1<br>
</div>
<div>end do <br>
</div>
<div><br>
</div>
<div>data = where(dataCount.ne.0, data/dataCount, data)</div>
<div><br>
</div>
<div>Hope that helps...</div>
<div>Rick<br>
</div>
<div><br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Sat, Jun 27, 2020 at 6:01 PM Vanúcia Schumacher via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:12pt; color:rgb(51,51,51)">Hi users,</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:12pt; color:rgb(51,51,51)">I need some help to </span><span style="font-size:12pt; color:rgb(51,51,51)">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). </span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
</div>
<div><span style="font-size:12pt; color:rgb(51,51,51)">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).</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:12pt">Variable: var</span><span><br>
</span>
<div><span style="font-size:12pt">Type: float</span><br>
</div>
<div><span style="font-size:12pt">Total Size: 48 bytes</span><br>
</div>
<div><span style="font-size:12pt">            12 values</span><br>
</div>
<div><span style="font-size:12pt">Number of Dimensions: 1</span><br>
</div>
<div><span style="font-size:12pt">Dimensions and sizes: [12]</span><br>
</div>
<div><span style="font-size:12pt">Coordinates: </span><br>
</div>
<div><span style="color:rgb(87,6,6); font-size:12pt">(0) -64.611</span><br>
</div>
<div><span style="color:rgb(87,6,6); font-size:12pt">(1) -23.999</span><br>
</div>
<div><span style="color:rgb(87,6,6); font-size:12pt">(2) 12.76</span><br>
</div>
<div><span style="font-size:12pt">(3) -22.784</span><br>
</div>
<div><span style="font-size:12pt">(4) -16.24</span><br>
</div>
<span></span><span style="font-size:12pt">.....</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<span style="font-size:12pt">Variable: xvalid</span><span><br>
</span>
<div><span style="font-size:12pt">Type: float</span><br>
</div>
<div><span style="font-size:12pt">Total Size: 40 bytes</span><br>
</div>
<div><span style="font-size:12pt">            10 values</span><br>
</div>
<div><span style="font-size:12pt">Number of Dimensions: 1</span><br>
</div>
<div><span style="font-size:12pt">Dimensions and sizes: [10]</span><br>
</div>
<div><span style="font-size:12pt">Coordinates: </span><br>
</div>
<div><span style="font-size:12pt">Number Of Attributes: 1</span><br>
</div>
<div><span style="font-size:12pt">  _FillValue : -999</span><br>
</div>
<div><span style="color:rgb(87,6,6); font-size:12pt">(0) -75.85      ======>>>>> sum of  </span><span style="color:rgb(87,6,6); font-size:12pt">-64.611, </span><span style="color:rgb(87,6,6)"></span><span style="color:rgb(87,6,6); font-size:12pt">-23.999, </span><span style="color:rgb(87,6,6); font-size:12pt">12.76
 values</span><br>
</div>
<div><span style="font-size:12pt">(1) -22.784</span><br>
</div>
<div><span style="font-size:12pt">.......</span></div>
<div><br>
</div>
<div><span style="font-size:12pt">I appreciate some help</span><br>
</div>
<span></span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:14pt; color:rgb(0,0,0)">
<br>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote>
</div>
</div>
</body>
</html>