No night images (only day-time image shows)
sopia - December 21, 2007 - 04:17
| Project: | Weather |
| Version: | 6.x-5.7 |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | toddy |
| Status: | active |
Description
I am have trouble with this module. Everything works good, but it doesn't show the night images, only the daytime ones.
Is this a bug, or have I forgotten a configuration somewhere?
Thanks for your help,
Sopia

#1
Hi,
which ICAO code are you using? Do you have caching enabled on your site? Does this happen for authenticated users as well?
Regards,
Tobias
#2
I got the same thing happening. I suppose this is the ICAO is KLRD. I am using the 4.7 version. The system time on the linux machine is correct and so are the time settings within drupal.
#3
you can look at the weather module running on my site http://adancalderon.net
Right now I have College Station and Laredo listed. Since these two cities are in the same state they should both have night images at night.
#4
Hm, I cannot reproduce your error -- I've just looked at your site, and both cities display with a night image. See attached screenshot. I've captured that image on Sat, 19 January at 13:03 UTC.
#5
I took a screenshot also about 12 hours earlier. Both are day time time right now. The strange thing is that the screenshot that you took should have showed both of them as day time.
#6
Why? The sun has not risen at the time I took my screenshot. I've attached a new screenshot of the module version 5.x-5.1, where you can display the sunrise and sunset times. It looks correct to me that both images were night time, and are now daytime.
#7
It's about an hour before midnight and I took this screenshot. It is very dark outside and yet the picture used is still that of day time. I still have no idea. Do you think the times of sun rise and sun set are reported wrong?
#8
I'm experiencing this same issue. It's 10pm eastern and I see a daytime image for Ocean City, MD. Did you guys ever figure this out?
#9
No, I could not reproduce this bug. Are you really using version 5.x-1.0? If so, could you update to 5.x-6.1 and report back if this error still exists?
Regards,
Tobias
#10
I'm experiencing this same issue - I'm using version 5.x-6.1 with the time on my website set to U.S. eastern standard time; however, it is now 22:00 and the daytime images are still showing. Any suggestions?
#11
I'm adding more information --
I'm using Drupal 5.9 and weather version 5.x-6.1 configured to ICAO code KDCA (Reagon National Airport, Washington D.C.). I've disabled all other contrib modules to make sure that there is no conflict. The sunrise/sunset time seems accurate; however, the night images do not display after sunset. I think that they might display sometime during the night, but I haven't stayed up late enough to verify this. I have examined the raw METAR data and it appears that the location is sending accurate data.
Interestingly enough, the night images work as expected when I try a location nearly opposite KDCA. (e.g. Calcutta, India). I don't see how the feature could work with one location and not another.
Please let me know what else I can try.
Thanks,
Jason
#12
A bit more info:
Caching is disabled and this affects all users (both authenticated and anonymous).
#13
Jason,
thanks for your detailed report. I've enabled the locations you mentioned on my copy, and it seems to work alright so far. Which time is set on your server? Does it use any timezone configuration? Does your server run Windows or Linux?
Regards,
Tobias
#14
My server runs Linux and it looks like it is set up to EST with daylight savings time in effect.
#15
Any update on this? Were you able to reproduce the error?
#16
I have the same error using the 6x version of this module. Cant seem to get night images to work but everything else is perfect. At what time does the module assume it is night?
#17
The module calculates the sunrise and sunset time based on the longitude/latitude of the airport that is reporting the weather; consequently, the time should vary slightly each day. The night images should appear at the first time the module gets a weather report after the sunset time (the module checks the weather approximately once per hour).
For me, the code was working perfectly to calculate the sunrise/sunset times, but it seemed that when the module updated the weather it did not always check the update time vs. the sunset/sunrise time. I have no idea why this was the case . . .
I didn't mess with that code at all; however, to acheive the look that I wanted, I changed the theme_weather function inside of the 5.x version of the module. After changing this, my night/day images change as expected. Once again, I have no clue why changing the themeing function would matter . . .
#18
hopefully we can use this info to roll out an update
#19
Hi Toddy,
I'm having the same problem as jasonkotter. However, I'm not sure what he did as regards to changing "theme_weather".
I'd definitely would like to have the images change day or night accordingly. Everything else is working perfectly. I've set the module to my time zone -0800 (the site is located in America/Los Angeles), I've tried drupal time zone, and even GMT. The location is set to KLGB, Long Beach.
Any help here will be greatly appreciated.
#20
I took a screenshot showing the weather block displaying the full metar data, if I'm reading this correctly, the data next to the date may be showing the time incorrectly at 06:53 whereas it's actually 11:53pm in Long Beach.
Could this mean that the metar data for the time is coming in wrong?
#21
Freaky... Now, close to midnight, the module just changed its image to night.
#22
Hello,
I've been working on a new module that depends on the Weather module. I believe I may have discovered an issue in the Weather module that causes incorrect day/night computations.
In a nutshell, in weather.parser.inc, four lines of code use date() which create timezone dependent date parts. (day, year, month, and day_of_year) Those date parts are then used to farther down in the same function to reassemble a sunset or sunrise time with gmmktime(), which expects GMT date parts.
I've attached a patch that was created with diff.exe against the latest Drupal 6 version of the module.
As this is my first patch, and may be created incorrectly, please go easy on me. I'm new to this process.
If I'm off base I'd love to hear where I went astray.
Dwaine