Tuesday, October 07, 2008

perl links.

command line options for perl:
http://perldoc.perl.org/perlrun.html
http://www.perl.com/pub/a/2004/08/09/commandline.html?page=2

install my own perl module:
http://servers.digitaldaze.com/extensions/perl/modules.html

how to convert the UT time to MJD
http://coding.derkeiler.com/Archive/Perl/comp.lang.perl.misc/2008-02/msg00699.html

the package for the conversion between MJD and UT
http://search.cpan.org/~cphil/Astro-0.69/

I have written one script which convert the MJD into UT time using the module above:

---------------------------------------------------------------------------------------
#!/usr/bin/perl -w

#### input file: (1) mjd.txt which contains all the mjd dates. please make sure the file existing
#### in the working direcotory before the run.
#### output: the converted mjd numbers.

#### usage: ./mjd_conv.pl


use lib qw(/data/lgou/perl/module/lib/perl5/site_perl /data/lgou/perl/module/lib/perl5/);
use Astro::Time;


my ($day, $month, $dayno, $year, $ut, $mjd);


$inputfile=$ARGV[0];

@mjd_array=`cat $inputfile`;

for $mjd (@mjd_array){


($day, $month, $year, $ut) = mjd2cal($mjd);
printf("mjd2cal: MJD %.5f ==> $year/%02d/%02d (%s)\n", $mjd,
$month, $day, turn2str($ut, 'H', 0));

}

No comments: