You are here

function _weather_calculate_beaufort in Weather 5.6

Same name and namespace in other branches
  1. 6.5 weather_parser.inc \_weather_calculate_beaufort()

Calculate Beaufort wind scale for given wind speed

Parameters

float Wind speed in km/h:

Return value

Beaufort number

See also

http://en.wikipedia.org/wiki/Beaufort_scale

1 call to _weather_calculate_beaufort()
_weather_parse_wind in ./weather_parser.inc
Extract the wind information

File

./weather_parser.inc, line 614

Code

function _weather_calculate_beaufort($wind_speed) {
  if ($wind_speed >= 120) {
    return 12;
  }
  if ($wind_speed >= 103) {
    return 11;
  }
  if ($wind_speed >= 88) {
    return 10;
  }
  if ($wind_speed >= 76) {
    return 9;
  }
  if ($wind_speed >= 63) {
    return 8;
  }
  if ($wind_speed >= 51) {
    return 7;
  }
  if ($wind_speed >= 40) {
    return 6;
  }
  if ($wind_speed >= 30) {
    return 5;
  }
  if ($wind_speed >= 20) {
    return 4;
  }
  if ($wind_speed >= 12) {
    return 3;
  }
  if ($wind_speed >= 7) {
    return 2;
  }
  if ($wind_speed >= 1) {
    return 1;
  }
  return 0;
}