Option
1
You could do this the super-simple way - no code at
all, by using https://spaceweather.ca/forecast-prevision/cond-en.php.
It's important to choose the english language portion. Example: https://spaceweather.ca/auto_generated_products/map-forecast_24-en.png
Option 2
Use wget
in your cron file to fetch these images every 15
minutes or so. This lowers the workload on the 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
UNRELEASED CODE! SolMon v0.01a
Last Updated: 2023-04-03 08:29:35Z
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 N3KL non-CA 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 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: not happened yet.
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.