[ncl-talk] extract_Data_from_polygon

Guido Cioni guidocioni at gmail.com
Fri May 27 12:09:38 MDT 2016


Sorry I had no time today, I will take a look at that tomorrow.
Il 27 mag 2016 7:21 PM, "Kunal Bali" <kunal.bali9 at gmail.com> ha scritto:

> Dear Guido
>
>
> The ASCII output from this script is not showing the whole data of the
> selected box and the values are also repeating in the ASCII file.
>
> Anyways, Thank You so much for your time. I appreciate that.
>
> Thank You
>
>
> Kunal Bali
> Research Scholar
> Radio & Atmospheric Science Division
> CSIR - National Physical Laboratory
> New Delhi - 110012
> India
>
>
>
>
>
> On Fri, May 27, 2016 at 10:19 PM, Guido Cioni <guidocioni at gmail.com>
> wrote:
>
>> Dear Kunal,
>> attached you find the resulting script. First I subsetted the var over
>> the domain that you specified (the one that is used to plot the polygon)
>> and obtain var2. Then I did some trick to get the lat/lon coordinates
>> printed in the CSV file.
>>
>>
>>
>>
>> Guido Cioni
>> http://guidocioni.altervista.org
>>
>>
>>
>>
>> Il giorno 27 mag 2016, alle ore 17:51, Kunal Bali <kunal.bali9 at gmail.com>
>> ha scritto:
>>
>> I am not getting it exactly how to do this one.
>> Could any one please help me out to do this.
>>
>> Kunal Bali
>> Research Scholar
>> Radio & Atmospheric Science Division
>> CSIR - National Physical Laboratory
>> New Delhi - 110012
>> India
>>
>>
>>
>>
>>
>> On Fri, May 27, 2016 at 6:12 PM, Guido Cioni <guidocioni at gmail.com>
>> wrote:
>>
>>> Once you have the correct variable you can write it to an CSV file by
>>> using the write table function.
>>>
>>>  alist=[/clon,clat,var2/]
>>>  write_table(“file.csv”,"w",alist,”%f,%f,%f,%f")
>>>
>>> Guido Cioni
>>> http://guidocioni.altervista.org
>>>
>>> On 27 May 2016, at 14:24, Kunal Bali <kunal.bali9 at gmail.com> wrote:
>>>
>>> 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
>>>>
>>>>
>>>>
>>>
>>>
>> <FRP.nc>
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160527/644f5b43/attachment.html 


More information about the ncl-talk mailing list