<div dir="ltr">Thank you very much for your help. I could do that. <div><br></div><div>Dinuka</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 31, 2017 at 12:29 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Quick FYI: in general you want to avoid "do" loops, as they can be slow in scripting languages.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Using"conform_dims" as Guido suggested would be faster:</div><div class="gmail_default"><br></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">dims2d = (/dimsizes(lat), dimsizes(lon)/)</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">lat2d = conform_dims(dims2d,lat,0) <br></font></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><font face="monospace, monospace">lon2d = conform_dims(dims2d,lon,1) </font><br></div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/conform_dims.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>conform_dims.shtml</a></div><span class="HOEnZb"><font color="#888888"><div><br></div></font></span></div><span class="HOEnZb"><font color="#888888"><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div><div><br></div></font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 30, 2017 at 2:34 AM, Guido Cioni <span dir="ltr"><<a href="mailto:guidocioni@gmail.com" target="_blank">guidocioni@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">One way to go would be to use the 1-D array anyway by doing a smart conform. Otherwise you can create 2-D "dummy" variables using these functions:<div><br></div><div><div><font face="Menlo" size="1">undef("create_lon2d")</font></div><div><font face="Menlo" size="1">function create_lon2d(lat[*]:numeric, lon[*]:numeric)</font></div><div><font face="Menlo" size="1">local x, i</font></div><div><font face="Menlo" size="1">begin</font></div><div><font face="Menlo" size="1"> x = new((/dimsizes(lat),dimsizes(l<wbr>on)/),typeof(lat))</font></div><div><span style="font-family:Menlo;font-size:x-small"> do i=0,dimsizes(lat)-1</span></div><div><font face="Menlo" size="1"> x(i,:) = lon</font></div><div><font face="Menlo" size="1"> end do</font></div><div><font face="Menlo" size="1"> return(x)</font></div><div><font face="Menlo" size="1">end</font></div><div><br></div><div><font face="Menlo" size="1">undef("create_lat2d")</font></div><div><font face="Menlo" size="1">function create_lat2d(lat[*]:numeric, lon[*]:numeric)</font></div><div><font face="Menlo" size="1">local y, i</font></div><div><font face="Menlo" size="1">begin</font></div><div><font face="Menlo" size="1"> y = new((/dimsizes(lat),dimsizes(l<wbr>on)/),typeof(lat))</font></div><div><span style="font-family:Menlo;font-size:x-small"> do i=0,dimsizes(lon)-1</span></div><div><font face="Menlo" size="1"> y(:,i) = lat</font></div><div><font face="Menlo" size="1"> end do</font></div><div><font face="Menlo" size="1"> return(y)</font></div><div><font face="Menlo" size="1">end</font></div></div><div><font face="Menlo" size="1"><br></font></div><div><font face="Menlo" size="1"><div> lat2d = create_lat2d(lat,lon) </div><div> lon2d = create_lon2d(lat,lon)</div></font></div><div><div><div class="m_5940159155363829539h5"><br><div><blockquote type="cite"><div>On 30. Aug 2017, at 10:29, Dinuka Silva <<a href="mailto:dinu.kera@gmail.com" target="_blank">dinu.kera@gmail.com</a>> wrote:</div><br class="m_5940159155363829539m_-3780688881707119818Apple-interchange-newline"><div><div dir="ltr"><div><font face="Times New Roman" size="3"><br></font></div><div><font face="Times New Roman" size="3"><div>printVarSummary(x) is as follows.</div><div><br></div><div><br></div><div><div>Variable: x</div><div>Type: float</div><div>Total Size: 454377600 bytes</div><div> 113594400 values</div><div>Number of Dimensions: 3</div><div>Dimensions and sizes: [time | 1753] x [latitude | 180] x [longitude | 360]</div><div>Coordinates: </div><div> time: [15.49999..53340.5]</div><div> latitude: [89.5..-89.5]</div><div> longitude: [-179.5..179.5]</div><div>Number Of Attributes: 8</div><div> lon2d : <ARRAY of 360 elements></div><div> lat2d : <ARRAY of 180 elements></div><div> _FillValue : -1e+30</div><div> standard_name : sea_surface_temperature</div><div> long_name : sst</div><div> units : C</div><div> cell_methods : time: lat: lon: mean</div><div> missing_value : -1e+30</div><div>fatal:And: Dimension size, for dimension number 0, of operands does not match, can't continue</div></div><div><br></div></font><div><span style="font-family:'Times New Roman';font-size:inherit">It looks like "latitude" and "longitude" are 1D arrays . How can I make them to be 2D arrays. </span><span style="font-family:'Times New Roman';font-size:inherit"><br></span></div><div><span style="font-family:'Times New Roman';font-size:inherit"><br></span></div><div><span style="font-family:'Times New Roman';font-size:inherit">Dinuka.</span></div><div><span style="font-family:'Times New Roman';font-size:inherit"> </span><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 30, 2017 at 4:04 PM, Guido Cioni <span dir="ltr"><<a href="mailto:guidocioni@gmail.com" target="_blank">guidocioni@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Dinuka, <div>don’t start new topic if the problem is always the same. People will get confused when they search for answers. </div><div><br></div><div>Did you check that your latitude and longitude are 2-D arrays? </div><div>The error is exactly telling you where the problem is.</div><div><br></div><div><br><div><blockquote type="cite"><div><div class="m_5940159155363829539m_-3780688881707119818h5"><div>Il giorno 30 ago 2017, alle ore 07:30, Dinuka Silva <<a href="mailto:dinu.kera@gmail.com" target="_blank">dinu.kera@gmail.com</a>> ha scritto:</div><br class="m_5940159155363829539m_-3780688881707119818m_-2090860911938063932Apple-interchange-newline"></div></div><div><div><div class="m_5940159155363829539m_-3780688881707119818h5"><div dir="ltr"><div dir="ltr"><span style="font-size:12.8px">Hi all,</span><br><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">I want to remove SST data of one box ({03N - 12N}, {90E- 140E}) and then find the correlation between remaining SST data and rainfall index. I want to know how can I remove the SST data of that box. SST data has 3 dimensions. I used mask function but I got error message. </span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div><div><span style="font-size:12.8px">x = fin2->sst(:,:,:)</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"> x@lat2d = fin2->latitude</span></div><div><span style="font-size:12.8px"> x@lon2d = fin2->longitude</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"> latMin = 03</span></div><div><span style="font-size:12.8px"> latMax = 12</span></div><div><span style="font-size:12.8px"> lonMin = 90</span></div><div><span style="font-size:12.8px"> lonMax = 140</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"> x = mask (x, conform(x, (<a href="mailto:x@lat2d.ge.latMin" target="_blank">x@lat2d.ge.latMin</a> .<a href="mailto:and.x@lat2d.le.latMax" target="_blank">and.x@lat2d.le.latMax</a> .<a href="mailto:and.x@lon2d.ge.lonMin" target="_blank">and.x@lon2d.ge.lonMin</a> .<a href="mailto:and.x@lon2d.le.lonMax" target="_blank">and.x@lon2d.le.lonMax</a>), (/1,2/)), True)</span></div><div><span style="font-size:12.8px">printVarSummary(x)</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:inherit;font-family:'Times New Roman'">The error message : </span><font face="Times New Roman" size="3">Dimension size, for dimension number 0, of operands does not match, can't continue</font><br></div></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">Thanks for your help.</span></div><div style="font-size:12.8px"><span style="font-size:12.8px">Dinuka</span><br></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div></div></div><div id="m_5940159155363829539m_-3780688881707119818m_-2090860911938063932DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top:1px solid #d3d4de">
<tbody><tr>
<td style="width:55px;padding-top:13px"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width:46px;height:29px"></a></td>
<td style="width:470px;padding-top:12px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link" style="color:#4453ea" target="_blank">www.avast.com</a>
</td>
</tr>
</tbody></table><a width="1" height="1"></a></div></div></div>
______________________________<wbr>_________________<br>ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br></div></blockquote></div><br></div></div></blockquote></div><br></div>
______________________________<wbr>_________________<br>ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br></div></blockquote></div><br></div></div><span class="m_5940159155363829539HOEnZb"><font color="#888888"><div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br class="m_5940159155363829539m_-3780688881707119818Apple-interchange-newline">Guido Cioni</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="http://guidocioni.altervista" target="_blank">http://guidocioni.altervista</a>.o<wbr>rg</div>
</div>
<br></font></span></div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>