[ncl-talk] how to take area average of a user-defined polygon region

Adam Phillips asphilli at ucar.edu
Mon Sep 28 09:44:52 MDT 2015


Hi Mira,
First off, if you do not have a land/sea mask available for the dataset
that you are analyzing, it would be best to use the built-in NCL function
landsea_mask:
https://www.ncl.ucar.edu/Document/Functions/Shea_util/landsea_mask.shtml
There are numerous examples available on the bottom of that page.

For your averaging question: If you want to average over a rectangle and
you are analyzing a rectilinear grid you can use wgt_areaave_Wrap:
https://www.ncl.ucar.edu/Document/Functions/Contributed/wgt_areaave_Wrap.shtml

You can use index or coordinate subscripting to specify your rectangle; see
example #3 on that page for examples of both. If you do not know what
coordinate subscripting is I strongly suggest you peruse the following
links:
https://www.ncl.ucar.edu/Document/Language/subscript_coord.shtml
http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#Subscripts

Finally, if you'd like to chose a grid cell closest to a lat/lon point you
can again use coordinate subscripting. An example:

; arr is a 3 dimensional array ordered time x latitude x longitude with
coordinate variables time, lat, and lon
plat = 35.
plon = 15.
pt = arr(:, {plat},{plon})
printVarSummary(pt)

Finally: If you have not done so I would highly recommend you read through
the mini-language manual here:
http://www.ncl.ucar.edu/Document/Manuals/language_man.pdf

Hope that helps. If not or if you have further questions please respond to
the ncl-talk email list.
Adam




On Sun, Sep 27, 2015 at 12:30 PM, <mberdahl at envsci.rutgers.edu> wrote:

> Hi all,
>
> I have model output for the north atlantic/greenland region and I would
> like to take regional averages of precipitation.  I'm wondering how to
> define the regions with NCL.  For example, I would like to take the
> average of precipitation over the Southeast of Greenland, this region
> would have to be a polygon defined by the user.  I would only like to
> consider grid cells on land as well.  Does anyone have any advice on this?
>
> Independent of this, I would like to be able to choose the grid cell
> closest to a lat/lon point that is user-defined.  Can someone point me in
> the right direction please?
>
> Thanks very much,
> Mira
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>



-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150928/d66d6123/attachment.html 


More information about the ncl-talk mailing list