@@ -63,12 +63,16 @@ discard block |
||
63 | 63 | |
64 | 64 | public function openweathermap($latitude,$longitude) { |
65 | 65 | global $globalOpenWeatherMapKey; |
66 | - if ($globalOpenWeatherMapKey == '') return array(); |
|
66 | + if ($globalOpenWeatherMapKey == '') { |
|
67 | + return array(); |
|
68 | + } |
|
67 | 69 | $Common = new Common(); |
68 | 70 | $url = 'http://api.openweathermap.org/data/2.5/weather?lat='.$latitude.'&lon='.$longitude.'&units=metric&appid='.$globalOpenWeatherMapKey; |
69 | 71 | //echo $url."\n"; |
70 | 72 | $weatherdata = json_decode($Common->getData($url),true); |
71 | - if (!isset($weatherdata['main']['temp']) || !isset($weatherdata['weather'][0]['id'])) return array('clouds' => array(),'rain' => array()); |
|
73 | + if (!isset($weatherdata['main']['temp']) || !isset($weatherdata['weather'][0]['id'])) { |
|
74 | + return array('clouds' => array(),'rain' => array()); |
|
75 | + } |
|
72 | 76 | $dew = $weatherdata['main']['temp'] - ((100-$weatherdata['main']['humidity'])/5); |
73 | 77 | $cumulus_base = 122.0 * ($weatherdata['main']['temp'] - $dew); |
74 | 78 | $stratus_base = 100.0 * (100.0 * $weatherdata['main']['humidity'])*0.3048; |
@@ -104,7 +108,9 @@ discard block |
||
104 | 108 | |
105 | 109 | public function nomad_wind($hour = '') { |
106 | 110 | global $globalWindsPath; |
107 | - if ($hour == '') $hour = date('G'); |
|
111 | + if ($hour == '') { |
|
112 | + $hour = date('G'); |
|
113 | + } |
|
108 | 114 | if (isset($globalWindsPath) && $globalWindsPath != '') { |
109 | 115 | $grib2json = $globalWindsPath['grib2json']; |
110 | 116 | $windpathsrc = $globalWindsPath['source']; |
@@ -142,7 +148,9 @@ discard block |
||
142 | 148 | system($grib2json.' --data --output '.$windpathdest.' --names --compact '.$windpathsrc); |
143 | 149 | } else { |
144 | 150 | // if not try previous run |
145 | - if ($hour == date('G')) $this->nomad_wind(date('G')-6); |
|
151 | + if ($hour == date('G')) { |
|
152 | + $this->nomad_wind(date('G')-6); |
|
153 | + } |
|
146 | 154 | } |
147 | 155 | } |
148 | 156 |