Re: DateTime->season?

[email protected] ("David E. Wheeler")
Newsgroups perl.datetime
Message-ID <[email protected]>
On Jan 29, 2008, at 03:19, Zefram wrote:

> David E. Wheeler wrote:
>>       return $date lt '03-21' ? 'winter'
>>            : $date lt '06-21' ? 'spring'
>
> Northern hemisphere chauvinism.

It was a very limited need, in Virginia, so good enough.

> Aside from the hemisphere issue, the code is also wrong for tropical
> latitudes, where the four-season system doesn't apply.  If you're  
> trying
> to answer a user's question of "what season is it?" then you need a  
> lot
> more flexibility.  Even within the four-season system, people draw the
> boundaries in different places.  That's inevitable when trying to  
> impose
> sharp distinctions on a system that actually has a fuzzy continuum.

Yes, I realized some time after posting this that my implementation  
was very naive, and not likely to be usable outside a very narrow  
geographical area. But as I said, the immediate need was within that  
area, so for purposes of a quick hack, it works fine. :-)

> Sounds like you're looking for the equinox and solstice dates.  I  
> don't
> see any CPAN module providing this, on search.cpan.org.  I guess
> that makes it your job to write one.  Ideally you'd want to work from
> Astronomical Algorithms <http://www.willbell.com/math/mc1.htm>.   
> Google
> for "equinox calculation" to find several lower-precision algorithms  
> in
> various programming languages.

Might be an interesting thing to add.

Thanks for the feedback, folks,

David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.