<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hi, <div><br></div><div>I am trying to add up reflectivity values from a bunch of netcdf radar data but I can't quite get it to work. I have 75 files to loop over and I am trying to add to the total each iteration. I have attached the code below. If anyone has any ideas how to put this together correctly that would be great!</div><div><br></div><div><div> ;========================</div><div> ; get list of all files and open as "one big file"</div><div> ;======================== </div><div> fils = systemfunc ("ls ./grids/ncf*.nc") ; file paths</div><div> a = addfiles (fils, "r") </div><div> ListSetType (a, "cat") ; concatenate (=default)</div><div><br></div><div> type = "png"</div><div> wks = gsn_open_wks(type, "radar")</div><div><br></div><div>; Set some Basic Plot options</div><div> res = True</div><div> res@gsnDraw = False ; do not draw the plot</div><div> res@gsnFrame = False ; do not advance the frame</div><div> pltres = True</div><div> pltres@NoTitles = True</div><div> pltres@CommonTitle = True</div><div> pltres@PlotTitle = "Radar Reflectivity DbZ"</div><div> pltres@PanelPlot = True</div><div> pltres@FramePlot = False</div><div> </div><div>; Set the Colormap </div><div> gsn_define_colormap(wks,"WhBlGrYeRe")</div><div> FillValue = 0 </div><div> lat = a[0]->lat0(:,:)</div><div> lon = a[0]->lon0(:,:)</div><div><br></div><div> total = 75</div><div> i = 0</div><div> do while(i.le.total)</div><div> ;print (i)</div><div> if ( i .gt. 0 ) then</div><div> ref_save = a[i]->REF(0,0,:,:) </div><div> ref_save = where(ref_save.lt.45,FillValue,ref_save)</div><div> ref_tot = ref_tot + ref_save</div><div> ;print (ref_save)</div><div> else </div><div> ref_tot = a[i]->REF(0,0,:,:) </div><div> ref_tot = where(ref_tot.lt.45,FillValue,ref_tot)</div><div> end if</div><div><br></div><div> i=i+1</div><div> end do</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div>Thanks in advance! </div><span class="HOEnZb"><font color="#888888"><div>-Tim</div></font></span></div>
<br></div><br></div>
</div><br></div>