Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions G13_red_viol.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use lib '/home/mta/PERL';

#$infile="/data/mta4/space_weather/G11pchan";
$block="/data/mta4/www/Snapshot/.scs107alert";
$infile="/data/mta4/space_weather/G13returned";
$P2_lim=90.9; # 300/3.3 (P4GM)
$P5_lim=0.70; # 8.47/12 (P41GM)
Expand Down Expand Up @@ -47,12 +48,20 @@
if (!-s $p2r_lockfile) { # if an alert hasn't been sent, send one
if ($p2_wait == 5) {
open (OUT,">$p2r_lockfile") || print "Cannot open $p2r_lockfile\n";
print OUT "A Radiation violation of GOES 13 P2 (4-9 MeV) has occurred indicating a probable EPHIN P4GM trip.\n";
print OUT "Telecon now on 1-877-521-0441 111165#\n";
printf OUT " Value: %6.2f p/cm2-s-sr-MeV\n",$p2;
printf OUT " Limit: %6.2f \n", $P2_lim;
close OUT;
`cat $p2r_lockfile | mailx -s "GOES Alert Telecon now" sot_red_alert`;
if (-s $block) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bspitzbart - it looks like you started adding an entirely different patch, which is the SCS107 lockout. It's really much better if you do one functional change per pull request, particularly since the original was simple and didn't really require testing (vs. this update which will need to be tested). Maybe including this update was accidental?

print OUT "A Radiation violation of GOES 13 P2 (4-9 MeV) has occurred.\n";
printf OUT " Value: %6.2f p/cm2-s-sr-MeV\n",$p2;
printf OUT " Limit: %6.2f \n", $P2_lim;
close OUT;
`cat $p2r_lockfile | mailx -s "GOES Alert" sot_yellow_alert`;
} else {
print OUT "A Radiation violation of GOES 13 P2 (4-9 MeV) has occurred indicating a probable EPHIN P4GM trip.\n";
print OUT "Telecon now on 1-877-521-0441 111165#\n";
printf OUT " Value: %6.2f p/cm2-s-sr-MeV\n",$p2;
printf OUT " Limit: %6.2f \n", $P2_lim;
close OUT;
`cat $p2r_lockfile | mailx -s "GOES Alert Telecon now" sot_red_alert`;
}
#`cat $p2r_lockfile | mailx -s "GOES Alert" sot_red_alert`;
#`cat $p2r_lockfile | mailx -s "GOES Alert TEST" brad`;
} # if ($p2_wait == 5) {
Expand All @@ -68,12 +77,20 @@
if (!-s $p5r_lockfile) { # if an alert hasn't been sent, send one
if ($p5_wait == 5) {
open (OUT,">$p5r_lockfile");
print OUT "A Radiation violation of GOES 13 P5 (40-80 MeV) has occurred indicating a probable EPHIN P41GM trip.\n";
print OUT "Telecon now on 1-877-521-0441 111165#\n";
printf OUT " Value: %6.2f p/cm2-s-sr-MeV\n",$p5;
printf OUT " Limit: %6.2f \n", $P5_lim;
close OUT;
`cat $p5r_lockfile | mailx -s "GOES Alert Telecon now" sot_red_alert`;
if (-s $block) {
print OUT "A Radiation violation of GOES 13 P5 (40-80 MeV) has occurred.\n";
printf OUT " Value: %6.2f p/cm2-s-sr-MeV\n",$p5;
printf OUT " Limit: %6.2f \n", $P5_lim;
close OUT;
`cat $p5r_lockfile | mailx -s "GOES Alert" sot_yellow_alert`;
} else {
print OUT "A Radiation violation of GOES 13 P5 (40-80 MeV) has occurred indicating a probable EPHIN P41GM trip.\n";
print OUT "Telecon now on 1-877-521-0441 111165#\n";
printf OUT " Value: %6.2f p/cm2-s-sr-MeV\n",$p5;
printf OUT " Limit: %6.2f \n", $P5_lim;
close OUT;
`cat $p5r_lockfile | mailx -s "GOES Alert Telecon now" sot_red_alert`;
}
#`cat $p5r_lockfile | mailx -s "GOES Alert TEST" brad`;
} # if ($p5_wait == 5) {
} else { # if (!-s $lockfile) { # if an alert hasn't been sent, send one
Expand Down
11 changes: 7 additions & 4 deletions aceviolation_protonsP6.csh
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ set block = "/home/mta/Snap/.scs107alert"
endif

if (! -s $block) then
echo "This message sent to sot_red_alert" >> $lock
cat $lock | mailx -s ACE_p3_scaled sot_red_alert
#echo "This message sent to sot_yellow_alert" >> $lock

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commented out line is different from the original, which is confusing.

In general, now that you are using a version control system that makes it easy to track not only the code changes but also provide detailed commentary on the how and why, it's better to not leave old lines of code as comments. The github-workflow way to do this is to put a summary of the radiation working group decision into the pull request discussion (complete with links to the twiki page), along with a short (could be one or two line) summary of what was done in the code to effect the change.

#cat $lock | mailx -s ACE_p3_scaled sot_yellow_alert
cat $lock | mailx -s ACE_p3_scaled brad

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing in flight code should be hardwired to a specific person (brad in this case), since personnel can change. If you need to, it should be easy now to create a google group with a list of people that will get this alert.

endif
if ( -s $block) then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this an if else block? And since the if and else are now doing the same thing, it isn't even needed. Then you would just have the single line 45 which can be uncommented.

echo "This message sent to sot_yellow_alert" >> $lock
cat $lock | mailx -s ACE_p3_scaled sot_yellow_alert
#echo "This message sent to sot_yellow_alert" >> $lock
#cat $lock | mailx -s ACE_p3_scaled sot_yellow_alert
cat $lock | mailx -s ACE_p3_scaled brad
endif
#cat $lock | mailx -s ACE_p3_scaled brad

endif

Expand Down
4 changes: 2 additions & 2 deletions process_ace.nawk
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,14 @@ if (i > 0 && ie > 0){
#if (P130f > 360000000.) {
if (P5_P3f > 120000000.) {
val = sprintf("%.4e", P5_P3f) #P5
command = "/data/mta4/space_weather/aceviolation_protonsP5.csh " val
#command = "/data/mta4/space_weather/aceviolation_protonsP5.csh " val

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you have introduced a bug here by using the "comment out" technique. Two lines down it will still run system(command) with whatever happens to be defined for command. If you intend to remove the case of doing something if P5_P3f > 120000000, then just delete the entire code block. You do not want to have orphaned code running.

When you delete the code block(s) then put an informative commit message like "Deleted code that issues scaled p5 and p6 alerts". Then it is clearly in the history and if you ever need to see what that code was you can easily identify where to look.

#test command = "echo P5 viol " val
system (command)
} # if (P5_P3f > 120000000.) system (command)
} else { # trust P6
if (P6_P3f > 120000000.) {
val = sprintf("%.4e", P6_P3f) #P6
command = "/data/mta4/space_weather/aceviolation_protonsP6.csh " val
#command = "/data/mta4/space_weather/aceviolation_protonsP6.csh " val
#test command = "echo P6 viol " val
system (command)
} # if (P6_P3f > 120000000.) system (command)
Expand Down