Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
4.6.0 - Weather Channel Icon
I was messing about in my weather template and decided to add a moon phase icon. I added an image of type 'Field Weather Channel Image' and picked the 'Current Moon Phase Icon' field from the Weather Underground driver. I got a mapped condition icon. So I read the docs to discover that the moon phase isn't supported out of the weather moon phase field in spite of it being available.

Is there a set of icons to be used with a logo image widget that correspond to the WU moon phase numbers? And/Or shouldn't the numbers be unique and distinct from the condition icons so that you could use the 'Field Weather Channel Image'?
Mark Stega
The moon stuff has its own set of numbers and images. It was added way after the fact. I guess the original WC driver didn't provide such info, and so it wasn't until years later that we switched to the WU driver that did. So the moon stuff is completely separate and you have to do it with a logo image widget generally.

Some folks have image sets for the moon phase values from the WU data. If you search around here you'll probably find the original discussions when this field was added and working out what the numbers meant and all that. The images are probably referenced there.
Dean Roddey
Explorans limites defectum
There seems to be a discrepancy between the WU driver and the WU web site wrt to the moon phase.

WU driver:

CurMoonPhase - Full
CurMoonPhaseIcon - 18

WU web site:

CurMoonPhase - Waning Gibbous, 92% visible
CurMoonPhaseIcon - 17

FWIW the weather channel web site has the same description and icon #17 as well.

Either the feed or the interpretation is bad as the two web sites agree with the Naval Observatory.
Mark Stega
The driver is currently reporting Full & 19

I queried the same station that I have configured:

  "response": {
  "features": {
  "astronomy": 1
        ,    "moon_phase": {
        "phaseofMoon":"Waning Gibbous",
        "current_time": {
        "sunrise": {
        "sunset": {
    "sun_phase": {
        "sunrise": {
        "sunset": {

The URL I used is:

Mark Stega
The reason for the +1 is that zero has to be reserved as a well known 'unknown' value. We create the description internally, based on the number (though adjusted back down to be zero based.) Maybe our calculation is a bit off. What we currently do is:

const tCIDLib::TFloat8 f8CurVal = tCIDLib::TFloat8(c4Val);
tCIDLib::TFloat8 f8PerPhase = (29.5305882 / 8.0);

const tCIDLib::TCh* pszPhase;
if (f8CurVal < f8PerPhase)
    pszPhase = L"New";
else if (f8CurVal < (f8PerPhase * 2))
    pszPhase = L"Waxing Cresent";
else if (f8CurVal < (f8PerPhase * 3))
    pszPhase = L"First Quarter";
else if (f8CurVal < (f8PerPhase * 4))
    pszPhase = L"Waxing Gibbous";
else if (f8CurVal < (f8PerPhase * 5))
    pszPhase = L"Full";
else if (f8CurVal < (f8PerPhase * 6))
    pszPhase = L"Waning Gibbous";
else if (f8CurVal < (f8PerPhase * 7))
    pszPhase = L"Third Quarter";
    pszPhase = L"Waning Cresent";

So it looks like full is in the middle of the range, with waxing first and waning last. I have no idea now where I found this calculation. The reason for doing it ourself is so that we can maintain a consistent terminology over time, even if we have to switch sources.
Dean Roddey
Explorans limites defectum
The weather channel is different (and I think correct) in that the new moon, quarter moons, and full each occupy a day; Between are waxing & waning crescent and waxing/waning gibbous; This matches Naval Observatory convention; The divide into 8ths doesn't:

/* ==== MOON PHASES ========================= */

.wx-icon.wx-moonphase { float: left; height: 18px; width: 18px; margin-right: 5px; background-image: url(''); background-repeat: no-repeat; }
.wx-icon.wx-moonphase.wx-moon-29 { background-position: 0 0; }              /* new moon */
.wx-icon.wx-moonphase.wx-moon-6 { background-position: 0 -129px; }          /* waxing crescent */    
.wx-icon.wx-moonphase.wx-moon-7 { background-position: 0 -110px; }          /* first quarter */  
.wx-icon.wx-moonphase.wx-moon-13 { background-position: 0 -92px; }          /* waxing gibbous */
.wx-icon.wx-moonphase.wx-moon-15 { background-position: 0 -73px; }          /* full moon */
.wx-icon.wx-moonphase.wx-moon-21 { background-position: 0 -55px; }          /* waning gibbous */  
.wx-icon.wx-moonphase.wx-moon-22 { background-position: 0 -37px; }          /* last quarter */  
.wx-icon.wx-moonphase.wx-moon-28 { background-position: 0 -18px; }          /* waning crescent */
Mark Stega
So it should be I guess a period of 1/29.53 starting at each of 0%, 25%, 50%, and 75% for the special quarter values, and then anything between those would be the other four values?
Dean Roddey
Explorans limites defectum
I believe that is correct...
Mark Stega
Dean Roddey Wrote:So it should be I guess a period of 1/29.53 starting at each of 0%, 25%, 50%, and 75% for the special quarter values, and then anything between those would be the other four values?
I believe the WU site sends an integral age from 0 to 29 which you map to 1-30

1 = New
2 - 7 = Waxing crescent
8 = First quarter
9 - 14 = Waxing gibbous
15 - 16 = Full
17 - 22 = Waning gibbous
23 = Last quarter
24 - 29 = Waning crescent
30 - New

This will also work well in a field mapped image widget if I can extract 8 lunar icons.
Mark Stega
Also, WU is different than Weather Channel. WC uses many more levels. The problem is that the icon set that I have was originally for WC, so you need to trim it down by half. It needs tweaking to get the actual icon in sync with the real world.

Mark - Look for an email shortly.
Dave Bruner

Possibly Related Threads…
Thread Author Replies Views Last Post
  What is everyone using for weather info? ghurty 11 2,295 04-23-2020, 08:00 AM
Last Post: Dean Roddey
  tray icon keeps disappearing MikeA 64 20,818 12-14-2019, 08:17 AM
Last Post: Dean Roddey
  Open Weather Map - CurIcon zra 2 1,726 11-08-2019, 12:45 PM
Last Post: zra
  Weather tom 69 18,252 06-12-2019, 12:08 PM
Last Post: Dean Roddey
  weather template help zane 20 12,098 01-13-2017, 05:48 PM
Last Post: Dean Roddey
  Weather images vanished pjgregory 1 2,465 12-31-2016, 08:18 AM
Last Post: khill
  Weather Radar potts.mike 22 9,660 05-30-2016, 07:17 AM
Last Post: kblagron
  Weather Underground Issue? sic0048 5 3,559 04-02-2016, 09:14 AM
Last Post: Dean Roddey
  Weather questions royalj7 2 2,225 10-09-2015, 02:09 PM
Last Post: potts.mike
  Radar weather web widget crashed infviewer Ron Haley 12 6,167 06-03-2015, 04:52 PM
Last Post: NightLight

Forum Jump:

Users browsing this thread: 1 Guest(s)