Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

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

Legacy Cumulus 1 release 1.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

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

NOAA RSS Feeds

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
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

NOAA RSS Feeds

Post by gluepack »

I don't think that this has anything to do with the other NOAA reports thread, correct me if I am wrong.

I added a section on tropical cyclones a little while back (not that we experience many in Bulgaria but I wanted to pad the site out a bit).

To pad it out even more, I thought I would incorporate relevant RSS feeds from NOAA.

Whoa! (Virtually) fully upper case and <pre> code. Frankly it is crap.

I am sure that they have a good reason for doing it in that format but isn't there some other more suitable format?

I have tidied it up a lot (at least, to fit to my page width, as opposed to 1/2 a page) but, the most annoying thing for me is that it is still in upper case. I have looked at several upper>title case javascript conversions and tried a couple but neither of those did a good job (anything all caps remains; so small words like as,is,an,the,etc. get changed but the more relevant words don't and if a sentence begins with "an", for example, it has a lower case initial letter). So, I have abandoned those.

Anyway, they are title case and I want sentence case. I did come across one or two online conversions and reference to a PHP solution but it only provided components of the code not the full thing. Also, it was based on pspell and I understand that has been deprecated in favor of enchant.

If you're interested, you can see what I have done so far at http://www.jerbils.info/saratoga/wxhurricanesNA.php (below the wunderground map (I use them for W. Pacific & Indian Ocean feeds because NOAA doesn't provide)).

So, if I am in fact using feeds intended for some other purpose and there are better ones out there, please let me know. Alternatively, if anyone knows of an intelligent (e.g. with user modifiable dictionary) drop-in solution for converting upper case text to sentence case, please let me know.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
BigOkie
Posts: 283
Joined: Tue 28 May 2013 1:06 am
Weather Station: Davis VP2 Plus
Operating System: Raspian Bookworm (RPi 3b)
Location: Tulsa, OK

Re: NOAA RSS Feeds

Post by BigOkie »

gluepack wrote:I don't think that this has anything to do with the other NOAA reports thread, correct me if I am wrong.

I added a section on tropical cyclones a little while back (not that we experience many in Bulgaria but I wanted to pad the site out a bit).

To pad it out even more, I thought I would incorporate relevant RSS feeds from NOAA.

Whoa! (Virtually) fully upper case and <pre> code. Frankly it is crap.

I am sure that they have a good reason for doing it in that format but isn't there some other more suitable format?

I have tidied it up a lot (at least, to fit to my page width, as opposed to 1/2 a page) but, the most annoying thing for me is that it is still in upper case. I have looked at several upper>title case javascript conversions and tried a couple but neither of those did a good job (anything all caps remains; so small words like as,is,an,the,etc. get changed but the more relevant words don't and if a sentence begins with "an", for example, it has a lower case initial letter). So, I have abandoned those.

Anyway, they are title case and I want sentence case. I did come across one or two online conversions and reference to a PHP solution but it only provided components of the code not the full thing. Also, it was based on pspell and I understand that has been deprecated in favor of enchant.

If you're interested, you can see what I have done so far at http://www.jerbils.info/saratoga/wxhurricanesNA.php (below the wunderground map (I use them for W. Pacific & Indian Ocean feeds because NOAA doesn't provide)).

So, if I am in fact using feeds intended for some other purpose and there are better ones out there, please let me know. Alternatively, if anyone knows of an intelligent (e.g. with user modifiable dictionary) drop-in solution for converting upper case text to sentence case, please let me know.
The way I heard it from a friend at NOAA/NWS, the uppercasing is done because using a mix on their systems can create 'standardization' issues because the search engine itself is case sensitive. In other words, one forecaster uses a mix of upper and lower case, one doesn't and one does it in a way that the other two can't see. Many softwares in the weather systems tailor themselves to using string matching. Many of those are case sensitive. So the decision was made to keep the reporting in a consistent format.

Also, NWS uses standardized abbreviations for certain words to shorten up the data stream. It was decided to keep all comms in the stream uppercase, akin to the old teletype days.
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: NOAA RSS Feeds

Post by gluepack »

Well, that is interesting because if you look at part of my (current) output....
Summary for Tropical Storm ERIN (AT5/AL052013)

~ ERIN MOVING NORTHWESTWARD AS A MINIMAL TROPICAL STORM ~ As of 5:00 PM AST Sat Aug 17 the center of ERIN was located near 21.0, -37.0 with movement NW at 13 mph.

The minimum central pressure was 1006 mb with maximum sustained winds of about 40 mph.

Tropical Storm ERIN Public Advisory Number 12

Issued at 500 PM AST SAT AUG 17 2013
000 WTNT35 KNHC 172030 TCPAT5 BULLETIN TROPICAL STORM ERIN ADVISORY NUMBER 12 NWS NATIONAL HURRICANE CENTER MIAMI FL AL052013 500 PM AST SAT AUG 17 2013 ~ ERIN MOVING NORTHWESTWARD AS A MINIMAL TROPICAL STORM ~ SUMMARY OF 500 PM AST ~ 2100 UTC ~ INFORMATION
....where all I have done is replace linefeeds with <br>'s and done some other minor replacement/formatting. There is a mix of lower/upper case even within items and titles, which would probably look better (or, rather, stand out more) in upper case, are in sentence case.
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: NOAA RSS Feeds

Post by gluepack »

OK, so I have a PHP function that calls pSpell and that does most of what I want (I just need to work on the exceptions) but I still need to use the existing Javascript/Ajax function that collects the RSS feed and outputs the final html.

So, now I need a good example of a simple call to a PHP function from within a Javascript/Ajax function so I can pass the RSS text to it and get the modified text back. Any ideas?

Edited to add....

ok.. so I am at the point in the jscript function where

items.content

contains the data that I want to pass to the PHP function and I'd like the output from the function
put back in there (or another variable, no matter).

At this point in the jscript function I have uncustomized code obtained via googling (that I am assured will work)...

Code: Select all

function compute() {
var params="session=123";
$.post('myphpscript.php',params,function(data){ 
	alert(data);//for testing if data is being fetched
	var myObject = eval('(' + data + ')');
	document.getElementById("result").value=myObject(addend_1,addend_2);
	}); 
...and presumably this is to provide the data to PHP and recover it.

Why people don't document examples so you know what they are doing, I'll never know. I mean, some things to be changed are obvious, e.g. the name of the php file, but what else?

Anyway, the php file looks like this...

Code: Select all

<?php
$pspell = pspell_new('en','american','','utf-8',PSPELL_FAST);

function spellCheckWord($word) {
    global $pspell;
    $autocorrect = TRUE;
    // Take the string match from preg_replace_callback's array
    $word = $word[0];
etc......
}
function spellCheck($string) {
    return preg_replace_callback('/\b\w+\b/','spellCheckWord',$string);
}

echo spellCheck("...... the data   .......")
?>
So, what customization is required to pass/recover the data in jscript and what changes need to be made in the PHP file?
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
Post Reply