Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
4.6.0 - Weather Channel Icon
#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


Messages In This Thread
4.6.0 - Weather Channel Icon - by Mark Stega - 11-08-2014, 08:07 AM
4.6.0 - Weather Channel Icon - by Mark Stega - 11-09-2014, 06:25 AM
4.6.0 - Weather Channel Icon - by Mark Stega - 11-09-2014, 06:50 AM
4.6.0 - Weather Channel Icon - by Dean Roddey - 11-09-2014, 09:27 AM
4.6.0 - Weather Channel Icon - by Mark Stega - 11-09-2014, 12:08 PM
4.6.0 - Weather Channel Icon - by Dean Roddey - 11-09-2014, 12:19 PM
4.6.0 - Weather Channel Icon - by Mark Stega - 11-09-2014, 01:20 PM
4.6.0 - Weather Channel Icon - by Mark Stega - 11-10-2014, 01:15 PM
4.6.0 - Weather Channel Icon - by DaveB - 11-11-2014, 06:31 AM
4.6.0 - Weather Channel Icon - by Dean Roddey - 11-08-2014, 09:56 AM

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

Forum Jump:


Users browsing this thread: 1 Guest(s)