Re: Question on the longitude coordinates transform?

From: xiang lin <leo.aries.g_at_nyahnyahspammersnyahnyah>
Date: Sat Nov 26 2011 - 20:44:31 MST

I resolve the problem using the following scripts. Anyone can take a look
at it?

    23 data =
 asciiread("/Work/smi/Hadslp2_185001-200412.dat",-1,"float")
     24 x = onedtond(data,(/72,37,12,155/))
     25 x!0 = "lon"
     26 x!1 = "lat"
     27 x!2 = "month"
     28 x!3 = "year"
     29 x&lon = fspan(-180.,175.,72) ; see more details in the
hadslpr2's data read instruction
     30 x&lon@units = "degree_east"
     31 x&lat = fspan(90.,-90.,37)
     32 x&lat@units = "degree_north"
     33 x&month = ispan(1,12,1)
     34 x&year = ispan(1850,2004,1)
     35 printVarSummary(x)
     36 ; Longitude coordinates transform
     37 xx = x
     38 xx(0:35,:,:,:) = x(36:71,:,:,:)
     39 xx(36:71,:,:,:) = x(0:35,:,:,:)
     40 xx&lon = fspan(0.,355.,72)
     41 xx&lon@units = "degree_east"
     42 printVarSummary(xx)

2011/11/25 xiang lin <leo.aries.g@gmail.com>

> Thanks for the reply!
>
> However, I guess you didn't understand my problem. I want to draw the
> plot in the region of (30E, 150W),
> the west boundary locate at the 30E and the east boundary is at 150W. If I
> just set the resource as below:
> res@mpMinLonF = -150
> res@mpMaxLonF = 30
> then what I got is opposite to what I want.
>
> The lonFlip or lonPivot function can transform the coordinates of
> (0E,360E) to (-180E,180E), and what I want
> to do is just the reverse.
>
> Thanks!
>
>
> Lin
>
>
>
>
>
> 2011/11/25 Dennis Shea <shea@ucar.edu>
>
>> PLEASE ... do *not* repeat post to ncl-talk.
>> This is a 4-day national holiday.
>>
>> You have your settings incorrect. They are reversed
>>
>> res@mpMinLonF = -150
>> res@mpMaxLonF = 30
>>
>>
>> On 11/24/11 9:54 AM, xiang lin wrote:
>>
>>> Hi,all
>>>
>>> I am fluent with the longitude coordinates of (0E, 360E), but now
>>> was a little puzzled when dealing with the coordinates of (-180E,175E) .
>>>
>>> Here below is parts of my scripts :
>>>
>>> ; read the hadslp data
>>> data = asciiread("/Work/smi/Hadslp2_**
>>> 185001-200412.dat",-1,"float")
>>> x = onedtond(data,(/72,37,12,155/)**)
>>> x!0 = "lon"
>>> x!1 = "lat"
>>> x!2 = "month"
>>> x!3 = "year"
>>> x&lon = fspan(-180.,175.,72) ; see more details in the
>>> hadslpr2's data read instruction
>>> x&lon@units = "degrees_east"
>>> x&lat = fspan(90.,-90.,37)
>>> x&lat@units = "degree_north"
>>> x&month = ispan(1,12,1)
>>> x&year = ispan(1850,2004,1)
>>> printVarSummary(x)
>>> ......
>>> res@mpMinLonF = 30
>>> res@mpMaxLonF = -150
>>>
>>> I want to pick out the sub-region eastward extending from 30E to 150W,
>>> but of course the above resource would cause errors for the reason that
>>> mpMinLonF must be less than
>>> mpMaxLonF.
>>>
>>> How could I set the region correctly for plot? Is there a way to
>>> transform the coordinates such as (-180E, 175E) to the ones such as
>>> (0E,360E)? I know the lonFlip and lonPivot,
>>> However, I don't find a corresponding function to the opposite job.
>>>
>>> Thanks!
>>>
>>> best wish!
>>>
>>>
>>> Lin
>>>
>>>
>>>
>>> ______________________________**_________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/**mailman/listinfo/ncl-talk<http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>>
>>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Nov 26 20:44:40 2011

This archive was generated by hypermail 2.1.8 : Wed Nov 30 2011 - 19:52:47 MST