<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi NCL talk,
<div class=""><br class="">
</div>
<div class="">I am trying to create an array with values where a conditional statement is true (where both snow and rain are >0). Basically, I am looking to find where a transition region (from snow to rain) is occurring, by finding where rain and snow are
occurring at the same time. I receive the following error: <span style="font-family: Menlo; font-size: 11px;" class="">fatal:Loop variable must be scalar, can't execute loop</span></div>
<div class=""><br class="">
</div>
<div class="">Is there any better way at approaching this or suggestions for my code? </div>
<div class=""><br class="">
</div>
<div class="">Here is the relevant code:</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">
<div style="margin: 0px;" class="">; size of grid (1015,1359) over conus</div>
<div style="margin: 0px;" class=""><br class="">
</div>
<div style="margin: 0px;" class="">lat2d = wrf_user_getvar(b,"XLAT",0) ;2d array (xlat,xlong)</div>
<div style="margin: 0px;" class="">lon2d = wrf_user_getvar(b,"XLONG",0)</div>
</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">precip = wrf_user_getvar(a,"PREC_ACC_NC",0) ;2d array (xlat,xlong) total hourly accumulated precip</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">snow = wrf_user_getvar(a,"SNOW_ACC_NC",0)</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">graup = wrf_user_getvar(a,"GRAUPEL_ACC_NC",0)</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">rain = precip-graup-snow </div>
</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class="">
</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">
<div style="margin: 0px;" class="">transition = new(dimsizes(precip),typeof(precip),precip@_FillValue) ;creating a new array</div>
<div style="margin: 0px;" class=""><br class="">
</div>
<div style="margin: 0px;" class="">do lon2d=1,1358</div>
<div style="margin: 0px;" class="">do lat2d=1,1014</div>
<div style="margin: 0px; min-height: 13px;" class=""><br class="">
</div>
<div style="margin: 0px;" class="">if (snow(lat2d,lon2d) .gt. 0 .and. rain(lat2d,lon2d) .gt. 0) then</div>
<div style="margin: 0px;" class="">transition(lat2d,lon2d) = snow(lat2d,lon2d)+rain(lat2d,lon2d)</div>
<div style="margin: 0px;" class=""><br class="">
</div>
<div style="margin: 0px;" class="">end if</div>
<div style="margin: 0px;" class="">end do </div>
<div style="margin: 0px;" class="">end do</div>
<div style="margin: 0px;" class=""><br class="">
</div>
<div style="margin: 0px;" class="">
<div style="font-family: Helvetica; font-size: 12px;" class="">Thanks for your help,</div>
<div style="font-family: Helvetica; font-size: 12px;" class=""><br class="">
</div>
<div style="font-family: Helvetica; font-size: 12px;" class="">Juris</div>
<div style="font-family: Helvetica; font-size: 12px;" class="">M.Sc. student</div>
<div style="font-family: Helvetica; font-size: 12px;" class="">University of Manitoba</div>
</div>
<div style="margin: 0px;" class=""><br class="">
</div>
<div style="margin: 0px;" class=""><br class="">
</div>
<div style="margin: 0px;" class=""><br class="">
</div>
<div class=""><br class="">
</div>
</div>
</body>
</html>