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

Home » Public Forums » archive » map function for astronomy
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: map function for astronomy [message #90060 is a reply to message #89883] Wed, 21 January 2015 10:23 Go to previous message
Matt Haffner is currently offline  Matt Haffner
Messages: 34
Registered: October 2000
Member
I've also had to do something similar with the new function graphic calls to get astronomical images plotted correctly. I haven't found anything in testing or in the docs that suggests longitude can be projected in the opposite direction.

In the old days, I flipped the sign, like you've done and just dealt with having to pass negative longitudes for overplotting, labels, etc. But with the new mapping functions, the LIMIT keyword's longitudes can't be less than -180. So, there's a problem if your image has sky coordinates above +180.

However, the *maximum* longitude in LIMIT is allowed to be as high as +540. So I now "flip" the longitude with this function:

new_lon = (360 - orig_lon)

A simple label_format function looks like this then:

function mapgrid_gal_360flip_labels, orient, value, fractional, default

if orient eq 0 then v = 360-value else v = value

if fractional eq 0 then begin
l = string(v, format = '(I4)')
endif else begin
l = string(v, format = '(F6.2)')
endelse

return, l

end

Any overplotting, etc. needs to convert coordinates with (360 - lon), which is a bit more annoying than just negating. But it works.

STILL, I'd like to make a plea to the developers to please consider adding a simple /REVERSE keyword for projections again for those of us who like to plot data on the inside of spheres :) I'm enjoying a lot of the flexibility and output of the function graphics and would love to move more of our code library in that direction.

- mh

On Tuesday, December 16, 2014 at 3:24:46 PM UTC-6, esh...@umd.edu wrote:
> On Monday, December 15, 2014 6:21:40 PM UTC-5, esh...@umd.edu wrote:
>> I want to use the map function for plots of the sky. In the map_set procedure there was a simple reverse=1 keyword to do this. How do we do this with the map function?
>
> Well, I have gone ahead and wrote the code to force a reversal of the longitude and at least make it possible to plot skymaps with the map procedure. Here is what I did (but if anyone can find an easier way, I am all ears). First, I use the negative of the RA values in the limits:
>
> limit = [decmin,-ramax,decmax,-ramin]
>
> and call the map function with label_format keyword:
>
> map1 = map('Orthographic', limit=limit, label_format = 'mapgrid_labels_reverse')
>
> The label_format keyword is a callback to a user supplied function that can alter the labels. So mine is call mapgrid_labels_reverse:
> function MapGrid_Labels_Reverse, orientation, location, fractional, defaultlabel
> ; Reverse RA labels for skymaps
> ; Be sure to reverse both the RA limits and the RA values
> ; And then use map function like so
> ; m = MAP(orthographic, LABEL_FORMAT='MapGrid_Labels_Reverse', limit=limit)
>
> ; If grid line is RA (orientation = 0), then reverse it
> if (orientation eq 0) then begin
> location = -location
> if (location lt 0) then location = location + 360.
> endif
>
> degree = '!M' + STRING(176b) ; Use the Math symbol
>
> label = STRTRIM(ROUND(location),2) + degree
>
> return, label
> end
> ----
> This just uses degrees. Of course, one could be fancy here and output hours, min, sec etc instead.
> Next one has to use the reverse of the ra in plotting any values:
> map1 = plot(/overplot,-ra,dec,symbol='+',linestyle='')
>
> Again, hopefully, I am just being silly here and there is some keyword or something that does all of this automagically.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: FINITE function
Next Topic: Map method bug?

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

Current Time: Wed Oct 08 16:03:16 PDT 2025

Total time taken to generate the page: 0.00196 seconds