Année: Mois:
\n"; echo $select; // END NEW ********** // Display the data //echo '

Monthly Climatological Summary

'; display_month($year,$month) ; //echo '
Collected data is generated at 12 minutes after Midnight each day'; // Function to parse the month needed. // Allows multiple display_month calls above. function display_month($year,$month) { global $raw, $SITE, $months; $months = array ("Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Août", "Septembre","Octobre","Novembre","Décembre"); $data = json_decode(file_get_contents('http://www.laurentmey.fr/meteo/histograph/historicDfile.php?mm='.$month.'&yy='.$year), true); //print_r($data); echo '

Données mensuelles ' . $months[$month -1 ] . ' ' . $year . '


'; echo ''. '' ; $NbJours = count($data['jour']); $wdirm =0; $winddir = array ("N"=> 0, "NE"=> 0, "E"=> 0, "SE"=> 0, "S"=> 0, "SO" => 0, "O"=> 0, "NO"=> 0,"NNO"=> 0, "NNE"=> 0, "ENE"=> 0, "ESE"=> 0, "SSE"=> 0, "SSO" => 0, "OSO"=> 0, "ONO"=> 0); // Read the array now looking for data in the data set we want for($i = 0; $i < $NbJours; $i++) { // Check to see if this is in the date data set // Date echo ''; // Temps echo ''; // Deg day echo ''; // Pressure echo ''; // Wind echo ''; $wdirm += ($data['vdir'][$i])*$data['ventt'][$i]; $dir = windDir($data['vdir'][$i]); if ($data['ventt'][$i] > 0) $winddir[$dir]++; // Rain echo ''; // Hum echo ''; // Solar echo ''; echo '' . $LF; $found++; } if ($found) { // Date echo ''; // Temps echo ''; // Deg day echo ''; // Pressure echo ''; // Wind foreach($winddir as $k => $v){ if($v == (max($winddir))){ // see if number of occurences = max $dirD = $k; // sort of put back into a degree range } } echo ''; // Rain echo ''; // Hum echo ''; // Solar echo ''; echo '' . $LF; } echo '
Jour Temp max
°C
Temp min
°C
Temp moy.
°C
Déficit
DJU
Exédent
DJU
Press min
(mb)
Press max
(mb)
Rafale max
(km/h)
Vent
Dominant
Parcours
(km)
Pluie
(mm)
Averse
mm/hr
Hum max
(%)
Hum min
(%)
Srad max
(W/m2)
' . $data['jour'][$i] . '' . number_format($data['tmax'][$i],1) . '' . number_format($data['tmin'][$i],1) . '' . number_format($data['tavg'][$i],1) . '' . number_format($data['hdd'][$i],1) . '' . number_format($data['cdd'][$i],1) . '' . $data['pmax'][$i] . '' . $data['pmin'][$i] . '' . $data['ventr'][$i] . '' . windDir($data['vdir'][$i]) . '' . $data['ventt'][$i] . '' . $data['pluie'][$i] . '' . $data['averse'][$i] . '' . $data['hmax'][$i] . '' . $data['hmin'][$i] . '' . $data['srad'][$i] . '
' .'Extr.'. '' . number_format($data['tmaxM'],1) . '' . number_format($data['tminM'],1) . '' . number_format($data['tavgM'],1) . '' . number_format($data['hddM'],1) . '' . number_format($data['cddM'],1) . '' . $data['pmaxM'] . '' . $data['pminM'] . '' . $data['ventrM'] . '' . $dirD. '' . $data['venttM'] . '' . $data['pluieM'] . '' . $data['averseM'] . '' . $data['hmaxM'] . '' . $data['hminM'] . '' . $data['sradM'] . '
'; // If we found no records, output an error: if (!$found) { echo "

Sorry, there is no data found for " . $months[$month -1 ] . ' ' . $year . "

"; } } // Return the array position of the variable function ret_val($lookup) { global $SITE; $rtn = array_search ( $lookup , $SITE['dfields'] ); if ($rtn !== FALSE) { return( $rtn ); } else { return("-"); } } // Return the array position of the variable function ret_rval($lookup) { global $SITE, $data; $rtn = array_search ( $lookup , $SITE['rfields'] ); if ($rtn !== FALSE) { return( $data[$rtn] ); } else { return("-"); } } // Standard Source view option check function check_sourceview () { global $SITE; if ( isset($_GET['view']) && $_GET['view'] == 'sce' ) { $filenameReal = __FILE__; $download_size = filesize($filenameReal); header('Pragma: public'); header('Cache-Control: private'); header('Cache-Control: no-cache, must-revalidate'); header("Content-type: text/plain"); header("Accept-Ranges: bytes"); header("Content-Length: $download_size"); header('Connection: close'); readfile($filenameReal); exit; } } // Calculate Word WinDir from Bearing function windDir ($winddir) { if (!isset($winddir)) { return "---"; } $windlabel = array ("N","NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSO","SO", "OSO", "O", "ONO", "NO", "NNO"); $dir = $windlabel[ fmod((($winddir + 11) / 22.5),16) ]; return "$dir"; } function windDir8 ($winddir) { if (!isset($winddir)) { return "---"; } $windlabel = array ("N", "NE", "E", "SE", "S", "SO", "O", "NO"); $dir = $windlabel[ fmod((($winddir + 22.5) / 45),8) ]; return "$dir"; } // Function to read the data file with the // Delimiter provided function get_raw( $rawfile , $del ) { $rawdata = array(); $fd = fopen( $rawfile, "r" ); if ( $fd ) { $rawinfo = ''; while (! feof ( $fd ) ) { $rawinfo .= fread( $fd, 8192 ); } fclose($fd); $rawdata = explode ( $del, $rawinfo ); } else { $rawdata[0]= -9999; } return $rawdata; } ############################################################################ # End of Module ############################################################################ ?>