# [ncl-talk] precipitation over area in m3

Dennis Shea shea at ucar.edu
Thu Jul 23 12:31:10 MDT 2020

```Yes.

'q' should have all values outside the area of interest set to _FillValue.

see:  *http://www.ncl.ucar.edu/Applications/shapefiles.shtml*
<http://www.ncl.ucar.edu/Applications/shapefiles.shtml>

On Thu, Jul 23, 2020 at 8:45 AM Zeinab Salah via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hi,
> 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.
> Does the function of  "wgt_areasum2 " make that?, and what is the unit of
> its output?
> Also, in the example of "wgt_areasum2",  the variable of dxdy in conform,
> needs to be corrected to dydx as defined.
>
>    re   = 6.37122e06
>    rad  = 4.0 * *atan* <https://www.ncl.ucar.edu/Document/Functions/Built-in/atan.shtml>(1.0) / 180.o
>    con  = re * rad
>    clat = *cos* <https://www.ncl.ucar.edu/Document/Functions/Built-in/cos.shtml>(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  = *new* <https://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml>((/nlat, mlon/), *typeof* <https://www.ncl.ucar.edu/Document/Functions/Built-in/typeof.shtml>(q))
>    wgt  = *conform* <https://www.ncl.ucar.edu/Document/Functions/Built-in/conform.shtml>(wgt, dxdy, 0)
>
>    qSum = *wgt_areasum2*(q, wgt, opt)
>
>
> Thank you in advance.
> Best regards.
> Zeinab
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200723/78004ae9/attachment.html>
```

More information about the ncl-talk mailing list