<div dir="ltr"><div>Yes.</div><div><br></div><div>'q' should have all values outside the area of interest set to _FillValue.</div><div><br></div><div>see:  <a href="http://www.ncl.ucar.edu/Applications/shapefiles.shtml"><b>http://www.ncl.ucar.edu/Applications/shapefiles.shtml</b></a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 23, 2020 at 8:45 AM Zeinab Salah via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.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="rtl"><div dir="ltr">Hi,</div><div dir="ltr">I want to calculate the sum of precipitation over an area from netcdf and the area selected by shapefile and the value to be in m3.</div><div dir="ltr">Does the function of  "wgt_areasum2 " make that?, and what is the unit of its output?</div><div dir="ltr">Also, in the example of "wgt_areasum2",  the variable of dxdy in conform, needs to be corrected to dydx as defined.</div><div dir="ltr"><br></div><div dir="ltr"><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)">   re   = 6.37122e06
   rad  = 4.0 * <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/atan.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(133,45,133);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">atan</strong></a>(1.0) / 180.o
   con  = re * rad                 
   clat = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/cos.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(133,45,133);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">cos</strong></a>(lat * rad)           ; cosine of latitude
   
   dlon = (lon(2) - lon(1))        ; assume dlon is constant
   dlat = (lat(2) - lat(1))        ; assume dlat is constant

   dx   = con * dlon * clat        ; dx at each latitude
   dy   = con * dlat               ; dy is constant
   dydx = dy * dx                  ; dydx(nlat)
   
   wgt  = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(133,45,133);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">new</strong></a>((/nlat, mlon/), <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/typeof.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(133,45,133);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">typeof</strong></a>(q))
   wgt  = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/conform.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(133,45,133);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">conform</strong></a>(wgt, dxdy, 0)
  
   qSum = <strong style="margin:0px;padding:0px">wgt_areasum2</strong>(q, wgt, opt) </pre></div><div dir="ltr"><br></div><div dir="ltr">Thank you in advance.</div><div dir="ltr">Best regards.</div><div dir="ltr">Zeinab</div><div dir="ltr"><br></div><div dir="ltr"><br></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>