[ncl-talk] extract_Data_from_polygon

Kunal Bali kunal.bali9 at gmail.com
Fri May 27 06:24:20 MDT 2016


Dear Guido

Thanks for the information.
Actually, I need to extract the data as ASCII or CSV file of the selected
polygon box



Kunal Bali
Research Scholar
Radio & Atmospheric Science Division
CSIR - National Physical Laboratory
New Delhi - 110012
India





On Fri, May 27, 2016 at 5:35 PM, Guido Cioni <guidocioni at gmail.com> wrote:

> Dear Kunal,
> I didn’t answer to the first email because I am not really familiar with
> shapefile and masking over nations boundaries, but I guess there is a lot
> of documentation on the website. Is your a polygon just an approximation
> because you don’t know how to mask using the shape file or is it really
> what you wanted to do?
>
> In order to extract the data you can either create a new variable where
> you mask the region outside of the polygon or where you put all the data
> inside of the polygon. I would use the first approach, since what you get
> is a variable with the same dimensions, but maybe the second one is easier.
> Since you have two arrays with lon,lat coordinates can’t you just create
> a new variable, called var2, which is a subset of var?
>
> Assuming that var has dimension (time, lat, lon) you can simply do that
>
> var2=var(:,{lat},{lon})
>
> The {} means that you are using coordinate indexing, it should work also
> with array although I’m not 100% sure. With this method you will get a
> variable with different dimensions. Otherwise you can try to mask using
> logical staments. Assuming you have (clon,clat) coordinates in your file
> (I used different names because of your definition in the script) you can
> try something similar
>
> var2=mask(var, lon.ge.min(clon) .AND. lon.le.max(clon) .AND.
> lat.ge.min(clat) .AND. lat.le.max(clat), False)
>
> Cheers
>
>
> Guido Cioni
> http://guidocioni.altervista.org
>
> On 27 May 2016, at 12:31, Kunal Bali <kunal.bali9 at gmail.com> wrote:
>
> Dear NCL
>
> I tried to make the  polygon of the selected region. I don't know i did it
> correctly or not, please let me know is it correct way to do or not.
>
> Second thig is that I need to extract the data from selected polygon.
> Could anyone please let me know how to do it ?
>
>
> Regards
> Kunal Bali
>
>
>
>
>
> <polygon.ncl><polygon.png>_______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160527/975b6ef1/attachment.html 


More information about the ncl-talk mailing list