Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Space Weather

Discussion of Ken True's web site templates

Moderator: saratogaWX

User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Space Weather

Post by gluepack »

Since NOAA updated their website earlier this month, my Space Weather page has not been displaying all the information that it used to. I am making an assumption here because I am not even sure if wxspace.php is a standard Saratoga template or whether I got the code from somewhere else but it uses a file spaceweather-current.txt which appears to be the culprit, due to NOAA's changes. Has anyone made the necessary mods to make this function properly again?


update: oops! obviously, as I just looked at http://saratoga-weather.org/space-weather.php and that looks fine. Sorry, I guess I should check for updates.

update: looks like there is an update from someone at http://www.weather-watch.com/smf/index. ... 6.195.html
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
uncle_bob
Posts: 505
Joined: Wed 17 Aug 2011 2:58 pm
Weather Station: WeatherDuino Pro2
Operating System: 2008
Location: Canberra

Re: Space Weather

Post by uncle_bob »

Hmm, I've downloaded the version 1.3 of space weather but it looks like most/all the hrefs are now wrong.
I do see some sites working, but they seem to be running version 1.4. Does anyone have this version? Do I need to track down the author to get a update?

Thanks in advance.
Interested in building your own Weather Station? Maybe check out the WeatherDuino Pro Project Here
Conder, Canberra Weather
Image
User avatar
PaulMy
Posts: 3777
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Space Weather

Post by PaulMy »

If this http://www.komokaweather.com/komokaweat ... xspace.php is what you are looking for I can check when at home this evening and likely send it. It looks like v1.4 as my View Source shows <!-- space weather - V 1.4 12-Dec-2014 -->

Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Space Weather

Post by saratogaWX »

Mike Challis (author of the page) still has the (non-working) version 1.3 posted on his site.

The weather-watch.com link to the 'fix' message was unfortunately lost when weather-watch.com suffered a major hard-disk failure and a failure in database backup (without notifications), so their forum was restored from an earlier image backup, and lots of stuff was lost in the shuffle.

The fix to the script was done by Martin (budgie) in December 2014 for V1.4 -- I've attached his update here.

Best regards,
Ken
You do not have the required permissions to view the files attached to this post.
uncle_bob
Posts: 505
Joined: Wed 17 Aug 2011 2:58 pm
Weather Station: WeatherDuino Pro2
Operating System: 2008
Location: Canberra

Re: Space Weather

Post by uncle_bob »

Thanks Paul, Ken and of course Budgie and Mike ;)
It's working! http://cond.power.on.net/wxspace.php

Cheers UB

Now to figure out the scaling so the graphs fit correctly.
Interested in building your own Weather Station? Maybe check out the WeatherDuino Pro Project Here
Conder, Canberra Weather
Image
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: Space Weather

Post by gluepack »

They just announced...
Space Weather Now Page Has Changed | NOAA / NWS Space ...
http://www.swpc.noaa.gov/SWN/
Space Weather Prediction Center. National Oceanic and Atmospheric Administration. Thursday, October 29, 2015 20:09:32. Main menu. Home; About Space

As part of the Space Weather Prediction Center's rollout of our improved website, the content from Space Weather Now is being provided in a new way.

Try the following page:

Space Weather Enthusiasts
http://www.swpc.noaa.gov/communities/sp ... nthusiasts

Pity they didn't do something "in a new way" (worth copying) with the three day forecast. If it was an RSS feed it would help (me) but I guess I have to dig around for some suitable code.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: Space Weather

Post by gluepack »

I've added some code to improve the display of text (slightly ;) )

Code: Select all

function main_code() {
	$textfrom = array('A. NOAA Geomagnetic Activity Observation and Forecast',
					  'B. NOAA Solar Radiation Activity Observation and Forecast',
					  'C. NOAA Radio Blackout Activity and Forecast');
	$textto = array('</p><h4>Geomagnetic Activity Observation and Forecast</h4><p>',
					  '</p><h4>Solar Radiation Activity Observation and Forecast</h4><p>',
					  '</p><h4>Radio Blackout Activity and Forecast</h4><p>');
  global $cacheName;

   if (!$data = file_get_contents("$cacheName") ) {
      $string = gracefulerror('Error reading spaceweather current update data.');
   return $string;}
   
   $string = $data;

  $string = str_replace($textfrom,$textto,$string);
  $string = preg_replace('|:Product|','Product',$string,1);
  $string = preg_replace('|:Issued|',' - Issued',$string,1);
  $string = preg_replace('|# P|',' - P',$string,1);
  $string = preg_replace('|#|',' ',$string,1);
  $string = preg_replace('|Center|','Center.',$string,1);
  $string = preg_replace('|NOAA Kp index|','</p><pre>NOAA Kp index',$string,1);
  $string = preg_replace('|Solar Radiation Storm Forecast|','</p><pre>Solar Radiation Storm Forecast',$string,1);
  $string = preg_replace('|Radio Blackout Forecast|','</p><pre>Radio Blackout Forecast',$string,1);
  $string = preg_replace('|Rationale:|','</pre><p>Rationale:',$string,3);
  $string = '<p>'.$string.'</p>';
 return $string;
Not much but it is better than having short sentences split across lines.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: Space Weather

Post by gluepack »

OK, now that I have resolved my nightmare PHP problem ;) , I have modified it even more. The text file seems to be pretty much the same format every time (I have emailed them asking them to make it a RSS feed).

Code: Select all

function main_code() {
	$textfrom = array('A. NOAA Geomagnetic Activity Observation and Forecast',
					  'B. NOAA Solar Radiation Activity Observation and Forecast',
					  'C. NOAA Radio Blackout Activity and Forecast');
	$textto = array('</p><h4 class="noaah4">Geomagnetic Activity Observation and Forecast</h4><p class="noaapar">',
					  '</p><h4 class="noaah4">Solar Radiation Activity Observation and Forecast</h4><p class="noaapar">',
					  '</p><h4 class="noaah4">Radio Blackout Activity and Forecast</h4><p class="noaapar">');
  global $cacheName;

   if (!$data = file_get_contents("$cacheName") ) {
      $string = gracefulerror('Error reading spaceweather current update data.');
   return $string;}
  
   $string = $data;
  $tablestyle = '<style media="screen"type="text/css">
				.noaah4 {margin-top: 10px;margin-bottom: 10px;}
				.noaapar {margin-top: 6px;margin-bottom: 12px;}
				.noaaparc {text-align:center;}
				.noaatab{margin-left:auto;margin-right:auto;width:400px;table-layout:fixed;border:1px solid black;border-collapse:collapse;empty-cells:hide;}
				.noaatab th{background-color:#188A23;color:white;padding-left:20px;text-align:left;border:none;}
				.noaatab td{padding-left:40px;border:1px solid black;}
				.noaatab td.first{padding-left:5px;}
				</style>';
  $string = str_replace($textfrom,$textto,$string);
  $string = preg_replace('|:Product|','Product',$string,1);
  $string = preg_replace('|:Issued|',' - Issued',$string,1);
  $string = preg_replace('|# P|','<br>P',$string,1);
  $string = preg_replace('|#|',' ',$string,1);
  $string = preg_replace('|Center|','Center.',$string,1);
  $string = preg_replace('|NOAA Kp index|','</p><pre>NOAA Kp index',$string,1);
  $string = preg_replace('|Solar Radiation Storm Forecast|','</p><pre>Solar Radiation Storm Forecast',$string,1);
  $string = preg_replace('|Radio Blackout Forecast|','</p><pre>Radio Blackout Forecast',$string,1);
  $string = preg_replace('|Rationale:|','</pre><p class="noaapar">Rationale:',$string,3);
  $string = $tablestyle.'<p class="noaapar noaaparc">'.$string.'</p>';
  
	for ($k=1;$k<=3;$k++) { 
		$start = '<pre>';
		$end = '</pre>';
		$startpos = strpos($string, $start) + strlen($start);
		if (strpos($string, $start) !== false) {
			$endpos = strpos($string, $end, $startpos);
			if (strpos($string, $end, $startpos) !== false) {
				
				$string = preg_replace('|<pre>.*?</pre>|s',dotable(substr($string, $startpos, $endpos - $startpos)),$string,1);		
				}
			}
		}
return $string;
}
function dotable($str2tab) {
$intable = explode("\n",$str2tab );
		$intablecount = count($intable) - 3;
		$strtable = '<table class="noaatab"><caption style="font-weight:bold;">'.$intable[0].'</caption>';
		$strheads = preg_split('/  +/',$intable[2]);
		$strtable .= '<tr><th>'.$strheads[0].'</th><th>'.$strheads[1].'</th><th>'.$strheads[2].'</th><th>'.$strheads[3].'</th></tr>';
		for ($j=3;$j<=$intablecount;$j++) {
			$strdata = preg_split('/  +/',$intable[$j]);
			$strtable .= '<tr><td class="first">'.$strdata[0].'</td><td>'.$strdata[1].'</td><td>'.$strdata[2].'</td><td>'.$strdata[3].'</td></tr>';
			}
		$strtable .= '</table>';
return $strtable;
}
It's probably overkill but it's a bit more pleasing to me than the bare text with short lines.

http://www.jerbils.info/saratoga/wxspace.php
Last edited by gluepack on Thu 05 Nov 2015 9:19 pm, edited 1 time in total.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: Space Weather

Post by gluepack »

Original and my formatted version...
geophys.jpg
You do not have the required permissions to view the files attached to this post.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Space Weather

Post by saratogaWX »

Very nice... looks much better :)
uncle_bob
Posts: 505
Joined: Wed 17 Aug 2011 2:58 pm
Weather Station: WeatherDuino Pro2
Operating System: 2008
Location: Canberra

Re: Space Weather

Post by uncle_bob »

saratogaWX wrote:Very nice... looks much better :)
I agree, nice job.
Interested in building your own Weather Station? Maybe check out the WeatherDuino Pro Project Here
Conder, Canberra Weather
Image
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: Space Weather

Post by gluepack »

oops! last column first table is incorrect (at least currently). I will investigate.

Update: Can't believe I missed that, getting old.
All tables, not just first. So obvious when you look at it...

Code: Select all

$strtable .= '<tr><td class="first">'.$strdata[0].'</td><td>'.$strdata[1].'</td><td>'.$strdata[2].'</td><td>'.$strdata[2].'</td></tr>';
Have corrected the above block of code.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Space Weather

Post by saratogaWX »

Thanks "gluepack"... I've updated http://saratoga-weather.org/space-weather.php with your formatting (with credit) :)
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: Space Weather

Post by gluepack »

Oh, you're welcome to do that but I have added row header color and commented it all...

Code: Select all

function main_code() {
// set up three typical header replacements to close off previous para, remove 'X. NOAA' text, surround with header tags and add next para tag 
	$textfrom = array('A. NOAA Geomagnetic Activity Observation and Forecast',
					  'B. NOAA Solar Radiation Activity Observation and Forecast',
					  'C. NOAA Radio Blackout Activity and Forecast');
	$textto = array('</p><h4 class="noaah4">Geomagnetic Activity Observation and Forecast</h4><p class="noaapar">',
					'</p><h4 class="noaah4">Solar Radiation Activity Observation and Forecast</h4><p class="noaapar">',
					'</p><h4 class="noaah4">Radio Blackout Activity and Forecast</h4><p class="noaapar">');
	global $cacheName;
// check file available, if not return error message
	if (!$data = file_get_contents("$cacheName") ) {
		$string = gracefulerror('Error reading spaceweather current update data.');
	return $string;}
// move text file content to $string variable  
	$string = $data;
// Set up basic CSS for table
// =====================================
// change (or remove for black) .noaatab th background-color:#188A23; to suit own heading background color 
//                          and .noaatab th color:white; to suit heading text color
// change (or remove for black) .noaatab td.first color:red; to suit data row descriptor text color
// all other changes at your discretion 
	$tablestyle = '<style media="screen"type="text/css">
				.noaah4 {margin-top: 10px;margin-bottom: 10px;}
				.noaapar {margin-top: 6px;margin-bottom: 12px;}
				.noaaparc {text-align:center;}
				.noaatab{margin-left:auto;margin-right:auto;width:400px;table-layout:fixed;border:1px solid black;border-collapse:collapse;empty-cells:hide;}
				.noaatab th{background-color:#188A23;color:white;padding-left:20px;text-align:left;border:none;}
				.noaatab td{font-weight:bold;padding-left:40px;border:1px solid black;}
				.noaatab td.first{padding-left:5px;color:red;}
				</style>';
// ======================================
// do header replacement			
	$string = str_replace($textfrom,$textto,$string);
// tidy up first para displaying source of text
	$string = preg_replace('|:Product|','Product',$string,1);
	$string = preg_replace('|:Issued|',' - Issued',$string,1);
	$string = preg_replace('|# P|','<br>P',$string,1);
	$string = preg_replace('|#|',' ',$string,1);
	$string = preg_replace('|Center|','Center.',$string,1);
// wrap tables in <pre> tags and start new paras for Rationale
	$string = preg_replace('|NOAA Kp index|','</p><pre>NOAA Kp index',$string,1);
	$string = preg_replace('|Solar Radiation Storm Forecast|','</p><pre>Solar Radiation Storm Forecast',$string,1);
	$string = preg_replace('|Radio Blackout Forecast|','</p><pre>Radio Blackout Forecast',$string,1);
	$string = preg_replace('|Rationale:|','</pre><p class="noaapar">Rationale:',$string,3);
// put para at start and end of formatted text and prefix with CSS
	$string = $tablestyle.'<p class="noaapar noaaparc">'.$string.'</p>';
// replace the three <pre> formatted tables with html formatted tables  
	for ($k=1;$k<=3;$k++) { 
		$start = '<pre>'; $end = '</pre>';
// extract string and send to formatting function
		$startpos = strpos($string, $start) + strlen($start);
		if (strpos($string, $start) !== false) {
			$endpos = strpos($string, $end, $startpos);
			if (strpos($string, $end, $startpos) !== false) {
				$string = preg_replace('|<pre>.*?</pre>|s',dotable(substr($string, $startpos, $endpos - $startpos)),$string,1);		
				}
			}
		}
return $string;
}
// function to convert pre formatted table to html formatted table
function dotable($str2tab) {
// seperate lines into array based on linefeed
	$intable = explode("\n",$str2tab );
// due to line feeds, some blank rows exist, table content is 3 rows fewer
	$intablecount = count($intable) - 3;
// first row is table caption 
	$strtable = '<table class="noaatab"><caption style="font-weight:bold;">'.$intable[0].'</caption>';
// second row blank, third is table headers, split into array based on 2+ blanks in between (1st header is null)
	$strheads = preg_split('/  +/',$intable[2]);
	$strtable .= '<tr><th>'.$strheads[0].'</th><th>'.$strheads[1].'</th><th>'.$strheads[2].'</th><th>'.$strheads[3].'</th></tr>';
// rest is table
	for ($j=3;$j<=$intablecount;$j++) {
// split into array based on 2+ blanks in between
		$strdata = preg_split('/  +/',$intable[$j]);
// format table data row 
		$strtable .= '<tr><td class="first">'.$strdata[0].'</td><td>'.$strdata[1].'</td><td>'.$strdata[2].'</td><td>'.$strdata[3].'</td></tr>';
		}
// close table and return it
	$strtable .= '</table>';
return $strtable;
}
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Space Weather

Post by saratogaWX »

I've used what gluepack did with an update to the wxspace.php Saratoga template add-on page.
This now uses your Saratoga CSS theme for styling and 'knows' about wide/narrow aspect.
Some of the links in the page were also changed as the target websites had changed.
Added credits at the bottom of the page.

You should be able to replace your existing wxspace.php with the attached. I'll also attach the full script set that has the Budgie, Ken and 'gluepack' mods incorporated.

Best regards,
Ken
You do not have the required permissions to view the files attached to this post.
Post Reply