Yet Another Reason Not to Use MAP_SET [message #64422] |
Mon, 29 December 2008 22:02 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
After another *long* and tedious day, I've discovered yet
another reason to abandon MAP_SET for the MAP_PROJ_***
routines. It appears that under certain, relatively
rare, but important to me, circumstances calling MAP_SET
can cause CONVERT_COORD to throw NANs, rather than
good numbers.
I discovered this because I was writing a map coordinate
object for my Catalyst Library. When I was converting from
UV coordinates to lat/lon coordinates, I kept getting NANs.
Very strange...
So here is the deal. Several years ago I worked out what
system variables need to be set to effect a data coordinate
system without actually drawing a plot. This is how I set
up a data coordinate space in the Catalyst Library.
Here is a program, named Coord_Test, that will allow me
to demonstrate the problem:
http://www.dfanning.com/misc/coord_test.pro
By calling Coord_Test, I get this output. The "CATALYST Method"
and the "PLOT Method" are the results of converting the device
coordinate (12, 341) to data coordinates after setting up the
data coordinate space by my "catalyst" method, or by drawing
a plot. (I use Convert_Coord to do the conversion.) As you
can see, I get identical output with both methods, as I expect.
IDL> coord_test
XRange: -2039019.3 3677734.5
YRange: -8164217.0 -3672516.8
!X.Window: 0.000000 1.00000
!Y.Window: 0.000000 1.00000
!P.Clip: 0 0 700 500
CATALYST Method: -1941017.8 -5100877.4 0.00000000
XRange: -2039019.3 3677734.5
YRange: -8164217.0 -3672516.8
!X.Window: 0.000000 1.00000
!Y.Window: 0.000000 1.00000
!P.Clip: 0 0 700 500
PLOT Method: -1941017.8 -5100877.4 0.00000000
Now, however, I issue a MAP_SET command before running the
Coord_Test program. Notice now my "catalyst" method is throwing
NANs.
IDL> MAP_SET, 90, -105, /STEREOGRAPHIC, /NOBORDER, $
POSITION=position, /NOERASE
IDL> Coord_Test
XRange: -2039019.3 3677734.5
YRange: -8164217.0 -3672516.8
!X.Window: 0.000000 1.00000
!Y.Window: 0.000000 1.00000
!P.Clip: 0 0 700 500
CATALYST Method: NaN NaN 0.00000000
XRange: -2039019.3 3677734.5
YRange: -8164217.0 -3672516.8
!X.Window: 0.000000 1.00000
!Y.Window: 0.000000 1.00000
!P.Clip: 0 0 700 500
PLOT Method: -1941017.8 -5100877.4 0.00000000
Can anyone think why a MAP_SET command would cause something like
this?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|