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.
Note: many of the links on the N3KL 'status.html' page are
broken and return 'This site can’t be reached' errors because they
still point to sec.noaa.gov.
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. Examples:
FreeBSD version
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
Linux
version
1,16,31,46
* * * * /usr/bin/wget --timeout=12
'http://www.n3kl.org/sun/images/kpstatus.gif' -q -O
$YOURDIR/sun/kpstatus.gif; /usr/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 vary between *NIX versions. Generally these are command
locations and options. Check 'man' or search the internet.
Option
3
A significant rewrite of code has been made to account for data
location and format changes at https://www.swpc.noaa.gov/
Flare data latency added
Neutron detector processing added
RELEASED CODE! SolMon v1.4rc1
Last Updated: 2021-02-09 10:59:53Z
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 still somewhat under test.
Products that currently
use the Boulder K as a proxy will be transitioned to Planetary K at
some future
time. |
Use the
following code (and graphics) that's written here.
Place the following in your cron file:
*/15 *
* * * /usr/bin/wget
--timeout=15 'ftp://ftp.swpc.noaa.gov/pub/latest/wwv.txt' -q -O
/home/$YOURDIR/public_html/sun/wwv.txt;/usr/bin/wget --timeout=15
'ftp://ftp.swpc.noaa.gov/pub/latest/DSD.txt' -q -O /home/$YOURDIR/public_html/sun/dsd.txt;/usr/bin/wget
--timeout=15
'https://services.swpc.noaa.gov/json/goes/primary/xrays-6-hour.json' -q
-O /home/$YOURDIR/public_html/sun/xray.txt;/usr/bin/wget
--timeout=15
'https://services.swpc.noaa.gov/json/goes/primary/integral-protons-6-hour.json'
-q -O /home/$YOURDIR/public_html/sun/particles.txt;/usr/bin/wget
--timeout=15 'http://www.bartol.udel.edu/~takao/neutronm/glealarm/' -q
-O /home/$YOURDIR/public_html/sun/neutrons.txt;
/usr/local/bin/ea-php72 -q /home/$YOURDIR/public_html/sun/wwv.php
> /dev/null; /usr/local/bin/ea-php72 -q /home/$YOURDIR/public_html/sun/wwv_rss.php
> /dev/null
[where
$YOURDIR is your chosen
directory and the path
of your install of PHP is carefully checked (in this case PHP v7.2 is being forced on a shared hosting
platform)].
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 |
A-Index |
0-7 |
|
8-15 |
|
16-29 |
|
30-49 |
|
50-99 |
|
>99 |
|
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 wwv2_php.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 (are
there scaling
issues from data extracted from a json file?).
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 public 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.