Skip to content

Commit

Permalink
Fix sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
RudiZhang committed Apr 5, 2024
1 parent c4b142a commit c0ba6a2
Showing 1 changed file with 48 additions and 49 deletions.
97 changes: 48 additions & 49 deletions datis.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,49 @@

//NOTAM (reserve)

// Wind
print(' WIND ');

// Visibility
if (strpos($rawMetar, 'CAVOK') !== false) {
print(' CAVOK ');
if ($surfaceWindObj->getMeanSpeed()->getValue() == 0) {
print('CALM ');
} else {
print(' VIS ' . $visObj->getVisibility()->getValue() . ' M ');
if ($surfaceWindObj->withVariableDirection() == true) {
print('VRB DEG ');
} else {
if ($surfaceWindObj->getMeanDirection()->getValue() < 100) {
print('0');
}
print($surfaceWindObj->getMeanDirection()->getValue() . ' DEG ');
}

$raw_sw = $surfaceWindObj->getMeanSpeed()->getValue();
$int_sw = (int)$raw_sw;
$str_sw = strval($int_sw);
if ($int_sw < 10) {
$out_sw = '0' . $str_sw ;
} else {
$out_sw = $str_sw ;
}

print($out_sw . ' MPS ');

}
If ($surfaceWindObj->getSpeedVariations() != null) {
if ($surfaceWindObj->getSpeedVariations()->getValue() < 10) {
print(' GUST 0' . $surfaceWindObj->getSpeedVariations()->getValue() . ' MPS ');
} else {
print(' GUST ' . $surfaceWindObj->getSpeedVariations()->getValue() . ' MPS ');
}
}
if ($surfaceWindObj->getDirectionVariations() != null) {
if ($surfaceWindObj->getDirectionVariations()[0]->getValue() < 100) {
print('0');
}
print($surfaceWindObj->getDirectionVariations()[0]->getValue() . 'V');
if ($surfaceWindObj->getDirectionVariations()[1]->getValue() < 100) {
print('0');
}
print($surfaceWindObj->getDirectionVariations()[1]->getValue() . ' DEG ');
}

// RVR
Expand Down Expand Up @@ -99,6 +136,13 @@
}
}

// Visibility
if (strpos($rawMetar, 'CAVOK') !== false) {
print(' CAVOK ');
} else {
print(' VIS ' . $visObj->getVisibility()->getValue() . ' M ');
}

// Cloud & Weather Phenomenon
if (strpos($rawMetar, 'NSC') === true) {
print(' NSC');
Expand Down Expand Up @@ -132,51 +176,6 @@
print(' ');
}

// Wind
print(' WIND ');

if ($surfaceWindObj->getMeanSpeed()->getValue() == 0) {
print('CALM ');
} else {
if ($surfaceWindObj->withVariableDirection() == true) {
print('VRB DEG ');
} else {
if ($surfaceWindObj->getMeanDirection()->getValue() < 100) {
print('0');
}
print($surfaceWindObj->getMeanDirection()->getValue() . ' DEG ');
}

$raw_sw = $surfaceWindObj->getMeanSpeed()->getValue();
$int_sw = (int)$raw_sw;
$str_sw = strval($int_sw);
if ($int_sw < 10) {
$out_sw = '0' . $str_sw ;
} else {
$out_sw = $str_sw ;
}

print($out_sw . ' MPS ');

}
If ($surfaceWindObj->getSpeedVariations() != null) {
if ($surfaceWindObj->getSpeedVariations()->getValue() < 10) {
print(' GUST 0' . $surfaceWindObj->getSpeedVariations()->getValue() . ' MPS ');
} else {
print(' GUST ' . $surfaceWindObj->getSpeedVariations()->getValue() . ' MPS ');
}
}
if ($surfaceWindObj->getDirectionVariations() != null) {
if ($surfaceWindObj->getDirectionVariations()[0]->getValue() < 100) {
print('0');
}
print($surfaceWindObj->getDirectionVariations()[0]->getValue() . 'V');
if ($surfaceWindObj->getDirectionVariations()[1]->getValue() < 100) {
print('0');
}
print($surfaceWindObj->getDirectionVariations()[1]->getValue() . ' DEG ');
}

// Miscellaneous
$temp_data = $decoded->getAirTemperature()->getValue();
$int_temp_data = (int)$temp_data;
Expand Down

0 comments on commit c0ba6a2

Please sign in to comment.