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

Home » Public Forums » archive » Re: IDL/Dataminer/mySQL is working!!
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: IDL/Dataminer/mySQL is working!! [message #26380] Tue, 04 September 2001 01:31
Olaf Stetzer is currently offline  Olaf Stetzer
Messages: 39
Registered: September 2001
Member
Randall Skelton schrieb:
>
> On Mon, 3 Sep 2001, Olaf Stetzer wrote:
>
> [snip]
>> I _love_ open source software!!! :-)
> [snip]
>
> Here, here!
>

I am a Linux-addict since Kernel 0.94pl16!!!!! :-)

> [snip]
>> I still have to think of an elegant way to convert the struct
>> SQL-Timestamp into a variable which ca be used to be plotted against....

I just mixed together some code of different time-conversion functions I
found
in the icg-library. The result is:

function sqlts2js, sqlts

s =
sqlts.second+(sqlts.minute*60)+(sqlts.hour*3600d0)+sqlts.fra ction/1000d0

jd = 367*sqlts.year-7*(sqlts.year+(sqlts.month+9)/12)/4 $
-3*((sqlts.year+(sqlts.month-9)/7)/100+1)/4 $
+275*sqlts.month/9+sqlts.day+1721029

RETURN, s + (jd-2451545)*86400d0
end

What do you think of this one?

Olaf

--
Dr. Olaf Stetzer
Forschungszentrum Karlsruhe
Institut f�r Meterologie und Klimaforschung
Atmosph�rische Aerosole (IMK III) - http://imk-aida.fzk.de
Tel.: +49(0)7247-82-3249 (FAX: -4332)
Re: IDL/Dataminer/mySQL is working!! [message #26384 is a reply to message #26380] Mon, 03 September 2001 01:01 Go to previous message
Randall Skelton is currently offline  Randall Skelton
Messages: 169
Registered: October 2000
Senior Member
On Mon, 3 Sep 2001, Olaf Stetzer wrote:

[snip]
> I _love_ open source software!!! :-)
[snip]

Here, here!

[snip]
> I still have to think of an elegant way to convert the struct
> SQL-Timestamp into a variable which ca be used to be plotted against....

I have the same trouble working with time stamps from Postgres.
Depending on the code I'm working with, I either use a nifty 'time object'
or a simple date/time string and/or Julian seconds. I'd suggest looking
at the Johns Hopkins University-Applied Physics Laboratory Pages for their
notes on working with time series:

http://fermi.jhuapl.edu/s1r/idl/s1rlib/local_idl.html

http://fermi.jhuapl.edu/s1r/idl/s1rlib/time/time.html

Cheers,
Randall
Re: IDL/Dataminer/mySQL is working!! [message #26385 is a reply to message #26384] Mon, 03 September 2001 00:34 Go to previous message
Olaf Stetzer is currently offline  Olaf Stetzer
Messages: 39
Registered: September 2001
Member
Olaf Stetzer schrieb:
>
> For those of you who want to give this combination a try
> some hints:
>
> You have to install the myODBC-driver on the machine where
> you run IDL. I had problems with the recent version 2.50.38
> however the older version 2.50.37 is working for me.
> The maintainers of myODBC are aware of the problem, maybe
> there will be a workaround or bugfix in one of the next versions.

Update: There now is a bugfix available!!! The bug was confirmed
by the developers after I sent them a log of myODBC. Now there
is a bugfix introduced in the binary-packages (still ending .38).

I _love_ open source software!!! :-)

Someone asked me to show a bit of code I used to connect to
the database, so here it is (very dirty, maybe I convert it to
a nice reusable function soon):

-----------------------------------------
pro database_test
oDB = obj_new('IDLDBDatabase')
oDB->Connect, DataSource = 'PSC6', user='aida', password=''

strSQL='SELECT Zeitpunkt, Pabs, Tgk FROM aida_me�daten WHERE Zeitpunkt
BETWEEN "2001-07-06 14:45:00" AND "2001-07-06 15:05:00";'

oRS = obj_new('IDLDBRecordset',oDB,SQL=strSQL)

status = oRS->MoveCursor(/FIRST)

zeitfirst=oRS->GetField(0)
Zeit=replicate(zeitfirst,900)
Pabs=DBlarr(900)
Tgk=dblarr(900)

for i=0,899 do begin
IF(status NE 1) THEN BEGIN
PRINT, 'Error moving database cursor'
RETURN
ENDIF

Zeit(i)=oRS->GetField(0)
Pabs(i)=oRS->GetField(1)
Tgk(i)=oRS->GetField(2)
status = oRS->MoveCursor(/NEXT)
endfor

plot, Tgk, Pabs

OBJ_DESTROY, oRS
OBJ_DESTROY, oDB

end
------------------------------------------------

So the Dataminer are mainly the two objects IDLDBDatabase and
IDLDBRecordset. The first is used to establish a connection
via ODBC, the second is used to access the data either of a complete
table within the DB or to a subset which is returned after submitting
a SQL-query (like I did in my example).

I still have to think of an elegant way to convert the struct
SQL-Timestamp
into a variable which ca be used to be plotted against....

Greetings,

Olaf

--
Dr. Olaf Stetzer
Forschungszentrum Karlsruhe
Institut f�r Meterologie und Klimaforschung
Atmosph�rische Aerosole (IMK III) - http://imk-aida.fzk.de
Tel.: +49(0)7247-82-3249 (FAX: -4332)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Could i find some examples for IDL DataMiner ...?
Next Topic: Call_external

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

Current Time: Wed Oct 08 15:39:46 PDT 2025

Total time taken to generate the page: 0.00559 seconds