Option
1
You could do this the super-simple way - no code at
all, by using
http://www.n3kl.org/sun/images/status.gif?
and
http://www.n3kl.org/sun/images/kpstatus.gif?
or the code given at his
page http://www.n3kl.org/sun/status.html - however, this relies on his
server taking the load every time somebody "hits" your page.
Option 2
Use wget
in your cron file to fetch these images every 15
minutes or so. This lowers the workload on his server (well, it's
constant and a known hit rate) and will give
your site faster rendering. Example:
1,16,31,46
* * * * /usr/local/bin/wget --timeout=12
http://www.n3kl.org/sun/images/kpstatus.gif -q -O
$YOURDIR/sun/kpstatus.gif; /usr/local/bin/wget --timeout=12
http://www.n3kl.org/sun/images/status.gif -q -O $YOURDIR/sun/status.gif
[where $YOURDIR is the variable set to your chosen directory which was
set at the beginning
of your cron file]
Caution! Cron and command
syntax varies between *NIX versions - the above is from FreeBSD.
Option
3
Flare data latency added
Neutron detector processing added
RELEASED CODE! SolMon v1.3
Last Updated: 2012-12-04 14:29:25Z
The
Space Weather
Prediction Center provided solar data to WWV
& WWVH as an early "universal" way to broadcast the data to
anybody
with a shortwave receiver. With use of the internet to send a broader
data set, the spoken "WWV" messages will cease on 1st September, 2011.
So, will all those files referring to "wwv" in their name change to
"swpc"?
Update - No need to
worry, they asked for comments by 2011-06-30, yet
they relented under pressure before that date.
Read this (undated) "press
release"
on the matter. However, are they going to change the text file format?
It seems so, if they change the spoken data. Anybody providing code
which extracts the solar data from
this source needs to keep an eye on news from the SWPC on this matter. |
| NOTE: The Boulder
K-index is the real-time proxy for the
Planetary K (Kp) values that define the Geomagnetic Storm (G-scale) on
the
NOAA Space Weather Scales. Kp is not available in real time and is
usually delayed by approximately 30 minutes. To enable the fastest
possible alerts of Geomagnetic Storm activity, the Boulder K-index is
used as a substitute, 1 minute behind real time. Kp and the Boulder
K-index will generally show the same overall trend of activity.
However,
differences in the absolute magnitude of these indices can result in
differences in the G-level (or K-index) reached. These differences are
generally restricted to plus or minus one G or K-level, although larger
deviations are infrequently observed.
Through partnership with the US Geological Survey, SWPC is
working to eliminate the need for a Planetary K proxy by deriving an
estimated Planetary K in real time. Real-time derivation of the
Planetary K is anticipated by October
1, 2011. Products that currently
use the Boulder K as a proxy will be transitioned to Planetary K at
that
time. |
Use the
following code (and graphics) that's written here.
Place the following in your cron file:
*/15 *
* * * /usr/bin/fetch -q -A -T 10 -o $YOURDIR/sun/wwv.txt
'http://www.swpc.noaa.gov/ftpdir/latest/wwv.txt'; /usr/bin/fetch -q -A
-T 10 -o $YOURDIR/sun/dsd.txt
'http://www.swpc.noaa.gov/ftpdir/latest/DSD.txt'; /usr/bin/fetch
-q -A
-T 10 -o $YOURDIR/sun/xray.txt
'http://www.swpc.noaa.gov/ftpdir/lists/xray/Gp_xr_5m.txt'; /usr/bin/fetch
-q -A
-T 10 -o $YOURDIR/sun/particles.txt
'http://www.swpc.noaa.gov/ftpdir/lists/particle/Gp_part_5m.txt';
$PHP $YOURDIR/sun/wwv.php
> dev/null; $PHP $YOURDIR/sun/wwv_rss.php
> dev/null
[where
$YOURDIR is
the variable set to your chosen directory and $PHP is set to the path
of your install of PHP, which were set at the
beginning
of your cron file].
wwv.php and wwv_rss.php extract the data to make WWV figure text file
(for embedding in a web page) and to make an RSS feed. Right out of the
box.
Brief respite. Here are the graphic files you'll need for the Solar
Status system.
Note they contain lowercase and borders to
distinguish them from the N3KL graphics.
However, they are 121 x 21 pixels so that they can
directly replace existing N3KL page images.
| Level |
K-Index |
| 0-1 |
 |
| 2 |
 |
| 3 |
 |
| 4 |
 |
| 5 |
 |
| 6-9 |
 |
| Level
W/m2 |
X-Ray |
| I = -1 x 105 |
 |
| I < 10-9 |
 |
| 10-9
<= I < 10-8 |
 |
| 10-8
<= I < 10-7 |
 |
| 10-7
<= I < 10-6 |
 |
| 10-6
<= I < 10-5 |
 |
| 10-5
<= I < 10-4 |
 |
| 10-4
<= I < 10-3 |
 |
| 10-3<=
I |
 |
| Level
cm-2 s-1 sr-1 |
Proton |
| I = -1 x 105 |
 |
| I
< 1 |
 |
| 1 <= I
< 10 |
 |
| 10
<= I < 102 |
 |
| 102
<= I < 103 |
 |
| 103
<= I |
 |

Neutron monitor
| Level
cm-2 s-1 sr-1 |
Neutron |
| I = -1 x 105 |
 |
| I
< 1 |
 |
| 10
<= I < 102 |
 |
| 102
<= I < 103 |
 |
| 103
<= I |
 |
To
download all of the files at once, do the following in
Firefox:
Right click within this page. Select View Page Info. Select the
Media tab/button. Select all of the propagation image files and press
Save As. Save
them to a ./sun directory on your local machine.
"WWV/DSD" code:
Download this file wwv_php2.txt
and rename to wwv.php.
K-Index graphic-changing working correctly.
X-Ray logic and graphic-changing working correctly.
Data recovery and calculation for X-Ray flux working correctly (scaling
issues?).
RSS code:
Download this file wwv_rss2_php.txt
and
rename to
wwv_rss.php. This code requires the file latest_wwv.txt to
have been previously made by the running of wwv2.php (renamed to
wwv.php). The output file wwv_rss.xml
will be made. Insert the RSS graphic
into your web page and let it link to your new WWV feed. Also, if you want automatic feed
discovery to occur when browsers go to your page add the following in your HTML
<head> area:
<link href="http://[YOURDomain]/sun/wwv_rss.xml" rel="alternate"
type="application/rss+xml" title="WWV data">
FAQ
Q: Why do you record seconds in the logfile?
A: Because they're available - logs would be smaller without, but it
also keeps a record of how long the data retrieval and processing took.
Q: When was the first release of the code?
A: 1st July 2011.
Q: How can I use the logged data?
A: There are no limitations on the data gathered, you may use it for
plots.
Q: Are you looking for help?
A: Yes, if anybody has new ideas or improvements, they should contact
me.
Released
under GPLv3 Licence.