iwa-panda2

Manage Weather Data by International Weather Agency (Version 2)
Log | Files | Refs | README

Formula.php (584B)


      1 <?php
      2 
      3 namespace Model {
      4     class Formula
      5     {
      6         public static function windchill($temp, $wind): float
      7         {
      8             $result = 13.12 + 0.6215 * $temp - 11.37 * pow($wind, 0.16) + 0.3965 * $temp * pow($wind, 0.16);
      9             return round($result, 2);
     10         }
     11 
     12         public static function humid($temp, $dewp): float|int
     13         {
     14             $specific_humidity = exp((17.625*$dewp)/(243.04+$dewp));
     15             $saturation_point = exp((17.625*$temp)/(243.04+$temp));
     16 
     17             return round(($specific_humidity / $saturation_point) * 100, 2);
     18         }
     19     }
     20 }