<div dir="ltr"><div>Please see attached script.</div><div><br></div><div>%> ncl test_LatLon.ncl</div><div><br></div><div>Good Luck<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 29, 2020 at 10:58 AM 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="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">Thanks Rick for your time, but it didn't work.</span><br>
</div>
<div id="gmail-m_1265323154697085002appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_1265323154697085002divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De:</b> Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>><br>
<b>Enviado:</b> segunda-feira, 29 de junho de 2020 12:33<br>
<b>Para:</b> Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><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>
<div dir="ltr">On Sat, Jun 27, 2020 at 6:01 PM Vanúcia Schumacher via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote 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>
</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>