Re: mask 2D lat/lon grid with 1D shapefile

From: Maria Gehne <mgehne_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 27 2013 - 12:01:11 MDT

Hi Leif,

the example data set uses 2d lat-lon values. If you look at the code you
can see that one way to mask data using shapefiles is to use the
function ndtooned on the lat2d and lon2d arrays then loop through the
values in each the same way as you would for 1d arrays and then reshapes
the mask to the original dimensions.

Maybe I'm misunderstanding what you are trying to do, but it seems to me
that this should work for any 2d coordinates.

Maria

On 08/27/2013 11:30 AM, Leif Truelsen wrote:
> Thank you for bringing my attention to example 11. Unfortunately, I
> don't think this duplicates my problem. My issue is that my gridded
> data (e.g., u-winds in this example) are on a rotated grid (rlat (y),
> rlon (x)) that are linked to lat2d (x,y) lon2d (x,y) variables. The
> example dataset is in a 1D grid. I need to mask the rotated grid
> using shapefiles (not all rectangular) that are in a 1D lat/lon
> coordinate system. I think that the answer to my problem involves
> using the getind_latlon2d function, but I have yet to figure this out.
>
> Kind regards,
> Leif
>
>
> On Mon, Aug 26, 2013 at 10:37 PM, <mgehne@ucar.edu
> <mailto:mgehne@ucar.edu>> wrote:
>
> Hi Leif,
>
> I just had a similar problem recently. Example 11 deals with
> masking from
> a shapefile
> with 2d lat/lon coordinates.
>
> http://ncl.ucar.edu/Applications/Scripts/shapefiles_11.ncl
>
> I hope this helps,
> Maria
>
> > Hi all,
> >
> > I am looking to extract an area weighted average of gridded data
> using a
> > shape file. I am following the basic procedure of the
> shapefiles_9.ncl
> > example
> (http://www.ncl.ucar.edu/Applications/Scripts/shapefiles_9.ncl).
> > Basically, it reads the 1D lat/lon ranges from the shapefile
> and uses
> > these ranges to mask the original 1D gridded data.
> >
> > Like the example, I have a shapefile in a geographic projection with
> > single
> > dimension x and y values (in degrees). My problem is that my
> gridded data
> > is in a rotated lat/lon grid (time,y,x). The longitude and latitude
> > variables both have two dimensions (y, x). I can't seem to wrap
> my head
> > around how to mask these data using a shapefile in a standard 1D
> grid.
> > Any
> > help would be gratefully received.
> >
> > Best,
> > Leif
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >
>
>
>

-- 
Maria Gehne
Postdoctoral Fellow
NCAR/CGD/CAS
P.O. Box 3000
Boulder, CO 80307

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Aug 27 12:01:27 2013

This archive was generated by hypermail 2.1.8 : Fri Aug 30 2013 - 14:04:57 MDT