comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: mapping data & grid (MAP_SET MAP_GRID)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: mapping data & grid (MAP_SET MAP_GRID) [message #18691] Thu, 03 February 2000 00:00
ronn is currently offline  ronn
Messages: 123
Registered: April 1999
Senior Member
Ken,

If what you want is to have the grid centered about a different place
than the north pole this "kludge" will do the trick.

;-----------------------
pro kludge
;puts a grid centered on a different lat lon.

device,decomposed=0
loadct,0
;make some fake data
data = bytscl(sin(dist(360,180)*!dtor),top=200)
map_set,90,-90,/ortho ;get a grid in the center
map_grid,color=!d.table_size-1 ;make sure it is white
;get an image of the centered grid
newImage = tvrd()
;now change the center of the map to 45 north so it is obvious.
map_set,45,-90,/ortho
;create the data image
img = map_patch(data,xstart=xx,ystart=yy)
tv,img,xx,yy
;now read in the entire screen
dataImage= tvrd()
;dataImage and newImage are now the same size
;find out where the grid lines are
indices = where( newImage eq !d.table_size-1)
;replace those values in the dataImage
dataImage[indices] = !d.table_size-1
tv,dataImage
map_continents
return
end

;---------------------------

Not very elegent, but it works.

I looked at the map_grid code and with a little work I think it could be
changed to accept a different pole for centering. That is, the command
would be map_grid,centerLat=82, centerLon=-90

Maybe some day I will get to it:)

-Ronn

--
Ronn Kling
Ronn Kling Consulting
email: ronn@rlkling.com
Application Development with IDL book at: http://www.rlkling.com/
Shareware and Freeware at: http://www.rlkling.com/


Sent via Deja.com http://www.deja.com/
Before you buy.
Re: mapping data & grid (MAP_SET MAP_GRID) [message #18692 is a reply to message #18691] Thu, 03 February 2000 00:00 Go to previous message
ronn is currently offline  ronn
Messages: 123
Registered: April 1999
Senior Member
Ken,

If what you want is to have the grid centered about a different place
than the north pole this "kludge" will do the trick.

;-----------------------
pro kludge
;puts a grid centered on a different lat lon.

device,decomposed=0
loadct,0
;make some fake data
data = bytscl(sin(dist(360,180)*!dtor),top=200)
map_set,90,-90,/ortho ;get a grid in the center
map_grid,color=!d.table_size-1 ;make sure it is white
;get an image of the centered grid
newImage = tvrd()
;now change the center of the map to 45 north so it is obvious.
map_set,45,-90,/ortho
;create the data image
img = map_patch(data,xstart=xx,ystart=yy)
tv,img,xx,yy
;now read in the entire screen
dataImage= tvrd()
;dataImage and newImage are now the same size
;find out where the grid lines are
indices = where( newImage eq !d.table_size-1)
;replace those values in the dataImage
dataImage[indices] = !d.table_size-1
tv,dataImage
map_continents
return
end

;---------------------------

Not very elegent, but it works.

I looked at the map_grid code and with a little work I think it could be
changed to accept a different pole for centering. That is, the command
would be map_grid,centerLat=82, centerLon=-90

Maybe some day I will get to it:)

-Ronn

--
Ronn Kling
Ronn Kling Consulting
email: ronn@rlkling.com
Application Development with IDL book at: http://www.rlkling.com/
Shareware and Freeware at: http://www.rlkling.com/


Sent via Deja.com http://www.deja.com/
Before you buy.
Re: mapping data & grid (MAP_SET MAP_GRID) [message #18693 is a reply to message #18691] Thu, 03 February 2000 00:00 Go to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
Ken Mankoff wrote:

> Wow, sorry to you all for the poorly worded statement (it turns out there
> wasn't even a question at the end of it all). Its been a long day of
> school and IDL commands that won't do what i want.
>
> So, the question is: Does anyone out there know how to do the following:
>
> thanks again,
> ken.
>
> On Wed, 2 Feb 2000, Kenneth Mankoff wrote:
>
>> Hi all,
>> i'm making global images, with grids, according to the following
>> instructions:
>>
>> 1. draw the globe on the screen so that the _geomagnetic_ pole is
>> centered.
>> 2. draw the grids according to the _geographic_ poles.
>>
>> The code i use is the following:
>> ;;; data is a 2d array, sorted on latitude and longitude.
>> ;;; the geomagnetic pole in the north is at (82, -90), for 1999.
>> MAP_SET, 82, -90, /ortho
>> img = MAP_PATCH(data, xstart=xx, ystart=yy, lon0=lon0, lon1=lon1)
>> TV, img, xx, yy
>> MAP_GRID ;;; <--- ERROR!!
>>
>> This map_grid puts the grid centered on the pole of the data. The pole i
>> want to center it on is different, due to the different coordinate
>> systems.
>>
>> A new map_set to change the coordinates will not work, because the
>> map_grid erases the screen after a map_set
>>
>> I have tried plotting to the Z-buffer, reading it, and re-displaying it to
>> X, but TV does not have a NO_ERASE keyword as far as i can tell, so the
>> data part of the image gets erased again.

Ken,

I guess I'm not following your train of thought. According to your
instructions, the map projection should be centered at the geomagnetic north
pole (82, -90):

map_set, 82, -90, /ortho, /isotropic

Then you want to display a grid registered to the geographic north pole:

map_grid

If you forget about the mapped image for the moment, is this the result you
want?

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: What's new
Next Topic: Re: IDL on the NET(ION) Anybody used it?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 11:25:24 PDT 2025

Total time taken to generate the page: 0.56145 seconds