Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
4.6.0 - Weather Channel Icon
#1
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
Reply
#2
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
Reply
#3
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
Reply
#4
The driver is currently reporting Full & 19

I queried the same station that I have configured:

Code:
{
  "response": {
  "version":"0.1",
  "termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
  "features": {
  "astronomy": 1
  }
    }
        ,    "moon_phase": {
        "percentIlluminated":"92",
        "ageOfMoon":"18",
        "phaseofMoon":"Waning Gibbous",
        "hemisphere":"North",
        "current_time": {
        "hour":"9",
        "minute":"47"
        },
        "sunrise": {
        "hour":"6",
        "minute":"42"
        },
        "sunset": {
        "hour":"16",
        "minute":"56"
        }
    },
    "sun_phase": {
        "sunrise": {
        "hour":"6",
        "minute":"42"
        },
        "sunset": {
        "hour":"16",
        "minute":"56"
        }
    }
}

The URL I used is:
Code:
http://api.wunderground.com/api/MYKEY/astronomy/q/UnitedStates/knak.json

EDIT: Added URL
Mark Stega
Reply
#5
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:

Code:
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";
else
    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
Reply
#6
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:

Code:
/* ==== MOON PHASES ========================= */

.wx-icon.wx-moonphase { float: left; height: 18px; width: 18px; margin-right: 5px; background-image: url('http://s.imwx.com/img/common/wx-lunar-phases.png'); background-repeat: no-repeat; }
.wx-icon.wx-moonphase.wx-moon-0,
.wx-icon.wx-moonphase.wx-moon-29 { background-position: 0 0; }              /* new moon */
.wx-icon.wx-moonphase.wx-moon-1,
.wx-icon.wx-moonphase.wx-moon-2,
.wx-icon.wx-moonphase.wx-moon-3,
.wx-icon.wx-moonphase.wx-moon-4,
.wx-icon.wx-moonphase.wx-moon-5,
.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-8,
.wx-icon.wx-moonphase.wx-moon-9,
.wx-icon.wx-moonphase.wx-moon-10,
.wx-icon.wx-moonphase.wx-moon-11,
.wx-icon.wx-moonphase.wx-moon-12,
.wx-icon.wx-moonphase.wx-moon-13 { background-position: 0 -92px; }          /* waxing gibbous */
.wx-icon.wx-moonphase.wx-moon-14,                                  
.wx-icon.wx-moonphase.wx-moon-15 { background-position: 0 -73px; }          /* full moon */
.wx-icon.wx-moonphase.wx-moon-16,
.wx-icon.wx-moonphase.wx-moon-17,
.wx-icon.wx-moonphase.wx-moon-18,
.wx-icon.wx-moonphase.wx-moon-19,
.wx-icon.wx-moonphase.wx-moon-20,
.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-23,
.wx-icon.wx-moonphase.wx-moon-24,
.wx-icon.wx-moonphase.wx-moon-25,
.wx-icon.wx-moonphase.wx-moon-26,
.wx-icon.wx-moonphase.wx-moon-27,
.wx-icon.wx-moonphase.wx-moon-28 { background-position: 0 -18px; }          /* waning crescent */
Mark Stega
Reply
#7
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
Reply
#8
I believe that is correct...
Mark Stega
Reply
#9
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
Reply
#10
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.
Thanks,
Dave Bruner
Cool
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Weather tom 69 4,872 06-12-2019, 12:08 PM
Last Post: Dean Roddey
  tray icon keeps disappearing MikeA 58 9,652 06-01-2019, 03:21 PM
Last Post: Shaky
  weather template help zane 20 8,514 01-13-2017, 05:48 PM
Last Post: Dean Roddey
  Weather images vanished pjgregory 1 1,492 12-31-2016, 08:18 AM
Last Post: khill
  Weather Radar potts.mike 22 6,105 05-30-2016, 07:17 AM
Last Post: kblagron
  Weather Underground Issue? sic0048 5 2,144 04-02-2016, 09:14 AM
Last Post: Dean Roddey
  Weather questions royalj7 2 1,399 10-09-2015, 02:09 PM
Last Post: potts.mike
  Radar weather web widget crashed infviewer Ron Haley 12 4,046 06-03-2015, 04:52 PM
Last Post: NightLight
  Weather Underground Driver zra 5 1,840 03-25-2015, 08:01 AM
Last Post: Dean Roddey
  Weather Underground driver Sunset is Sunrise rbroders 8 2,737 02-03-2015, 07:11 PM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)