ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/JSOC/proj/lev0/scripts/lev0a2deflev1_FULL_PZT_FSN_cron.pl
Revision: 1.3
Committed: Mon Jan 12 19:42:37 2015 UTC (8 years, 8 months ago) by jsoc
Content type: text/plain
Branch: MAIN
CVS Tags: Ver_9-1, Ver_LATEST, Ver_9-3, Ver_9-41, Ver_9-2, Ver_8-8, Ver_8-7, Ver_9-5, Ver_9-4, Ver_8-10, Ver_8-11, Ver_8-12, Ver_9-0, HEAD
Changes since 1.2: +12 -4 lines
Log Message:
Commit stuff people edited.

File Contents

# Content
1 #!/usr/bin/perl
2 #lev0a2deflev1_FULL_PZT_FSN_cron.pl
3 #
4 #This is a cron job run by cl1n001 after the start of a new UT day.
5 #For example, after 2010.10.26_17:00:00 PDT is UTC day 2010.300_UTC.
6 #It will call lev0a2deflev1_FULL_PZT_FSN.pl with the date equal n-4 from
7 #the new current date, e.g. after 2010.10.26_17:00:00 PDT, the call
8 #will be:
9 # lev0a2deflev1_FULL_PZT_FSN.pl hmi 2010.296_UC
10 #
11 #See lev0a2deflev1_FULL_PZT_FSN.pl for the details of what's run.
12 #NOTE: the lev0a tag is really a misnomer for aia. It uses aia.lev0.
13
14 sub usage {
15 print "Make definitive lev1 from lev0a data\n";
16 print "Called as a cron job on cl1n001 to make the n-4 day of new data.\n";
17 print "Usage: lev0a2deflev1_FULL_PZT_FSN_cron.pl hmi\n";
18 print " args: instrument\n";
19 exit(0);
20 }
21
22 $PID = getppid;
23 $host = `hostname -s`;
24 chomp($host);
25 print "host = $host\n";
26 #cl1n001 is a linux_x86_64
27
28 if ($host !~ 'cl1n001|solar3') {
29 print "Error: This must be run on cl1n001 or solar3\n";
30 exit;
31 }
32
33 if ($host =~ 'cl1n001') {
34 $ENV{'JSOC_MACHINE'} = "linux_x86_64";
35 $JSOC_MACHINE = linux_x86_64;
36 } else {
37 $ENV{'JSOC_MACHINE'} = "linux_avx";
38 $JSOC_MACHINE = "linux_avx";
39 }
40
41 $ENV{'PATH'} = "/home/jsoc/cvs/Development/JSOC/bin/$JSOC_MACHINE:/home/jsoc/cvs/Development/JSOC/scripts:/bin:/usr/bin:/SGE/bin/lx24-amd64:";
42
43 $ENV{'SGE_ROOT'} = "/SGE";
44 $sgeroot = $ENV{'SGE_ROOT'};
45 #print "SGE_ROOT = $sgeroot\n";
46 $path = $ENV{'PATH'};
47 #print "path = $path\n"; #!!!TEMP
48 $mach = $ENV{'JSOC_MACHINE'};
49 #print "JSOC_MACHINE = $mach\n"; #!!!TEMP
50
51 $date = &get_date;
52 print "Start lev0a2deflev1_FULL_PZT_FSN_cron.pl on $date\n";
53 if($#ARGV != 0) { &usage; }
54 $instru = $ARGV[0];
55 if($instru ne "hmi" && $instru ne "aia") {
56 print "Error: The only accepted instru are 'hmi' or 'aia'\n";
57 exit;
58 }
59 $sec = `time_convert time=$date`;
60 #$sec = $sec - 172800; #n-2 days
61 $sec = $sec - 345600; #n-4 days
62 $ord_date = `time_convert s=$sec o=ord`;
63 print "$ord_date\n";
64
65 #New 16Feb2011 First do a pzt flat
66 if($instru eq "hmi") {
67 `/home/jsoc/cvs/Development/JSOC/proj/lev0/scripts/pzt_flat_cron.pl`;
68 }
69
70 #Now make the def lev1 for our given date
71 #Also make the higher order products by calling Phil's workflow.
72 $cmd = "lev0a2deflev1_FULL_PZT_FSN.pl $instru $ord_date";
73 print "$cmd\n";
74 #`$cmd`;
75 system($cmd);
76
77 print "**Complete lev0a2deflev1_FULL_PZT_FSN_cron.pl $instru for $ord_date\n";
78
79 #Return current _UTC time
80 sub get_date {
81 local($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst,$date,$sec2,$min2,$hour2,$mday2);
82 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);
83 #($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
84 $sec2 = sprintf("%02d", $sec);
85 $min2 = sprintf("%02d", $min);
86 $hour2 = sprintf("%02d", $hour);
87 $mday2 = sprintf("%02d", $mday);
88 $mon2 = sprintf("%02d", $mon+1);
89 $year4 = sprintf("%04d", $year+1900);
90 $date = $year4.".".$mon2.".".$mday2._.$hour2.":".$min2.":".$sec2."_UTC";
91 return($date);
92 }
93