<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thank you very much (Shukran) Rashed,<div class="">I’m trying the first suggestion. And then, I’ll try the second one. </div><div class=""><br class=""></div><div class="">I’ll let you know about the results.</div><div class=""><br class=""></div><div class="">Best wishes,</div><div class="">Abdulla<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 11 May 2020, at 19:00, Rashed Mahmood <<a href="mailto:rashidcomsis@gmail.com" class="">rashidcomsis@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Or a more clear way could be:</div><div class=""><br class=""></div><div class="">
<div class=""><span class="gmail-im"><div class="">do t=0,35</div><div class=""><span style="white-space:pre-wrap" class="">    </span>z=0</div><div class=""><span style="white-space:pre-wrap" class="">        </span>nw=0.</div><div class=""><span style="white-space:pre-wrap" class="">      </span>do i=0,30</div><div class=""><span style="white-space:pre-wrap" class="">          </span>z=z+1</div></span><div class=""><span style="white-space:pre-wrap" class="">         </span>nva=where(veg.eq.z, <span style="color:rgb(255,0,0)" class=""><b class="">nwp(t,:,:)</b></span>, 0.)</div><span class="gmail-im"><div class=""><span style="white-space:pre-wrap" class=""></span></div><div class=""><span style="white-space:pre-wrap" class="">                nv  = tofloat(sum(nva))</span></div><div class=""><span style="white-space:pre-wrap" class="">                delete(nva)
<span class="gmail-im"><div class="">        ;nwpveg(t,i)=nv</div><div class=""><span style="white-space:pre-wrap" class="">    </span>print(z+" "+nv)</div></span> </span>end do</div><div class="">end do</div></span></div>

</div><div class=""><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 11, 2020 at 8:47 AM Rashed Mahmood <<a href="mailto:rashidcomsis@gmail.com" class="">rashidcomsis@gmail.com</a>> wrote:<br class=""></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" class=""><div class="">Hi Abdullah,</div><div class="">I think the following may work, make sure that is what you want?:</div><div class="">See the red colour since nwp is 3D so you may want to assign "t" in first argument...double check.<br class=""></div><div class="">
<div class=""><div class="">do t=0,35</div><div class=""><span style="white-space:pre-wrap" class="">   </span>z=0</div><div class=""><span style="white-space:pre-wrap" class="">        </span>nw=0.</div><div class=""><span style="white-space:pre-wrap" class="">      </span>do i=0,30</div><div class=""><span style="white-space:pre-wrap" class="">          </span>z=z+1</div><div class=""><span style="white-space:pre-wrap" class="">              </span>nv=where(veg.eq.z, doubletofloat(dim_sum_n(<span style="color:rgb(255,0,0)" class=""><b class="">nwp(t,:,:)</b></span>,(/1,2/))), 0.)</div><div class=""><span style="white-space:pre-wrap" class="">                </span>;nwpveg(t,i)=nv</div><div class=""><span style="white-space:pre-wrap" class="">            </span>;print(z+" "+nv)</div><div class=""><span style="white-space:pre-wrap" class=""> </span>end do</div><div class="">end do</div></div>

</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 11, 2020 at 6:06 AM ABDULLA SAKALLI via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank" class="">ncl-talk@ucar.edu</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="">Dear Lists,<div class="">I’ve two arrays that I should compare them and add the value of the second array where the first array match some conditions. </div><div class="">The array one is:</div><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px" class=""><div class=""><div class=""><span style="font-size:9px" class="">Variable: veg</span></div><div class=""><span style="font-size:9px" class="">Type: integer</span></div><div class=""><span style="font-size:9px" class="">Total Size: 1036800 bytes</span></div><div class=""><span style="font-size:9px" class="">            259200 values</span></div><div class=""><span style="font-size:9px" class="">Number of Dimensions: 2</span></div><div class=""><span style="font-size:9px" class="">Dimensions and sizes:<span style="white-space:pre-wrap" class="">     </span>[360] x [720]</span></div><div class=""><span style="font-size:9px" class="">Coordinates:</span></div><div class=""><span style="font-size:9px" class="">Number Of Attributes: 1</span></div><div class=""><span style="font-size:9px" class="">  _FillValue :<span style="white-space:pre-wrap" class="">        </span>-2147483647</span></div></div></blockquote><div class=""><br class=""></div><div class="">The array two is:</div><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px" class=""><div class=""><div class=""><i style="font-size:9px" class="">Variable: nwp</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">Type: double</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">Total Size: 74649600 bytes</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">            9331200 values</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">Number of Dimensions: 3</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">Dimensions and sizes:<span style="white-space:pre-wrap" class=""> </span>[time | 36] x [lat | 360] x [lon | 720]</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">Coordinates:</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">            time: [183.5..12967]</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">            lat: [-89.5..90]</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">            lon: [-179.5..180]</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">Number Of Attributes: 4</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">  units :<span style="white-space:pre-wrap" class="">     </span>mm</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">  _FillValue :<span style="white-space:pre-wrap" class="">      </span>-9999</i></div></div><div class=""><div class=""><i style="font-size:9px" class="">  missing_value :<span style="white-space:pre-wrap" class="">        </span>-9999</i></div></div></blockquote><div class=""><br class=""></div><div class="">The first array contains 31 vegetation types. I’d like to get the sum of the all nwp points classified according to the veg array.</div><div class=""><br class=""></div><div class="">My loop looks like:</div><div class=""><br class=""></div><div class=""><div class="">do t=0,35</div><div class=""><span style="white-space:pre-wrap" class="">    </span>z=0</div><div class=""><span style="white-space:pre-wrap" class="">        </span>nw=0.</div><div class=""><span style="white-space:pre-wrap" class="">      </span>do i=0,30</div><div class=""><span style="white-space:pre-wrap" class="">          </span>z=z+1</div><div class=""><span style="white-space:pre-wrap" class="">              </span>nv=where(veg.eq.z, doubletofloat(dim_sum_n(nwp,(/1,2/))), 0.)</div><div class=""><span style="white-space:pre-wrap" class="">              </span>;nwpveg(t,i)=nv</div><div class=""><span style="white-space:pre-wrap" class="">            </span>;print(z+" "+nv)</div><div class=""><span style="white-space:pre-wrap" class=""> </span>end do</div><div class="">end do</div></div><div class=""><br class=""></div><div class="">by running the code I got the error messages</div><div class=""><div class=""><font size="1" class=""><i class="">fatal:where: condition variable (parameter 0) dimension mismatch with parameter 1</i></font></div><div class=""><font size="1" class=""><i class="">fatal:["Execute.c":8637]:Execute: Error occurred at or near line 77 in file ReadNcFiles-VegNr-0p5deg.ncl</i></font></div></div><div class=""><br class=""></div><div class="">Does anyone of you have an idea, how can I solve this problem? or better to say, how can I get the increment of the nwp array when the veg array equal to 1 to 31 one.</div><div class=""><br class=""></div><div class="">Best wishes,</div><div class="">Abdulla</div><div class=""><br class=""><div class="">
<div dir="auto" style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none" class=""><div dir="auto" style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none" class=""><div class=""><font color="#585858" class="">---------------------------------------------------------------------------<br class="">Assoc. Prof. Abdulla Sakalli<br class=""><br class="">Iskenderun Technical University<br class="">Faculty of Engineering and Natural Sciences<br class="">Dept. Industrial Engineering<br class="">Merkez Kampus<br class="">Iskenderun-Hatay-Turkey<br class=""><a href="mailto:as@abdulla-sakalli.com" target="_blank" class="">as@abdulla-sakalli.com</a><br class=""><a href="mailto:abdulla.sakalli@iste.edu.tr" target="_blank" class="">abdulla.sakalli@iste.edu.tr</a><br class="">+90 326 613 5600/4313<br class="">+90 536 506 9191<br class=""></font><br class=""></div></div></div>
</div>
<br class=""></div></div>_______________________________________________<br class="">
ncl-talk mailing list<br class="">
<a href="mailto:ncl-talk@ucar.edu" target="_blank" class="">ncl-talk@ucar.edu</a><br class="">
List instructions, subscriber options, unsubscribe:<br class="">
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank" class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div>
</div></blockquote></div><br class=""><div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div><font color="#585858" class="">---------------------------------------------------------------------------<br class="">Assoc. Prof. Abdulla Sakalli<br class=""><br class="">Iskenderun Technical University<br class="">Faculty of Engineering and Natural Sciences<br class="">Dept. Industrial Engineering<br class="">Merkez Kampus<br class="">Iskenderun-Hatay-Turkey<br class=""><a href="mailto:as@abdulla-sakalli.com" class="">as@abdulla-sakalli.com</a><br class="">abdulla.sakalli@iste.edu.tr<br class="">+90 326 613 5600/4313<br class="">+90 536 506 9191<br class=""></font><br class=""></div></div></div>
</div>
<br class=""></div></body></html>