• Resolved allm

    (@realblueorange)


    @hal,

    You’ve made an awesome weather plugin! There is just one thing I need to check with you. If I read your source code and the api documentation from the openweathermap correctly it seems to me that the wind speed you display for metric units needs to be multiplied by 3.6, because the API gives it in m/s and you display km/h. Am I correct?

    https://www.ads-software.com/plugins/awesome-weather/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Hal Gatewood

    (@halgatewood)

    Wow, you are correct. They return the weather in m/s!

    I just fixed that in version 1.5.3.

    I also added a filter on the wind speed, wind speed text and direction if someone wants to do some calculations on that and convert it to whatever they want. The filter is called: awesome_weather_wind_speed

    Thread Starter allm

    (@realblueorange)

    I am glad to help.

    Another wind speed measure is the beaufort scale. It is common in some parts of the world, but I am not quite sure if this is really something international. Using the new filter I guess people can do their own calculations.

    To be complete: more info here:
    https://en.wikipedia.org/wiki/Beaufort_scale

    Great plugin. Keep up the good work. ??

    I’m noticing that it seems the the wind speed changes when settings are changed from F to C but the wind speed units remain m/s.
    I corrected that with:
    add_filter( ‘awesome_weather_wind_speed’, ‘tweak’, 10, 1);

    function tweak($sym) {
    if($sym[‘units’] == ‘imperial’) {
    $sym[‘text’] = ‘?mph?‘;
    }
    return $sym;
    }
    and when the apply_filters is called I added units to the array as:
    $wind_speed_obj = apply_filters(‘awesome_weather_wind_speed’, array( ‘text’ => __(‘m/s’, ‘awesome-weather’),’speed’=> $today->wind->speed, ‘direction’ => $wind_direction, ‘units’ => $units), $today->wind->speed, $wind_direction );

    Would this be correct? thanks I appreciate your work.
    Ziggy

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wind speed’ is closed to new replies.