Tuesday, October 17, 2023

Localization Failure: Temperature Is Hard

The Guardian is one of my favorite news sources. I’m a subscriber (support news organizations!) and I read it daily. But it is not immune to errors, as this headline shows:

Record heat: Malawi swelters with temperatures nearly 68F above average

68F above average is a lot. For a tropical country it is not credible for temperatures to be that much warmer than average because the average is too high to give enough headroom. So what gives?

Reading the article I found this:

parts of Malawi saw a maximum temperature of 43C (109F), compared with an average of nearly 25C (77F)

As I expected the actual temperature increase was 32F, not 68F. So what’s up with that headline? Here’s a hint: this is what the headline might say if you set your location to somewhere other than the United States:

Malawi swelters in record heat with temperatures nearly 20C above average

Now “nearly 20C” is an odd way of saying “18C”, but I guess they really like round numbers, and that’s not the problem. The problem is that somebody – the localization team? an algorithm? – decided that 20C was equivalent to 68F. And they’re not wrong. And yet they are.

When converting from a temperature in Celsius to one in Fahrenheit you have to multiply by 1.8 (because each degree Celsius covers a range 1.8 times as large as a degree Fahrenheit) and you have to add 32F (because the freezing point in Fahrenheit is 32, compared to 0 in Celsius). However if you are converting a temperature difference you just multiply by 1.8.

That is, if the temperature goes up by 1C then it has gone up by 1.8F. If it goes up by 10C then it has gone up by 18F. If it goes up by 20C then it has gone up by 36F. Adding 32F in this context is just wrong.

This is just another version of the fallacy involved when somebody says that it is “twice as hot” when the temperature goes from 5C to 10C – note that this is equivalent to going from 278K to 283K, or 41F to 50F, so clearly not “twice as hot” in any meaningful way.

In short, translating 20C requires examining the context and there are at least three possible translations:

  • “The temperature is 20C” translates to “The temperature is 78F”
  • “It’s 20C warmer than yesterday” translates to “It’s 36F warmer than yesterday”
  • “The temperature is minus 20C” translates to “The temperature is minus 4F”

So 20C is either 78F, 36F, or (minus) 4F.

Reported here:

https://twitter.com/BruceDawson0xB/status/1714406661904007624

About brucedawson

I'm a programmer, working for Google, focusing on optimization and reliability. Nothing's more fun than making code run 10x as fast. Unless it's eliminating large numbers of bugs. I also unicycle. And play (ice) hockey. And sled hockey. And juggle. And worry about whether this blog should have been called randomutf-8. 2010s in review tells more: https://twitter.com/BruceDawson0xB/status/1212101533015298048

This entry was posted in Math, metric, Rants and tagged , , . Bookmark the permalink.



from Hacker News https://ift.tt/eTDI1kR

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.