Hi!
I'm trying to find the most efficient way of solving a seemingly simple problem, but I'm finding exceedingly complex.
So what I need to do
1.) build a list file links that are files that I'm recommending to users of my data
2.)plot a timeline of recommended files
The files are found in two base directories: /Volumes/Archives0 & /Volumes/Archives1 . Archives0 path contains data < 2008. Files are then stored in each base directory have the following path: $basedirectory.'/Data/SITE/TYPE/YYYY_MO/'. The file format is as such TYPE_SITE_YYYY_MO_MD_HH00.ruv , where
TYPE = RDL[i|m]
SITE = a list of four character strings
YYYY = four digit year
MO = two digit year
MD = two digit month day
HH = two digit hour
OK, so that's the structure that I'm dealing with. Now I have created arrays that depict when to use RDLi or RDLm -- i.e. when to change from RDLi to RDLm or vice versa (see code below, @changeTimes, @changeNames, @changeTypes).
I'd like to create links to radial files /Volumes/ArchivesΎ|1] that change with the @changeTimes, which corresponds to @changeNames and ultimately corresponds @changeTypes. I would like to create links for these files in /Volumes/Extras/RecommendedRadials/SITE/YYYY_MO
Any advice that you might have to do this in PERL would be great. Unfortunately I can't seem to get "sudo perl -MCPAN -e "install DBD::mysql"" to work so I can't use mysql which my might be good to keep all these files in instead of this /Volumes/Archives ... format.
Regardless, I need to get this done and have spun my wheels on this and am not feeling like I've got a good handle on it.
In regards to plotting a timeline of the recommended files -- i.e. a plot that show a tic mark for each file. Lets say if the above code was called radials.pl then calling it from the command line as "radials.pl --timeline <SITE> <START> <STOP>" would print a gnuplot of the available radials from that time. Maybe even another option to tar and zip the found files.
Ultimately I'd like to put all of this into a CGI that someone can navigate and perform these tasks interactively.
THANK YOU! Her's what I've written so far:
#!/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++;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.