No station information = lame station?

Asked by Dean Moreton

I'm using NZAA (New Zealand, Auckland Airport) but do not see any station information at all on my wallpaper. I take it all stations are not equal when it comes to providing info? (I do get a temperature reading at least) If I switch to a larger city i.e. London I see info on the wallpaper.

Question information

Language:
English Edit question
Status:
Answered
For:
Weather wallpaper Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Raúl González Duque (zootropo) said :
#1

That's because NOAA doesn't have any information for the visibility in Auckland Airport. I assumed all stations had all the information available so when it tries to convert the None value from getVisibility to an integer, it fails.

It will be fixed in the next version.

Thank you for the info.

Revision history for this message
Nate Walker (kiwinewt) said :
#2

I would like to know when the next version would be available, or is there a way of changing the code in the debian/ubuntu version?

Cheers

Revision history for this message
Raúl González Duque (zootropo) said :
#3

A couple of days I suppose.
You can change it yourself, yeah. Edit /usr/bin/weather-wallpaper with your favorite text editor and substitute line 154:
report_str += _("Visibility: ") + str(int(report.getVisibilityKilometers())) + "Km\n"

for something like this
if report.getVisibilityKilometers():
    report_str += _("Visibility: ") + str(int(report.getVisibilityKilometers())) + "Km\n"
else:
    report_str += _("Visibility: ") + "---Km\n"

Beware of the spaces at the beginning of the line, as python needs the code blocks to be equally indented.

Revision history for this message
Nate Walker (kiwinewt) said :
#4

Thanks a lot. I changed this earlier before your answer but didnt have chance to post it up on here.

Nice program. I like it a lot :)

Revision history for this message
Nate Walker (kiwinewt) said :
#5

Just a thought. Possibly use this to allow for no points of lack of information constantly giving ugly ---'s (no offense meant Raúl)

            if report.getTemperatureCelsius():
                report_str += _("Temperature: ") + str(int(report.getTemperatureCelsius())) + "ºC\n"
            if report.getHumidity():
                report_str += _("Humidity: ") + str(int(report.getHumidity())) + "%\n"
            if report.getVisibilityKilometers():
                report_str += _("Visibility: ") + str(int(report.getVisibilityKilometers())) + "Km\n"
            if report.getDewPointCelsius():
                report_str += _("Dew point: ") + str(int(report.getDewPointCelsius())) + "ºC\n"
            if report.getWindCompass():
                report_str += _("Wind: ") + wind[str(report.getWindCompass())] + _(" at ") + str(int(report.getWindSpeed())) + "m/s\n"
            if report.getPressure():
                report_str += _("Pressure: ") + str(int(report.getPressure())) + " hPa"

Revision history for this message
Raúl González Duque (zootropo) said :
#6

Yeah. That's a better idea.
But getwindcompass can be None because there's no wind or because there's not such information for that station.

Revision history for this message
Nate Walker (kiwinewt) said :
#7

So are you saying that the wind speed returns None when it is at 0? because if not then it could be used as a checker.
something like:
if report.getWindCompass():
  report_str += _("Wind: ") + wind[str(report.getWindCompass())]
  if int(report.getWindSpeed())
      report_str += _(" at ") + str(int(report.getWindSpeed())) + "m/s\n"

Revision history for this message
Nate Walker (kiwinewt) said :
#8

ps: the second if would have to have:
else
report_str += "\n"

Can you help with this problem?

Provide an answer of your own, or ask Dean Moreton for more information if necessary.

To post a message you must log in.