<div dir="ltr">Hi Dave,<div>Thanks. </div><div><br></div><div>DZ</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 29, 2020 at 12:34 AM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov">dave.allured@noaa.gov</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 dir="ltr"><div dir="ltr">Do not use ".eq." to compare type logical to a number.  Just use the logical directly within an "if" statement.<br><br>No:    if (.not.ismissing(M(i,j)) .eq. 1) then<br>Yes:   if (.not.ismissing(M(i,j))) then<br><br>Also you have one too many loops to do what you want, as Jonathan already indicated.  Also, use print statements to see what is going on.  Try this.<br><br>   print ("Number not missing = " + num (.not. ismissing (M)))<br>   k = 0<br>   do i=0,(dimsizes(lat2d(:,0))-1)<br>     do j=0,(dimsizes(lon2d(0,:))-1)<br>        if (.not.ismissing(M(i,j)) .eq. 1)then<br>           k = k + 1<br>           M(i,j) = k  <br>        end if<br>     end do<br>   end do<br>   print ("Number of assignments = " + k)<div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 28, 2020 at 9:15 PM dale zuri via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@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">Hi NCL user,<br><div> I have been trying to assign number 1,2, 3 etc, for the specific locations. But this piece of code seems to break and not producing any results. I would appreciate any help to fix this problem. </div><div><br></div><div>Thanks in advance!</div><div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">do</span><span style="font-variant-ligatures:no-common-ligatures"> k=</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">0, 8242</span><br></div><div>





<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">   do</span><span style="font-variant-ligatures:no-common-ligatures"> i=</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">0</span><span style="font-variant-ligatures:no-common-ligatures">,(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">dimsizes</span><span style="font-variant-ligatures:no-common-ligatures">(lat2d(:,</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">0</span><span style="font-variant-ligatures:no-common-ligatures">))-</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">1</span><span style="font-variant-ligatures:no-common-ligatures">)</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span>     </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">do</span><span style="font-variant-ligatures:no-common-ligatures"> j=</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">0</span><span style="font-variant-ligatures:no-common-ligatures">,(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">dimsizes</span><span style="font-variant-ligatures:no-common-ligatures">(lon2d(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">0</span><span style="font-variant-ligatures:no-common-ligatures">,:))-</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">1</span><span style="font-variant-ligatures:no-common-ligatures">)</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span>        </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">if</span><span style="font-variant-ligatures:no-common-ligatures"> (</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">.not.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">ismissing</span><span style="font-variant-ligatures:no-common-ligatures">(M(i,j)) </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">.eq.</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">1</span><span style="font-variant-ligatures:no-common-ligatures">)</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">then</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span>           M</span>(i,j)=<span> k  </span></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span>        </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">end</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">if</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span>     </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">end</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">do</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(206,121,36)"><span style="font-variant-ligatures:no-common-ligatures">   end</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span style="font-variant-ligatures:no-common-ligatures">do</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(206,121,36)"><span style="font-variant-ligatures:no-common-ligatures">end do</span></p></div></div></blockquote></div></div></div></div></div></div>
</blockquote></div>