Compare commits
5 Commits
shift-5450
...
patch-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db34d0e3e7 | ||
|
|
fffbab7201 | ||
|
|
76a2a16fa6 | ||
|
|
cfbd1c901a | ||
|
|
617813bdbf |
@@ -1772,7 +1772,7 @@ class Metar implements \ArrayAccess
|
||||
*/
|
||||
private function calculate_wind_chill($temperature_f): void
|
||||
{
|
||||
if ($temperature_f < 51 && $this->result['wind_speed'] !== 0) {
|
||||
if ($temperature_f < 51 && $this->result['wind_speed'] && $this->result['wind_speed'] !== 0) {
|
||||
$windspeed = $this->result['wind_speed']->toUnit('mph');
|
||||
if ($windspeed > 3) {
|
||||
$chill_f = 35.74 + 0.6215 * $temperature_f - 35.75 * ($windspeed ** 0.16);
|
||||
|
||||
@@ -151,6 +151,19 @@ class MetarTest extends TestCase
|
||||
$this->assertEquals('Few at 1500 feet; few at 25000 feet', $metar['clouds_report_ft']);
|
||||
}
|
||||
|
||||
/**
|
||||
* https://github.com/nabeelio/phpvms/issues/1071
|
||||
*/
|
||||
public function testMetarWindSpeedChill()
|
||||
{
|
||||
$metar = 'EKYT 091020Z /////KT CAVOK 02/M03 Q1019';
|
||||
$metar = Metar::parse($metar);
|
||||
|
||||
$this->assertEquals('VFR', $metar['category']);
|
||||
$this->assertNull($metar['wind_speed']);
|
||||
$this->assertEquals(6.21, $metar['visibility']['mi']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Visibility in KM not parsed
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user