dpath2o has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/ActivePerl-5.10/bin/perl # #all things radials # # GPL, copyright 2008 use strict; use Getopt::Long; use Date::Calc qw(:all); #build the variables my $startdate = Mktime(2006,1,1,0,0,0); my %archiveDirs = ( "2007","/Volumes/Archives0", "2008","/Volumes/Archives1" ); my @mntySites = qw( pesc bigc scrz mlml mlng npgs ppin gcyn psur psl +r ); my @mntyTypes = qw( i i m i m m m i m +i ); my $recommedDir = qw( /Volumes/Extras/RecommendedRadials ); my @commaTimes = qw( 2006,02,03,19,00,00 2006,03,03,09,00,00 2006,04,14,22,00,00 2006,07,07,22,00,00 2006,07,20,19,00,00 2006,08,10,20,00,00 2006,10,17,21,00,00 2006,11,06,23,00,00 2006,11,27,20,00,00 2006,12,18,21,00,00 2007,03,19,20,00,00 2007,05,09,20,00,00 2007,08,04,19,00,00 2007,08,06,16,00,00 2007,09,09,08,00,00 ); my @changeTimes; foreach my $l1 (@commaTimes) { my @tmp = split(/\,/,$l1); my $tmpT = M +ktime(@tmp); push(@changeTimes,$tmpT); } my @changeNames = qw( SCRZ PPIN NPGS PPIN NPGS MLNG MLNG NPGS NPGS MLML SCRZ PSUR RAGG PSUR PSUR ); my @changeTypes = qw( i i i m m i m i m m m i m m i ); my $cnt=0; print "%Table of radials going from measured to ideal or vice versa\n" +; print "%Table used to build recommended radial links in $recommedDir\n +"; print "%Table start date (epoch seconds): $startdate\n"; print "%Prior to $startdate then the recommend radial table is as foll +ows\n"; foreach my $l1 (@mntySites) { print "%\t$l1\tmeasured\n" if ($mntyTypes[$cnt] =~ m/m/) ; print "%\t$l1\tideal\n" if ($mntyTypes[$cnt] =~ m/i/) ; $cnt++; } $cnt=0; print "%NOTE: radial site may or may not exist prior to $startdate\n"; print "%\tTry using radial.pl --timeline <SITE> <START> <STOP>\n%%%\n" +; print "%TABLE:\tEpoch Time\tSite\tType\n"; foreach my $l1 (@changeTimes) { print "\t$l1\t$changeNames[$cnt]\tmeasured\n" if ($changeTypes[$cn +t] =~ m/m/); print "\t$l1\t$changeNames[$cnt]\tideal\n" if ($changeTypes[$cnt] +=~ m/i/); $cnt++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Create Links dependent upon conditions and plotting a timeline
by wjw (Priest) on May 13, 2009 at 00:47 UTC |