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

Home » Public Forums » archive » Re: Save 2D conversion matrix
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: Save 2D conversion matrix [message #46152] Mon, 07 November 2005 12:19 Go to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
David Fanning wrote:

> Peter Albert writes:
>
>> I am currently working on the display of climate datasets. One window
>> shows a map with e.g. some monthly mean values. My plan now is to let
>> the user pick a location using CURSOR, and then to display a time
>> series at the chosen point in a second window. O.k., I can get the
>> latitude / longitude of the chosen point using CONVERT_COORD, then I
>> can pick the appropriate time series and plot it in the second window.
>> However, if I am now going back to the map window, the correlation
>> between device and data coordinates is of course gone. If it was 3D
>> data, I would use T3D, but this is plain 2D data and don't see the
>> appropriate feature in the documentation. Any help which would save me
>> from re-drawing this map over and over again would be appreciated.
>>
>> N.b. this is all done using direct graphics. Is this finally the reason
>> to go ahead and read the manual about OO graphics?
>
> Object graphics is certainly overkill, but I would suggest
> you learn a little widget programming (seriously, the CURSOR
> command!? Sigh...).
>
> Benjamin's suggestion to save and restore the system variables
> is a good one, but it has always struck me as inelegant. Which
> variables, after all, did you really need to restore the
> coordinate system? It surely couldn't be ALL of them!
>
> So I spent a couple of days experimenting until I found out which
> ones I needed. (I was actually trying to find out which ones
> had to be set so I could establish a data coordinate system without
> going to the trouble of actually drawing a plot.) It turns out
> that these four pieces of information are needed to establish
> the data coordinate system: !X.S, !Y.S, !X.Window, and !Y.Window.
> Plus, the current window has to be the one your plot is in. (Not
> a given, always, in widget programming unless you explicitly
> make it so.)
>
> I found out that I could easily establish a data coordinate
> system for *any* window if I knew the X and Y range of the
> coordinate system and the location of the coordinate system
> in the window (i.e., its position). (I simply constructed the
> scaling parameters normally found in !X.S and !Y.S from the
> range and position.)
>
> So, even if you still save *everything*, it feels good
> to know what it is in that mess you really need. :-)
>
> Cheers,
>
> David
>

Hi David,

sometimes we would need !x.type of value 3 too. e.g. if we want to use
Map_Continents again. And probably we would need some more from !map,
from !p the transformation matrices and so on.

cheers
Reimar
Re: Save 2D conversion matrix [message #46157 is a reply to message #46152] Mon, 07 November 2005 10:44 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paolo Grigis writes:


> In order to achieve the same purpose (that is, setting a coordinate
> system in a fresh window), I was using this kind of statements:
>
> plot,[0,0],xrange=[3,5],yrange=[7,9],xstyle=8+4+1,ystyle=8+4 +1,xmargin=[0,0],ymargin=[0,0],/nodata
>
> I don't know if I should feel ashamed for not using the elegant
> way with !XY.S & !XY.Window or proud for having found a viable
> solution to the problem in a few minutes instead of "a couple of
> days experimenting" ;-)

Yeah, that's what I used to do, too. But when you don't
really have a life outside of IDL, this is the kind of
thing you get obsessed about. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Save 2D conversion matrix [message #46158 is a reply to message #46157] Mon, 07 November 2005 10:02 Go to previous messageGo to next message
Paolo Grigis is currently offline  Paolo Grigis
Messages: 171
Registered: December 2003
Senior Member
David Fanning wrote:
> Peter Albert writes:
>
>
>> I am currently working on the display of climate datasets. One window
>> shows a map with e.g. some monthly mean values. My plan now is to let
>> the user pick a location using CURSOR, and then to display a time
>> series at the chosen point in a second window. O.k., I can get the
>> latitude / longitude of the chosen point using CONVERT_COORD, then I
>> can pick the appropriate time series and plot it in the second window.
>> However, if I am now going back to the map window, the correlation
>> between device and data coordinates is of course gone. If it was 3D
>> data, I would use T3D, but this is plain 2D data and don't see the
>> appropriate feature in the documentation. Any help which would save me
>> from re-drawing this map over and over again would be appreciated.
>>
>> N.b. this is all done using direct graphics. Is this finally the reason
>> to go ahead and read the manual about OO graphics?
>
>
> Object graphics is certainly overkill, but I would suggest
> you learn a little widget programming (seriously, the CURSOR
> command!? Sigh...).
>
> Benjamin's suggestion to save and restore the system variables
> is a good one, but it has always struck me as inelegant. Which
> variables, after all, did you really need to restore the
> coordinate system? It surely couldn't be ALL of them!
>
> So I spent a couple of days experimenting until I found out which
> ones I needed. (I was actually trying to find out which ones
> had to be set so I could establish a data coordinate system without
> going to the trouble of actually drawing a plot.) It turns out
> that these four pieces of information are needed to establish
> the data coordinate system: !X.S, !Y.S, !X.Window, and !Y.Window.
> Plus, the current window has to be the one your plot is in. (Not
> a given, always, in widget programming unless you explicitly
> make it so.)
>
> I found out that I could easily establish a data coordinate
> system for *any* window if I knew the X and Y range of the
> coordinate system and the location of the coordinate system
> in the window (i.e., its position). (I simply constructed the
> scaling parameters normally found in !X.S and !Y.S from the
> range and position.)
In order to achieve the same purpose (that is, setting a coordinate
system in a fresh window), I was using this kind of statements:

plot,[0,0],xrange=[3,5],yrange=[7,9],xstyle=8+4+1,ystyle=8+4 +1,xmargin=[0,0],ymargin=[0,0],/nodata

I don't know if I should feel ashamed for not using the elegant
way with !XY.S & !XY.Window or proud for having found a viable
solution to the problem in a few minutes instead of "a couple of
days experimenting" ;-)

Ciao,
Paolo


>
> So, even if you still save *everything*, it feels good
> to know what it is in that mess you really need. :-)
>
> Cheers,
>
> David
>
Re: Save 2D conversion matrix [message #46160 is a reply to message #46158] Mon, 07 November 2005 08:25 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Peter Albert writes:

> I am currently working on the display of climate datasets. One window
> shows a map with e.g. some monthly mean values. My plan now is to let
> the user pick a location using CURSOR, and then to display a time
> series at the chosen point in a second window. O.k., I can get the
> latitude / longitude of the chosen point using CONVERT_COORD, then I
> can pick the appropriate time series and plot it in the second window.
> However, if I am now going back to the map window, the correlation
> between device and data coordinates is of course gone. If it was 3D
> data, I would use T3D, but this is plain 2D data and don't see the
> appropriate feature in the documentation. Any help which would save me
> from re-drawing this map over and over again would be appreciated.
>
> N.b. this is all done using direct graphics. Is this finally the reason
> to go ahead and read the manual about OO graphics?

Object graphics is certainly overkill, but I would suggest
you learn a little widget programming (seriously, the CURSOR
command!? Sigh...).

Benjamin's suggestion to save and restore the system variables
is a good one, but it has always struck me as inelegant. Which
variables, after all, did you really need to restore the
coordinate system? It surely couldn't be ALL of them!

So I spent a couple of days experimenting until I found out which
ones I needed. (I was actually trying to find out which ones
had to be set so I could establish a data coordinate system without
going to the trouble of actually drawing a plot.) It turns out
that these four pieces of information are needed to establish
the data coordinate system: !X.S, !Y.S, !X.Window, and !Y.Window.
Plus, the current window has to be the one your plot is in. (Not
a given, always, in widget programming unless you explicitly
make it so.)

I found out that I could easily establish a data coordinate
system for *any* window if I knew the X and Y range of the
coordinate system and the location of the coordinate system
in the window (i.e., its position). (I simply constructed the
scaling parameters normally found in !X.S and !Y.S from the
range and position.)

So, even if you still save *everything*, it feels good
to know what it is in that mess you really need. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Save 2D conversion matrix [message #46161 is a reply to message #46160] Mon, 07 November 2005 08:04 Go to previous messageGo to next message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
Peter Albert wrote:
> Hi all,
>
> I am currently working on the display of climate datasets. One window
> shows a map with e.g. some monthly mean values. My plan now is to let
> the user pick a location using CURSOR, and then to display a time
> series at the chosen point in a second window. O.k., I can get the
> latitude / longitude of the chosen point using CONVERT_COORD, then I
> can pick the appropriate time series and plot it in the second window.
> However, if I am now going back to the map window, the correlation
> between device and data coordinates is of course gone. If it was 3D
> data, I would use T3D, but this is plain 2D data and don't see the
> appropriate feature in the documentation. Any help which would save me
> from re-drawing this map over and over again would be appreciated.
>
> N.b. this is all done using direct graphics. Is this finally the reason
> to go ahead and read the manual about OO graphics?
>
> Cheers,
>
> Peter
>

Hi Peter,
I don't know if this is the reason to read about Object Grpahics, I
haven't almost anithing knowledge about Direct Graphics but for the kind
of applications I am developing in IDL, the Object Grpahics is perfect.

Bye.

--
-----------------------------------------------------
Antonio Santiago P�rez
( email: santiago<<at>>grahi.upc.edu )
( www: http://www.grahi.upc.edu/santiago )
( www: http://asantiago.blogsite.org )
-----------------------------------------------------
Grup de Recerca Aplicada en Hidrometeorologia (GRAHI)
Universitat Polit�cnica de Catalunya
Barcelona - SPAIN
-----------------------------------------------------
http://www.grahi.upc.edu
-----------------------------------------------------
Re: Save 2D conversion matrix [message #46162 is a reply to message #46161] Mon, 07 November 2005 07:38 Go to previous messageGo to next message
Benjamin Hornberger is currently offline  Benjamin Hornberger
Messages: 258
Registered: March 2004
Senior Member
Peter Albert wrote:
> Hi all,
>
> I am currently working on the display of climate datasets. One window
> shows a map with e.g. some monthly mean values. My plan now is to let
> the user pick a location using CURSOR, and then to display a time
> series at the chosen point in a second window. O.k., I can get the
> latitude / longitude of the chosen point using CONVERT_COORD, then I
> can pick the appropriate time series and plot it in the second window.
> However, if I am now going back to the map window, the correlation
> between device and data coordinates is of course gone. If it was 3D
> data, I would use T3D, but this is plain 2D data and don't see the
> appropriate feature in the documentation. Any help which would save me
> from re-drawing this map over and over again would be appreciated.
>
> N.b. this is all done using direct graphics. Is this finally the reason
> to go ahead and read the manual about OO graphics?
>
> Cheers,
>
> Peter
>


I use the routines savesysvar.pro and restsysvar.pro from the FZ Juelich
library
( http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html) to
save the corresponding system variables. Right after plotting, do
savesysvar, right before calling convert_coord do restsysvar.

Benjamin
Re: Save 2D conversion matrix [message #46238 is a reply to message #46152] Mon, 07 November 2005 23:24 Go to previous message
peter.albert@gmx.de is currently offline  peter.albert@gmx.de
Messages: 108
Registered: July 2005
Senior Member
Hi Reimar,

thanks a lot, thatÄs just the missing bit!

Cheers,

Peter
Re: Save 2D conversion matrix [message #46239 is a reply to message #46158] Mon, 07 November 2005 23:23 Go to previous message
peter.albert@gmx.de is currently offline  peter.albert@gmx.de
Messages: 108
Registered: July 2005
Senior Member
Hi Paolo,

I wasn't probably clear enough when describing the problem. I am not
displaying two x/y plots but one map and one plot. Anyway, with David's
and Reimar's hint to the correct system variables, it works just fine.

Thanks anyway,

Peter
Re: Save 2D conversion matrix [message #46240 is a reply to message #46162] Mon, 07 November 2005 23:21 Go to previous message
peter.albert@gmx.de is currently offline  peter.albert@gmx.de
Messages: 108
Registered: July 2005
Senior Member
Hi Benjamin,

thanks a lot. Yet another very useful routine...

Cheers,

Peter
Re: Save 2D conversion matrix [message #46241 is a reply to message #46160] Mon, 07 November 2005 23:20 Go to previous message
peter.albert@gmx.de is currently offline  peter.albert@gmx.de
Messages: 108
Registered: July 2005
Senior Member
Hi David,

thanks a lot, that (and Reimars !x.type) was exactly what I needed!

> Object graphics is certainly overkill, but I would suggest
> you learn a little widget programming (seriously, the CURSOR
> command!? Sigh...).

Aehmm, well, this *is* part of a widget ... But now that you mention
it, TRACKING_EVENTS of a draw widget might also work ... But that would
mean that I have to drop the WIDGET_TIMER events now that I finally
managed to use them ... :-)

But still the original problem is the same, and I much appreciate the
given help!

Cheers,

Peter
Re: Save 2D conversion matrix [message #46245 is a reply to message #46152] Mon, 07 November 2005 18:48 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Reimar Bauer writes:

> sometimes we would need !x.type of value 3 too. e.g. if we want to use
> Map_Continents again. And probably we would need some more from !map,
> from !p the transformation matrices and so on.

Oh, well, sure. But I didn't know we were talking about mapping
continents. I thought we were talking about standard XY line plots. :-)

Cheers,

David

P.S. Maybe some day I'll give my lecture on log plots. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Converting Doubles to Strings
Next Topic: writing ascii-file with separator

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

Current Time: Wed Oct 08 15:27:05 PDT 2025

Total time taken to generate the page: 0.00507 seconds