Fichiers NOAA ....(moi aussi)

Forum dédié aux différents paramétrages de WsWin, et il y en a…
Landéda
Participation 0
Participation 0
Messages : 34
Enregistré le : 09 déc. 2012, 00:18
Localisation : 29870 Landéda

Fichiers NOAA ....(moi aussi)

Message par Landéda » 21 juin 2013, 00:32

Bonsoir à tous et je ne veux pas m'immiscer dans la discussion passionnante Fichiers noaa... déjà commencée, mais comme le sujet m'intéresse:
J’ai suivi la piste indiquée par Tugdur, bonjour spécial à lui.
J’ai téléchargé le dossier « Climato » de Chris, merci à lui, et j’ai tenté de suivre ses conseils :
2) Plaçer les fichier template_nooa_m.txt et template_noaa_y.txt dans le dossier de wswin (là où sont présent tout les fichiers customs, customs.txt...)
Les miens sont donc dans : C:\Wswin
3) Indiquer dans les fichiers climatom.php et climatoa.php la date de début des enregistremenst.
Fait(: 2013 et mars 2013)

C’est ensuite que je coince :
4) Créer sur le serveur un dossier (par exemple "NOAA") et envoyer dans ce dossier tous les fichiers PHP ainsi que le dossier "pictos"
5) Dans Wswin, aller dans "contrôle"==>"Paramètres Template/APRS/Synop/Metar..." et cocher les cases "NOAA créer fichier de template mois" et "NOAA créer fichier de template année"…
6) Programmer le logiciel FTP pour envoyer les fichiers qui seront créés dans ce répertoire vers le dossier (NOAA) sur le serveur
Voici tout ce que j’ai su en faire :
Dans Paramètres Template/APRS/Synop/Metar… :Wswin place les Templates dans C:\Wswin\html\text\
Actuellement dans C:\Wswin\html\text\ j’ai les fichiers texte suivants : noaa2013, noaa201303, noaa201304, noaa201305, noaa201306, ws_report
donc pour ce que je comprends ça commence en mars 2013, j’en ai tenu compte plus haut
J’utilise FTP Uploader, il ne parle pas Français et moi je ne parle pas l’Allemand : il envoie tout le contenu du dossier C:\Wswin\html sur « le site » et donc il y envoie le dossier text
J’ai donc envoyé les fichiers php de Chris sur le serveur, dans text
Si quelqu’un a, en plus de me lire, le courage d’aller voir à cette adresse(http://www.meteo-landeda.org/text/climatoa.php) et de m’expliquer ce qu’il se passe, merci à lui.
Jean
Cordialement :Jean
http://www.meteo-landeda.org/
Vantage Pro2
WsWin
FTP-Uploader2.0.3

Avatar du membre
webmaster
Site Admin
Site Admin
Messages : 2611
Enregistré le : 12 déc. 2006, 20:54
Localisation : Rieux 51 FRANCE
Contact :

Re: Fichiers NOAA ....(moi aussi)

Message par webmaster » 21 juin 2013, 06:45

Bonjour,

Je pense que c'est un problème d'encodage durant l'envoi su fichier TXT en FTP.
Regarde si tu vois une option forçant le mode ASCII ou l'inverse, je ne me souviens plus.
Cordialement

Rieux

Tudgur
Participation 6
Participation 6
Messages : 1770
Enregistré le : 13 mai 2007, 16:47
Localisation : 29880 Plouguerneau
Contact :

Re: Fichiers NOAA ....(moi aussi)

Message par Tudgur » 21 juin 2013, 10:45

Salut Jean,
As-tu vu les messages d'erreur ici ?
Cordialement.

Tudgur
http://meteo-plouguerneau.fr" onclick="window.open(this.href);return false;

Landéda
Participation 0
Participation 0
Messages : 34
Enregistré le : 09 déc. 2012, 00:18
Localisation : 29870 Landéda

Re: Fichiers NOAA ....(moi aussi)

Message par Landéda » 21 juin 2013, 11:16

Tugdur bonjour
merci pour ton soutien
"pour ce que j'ai compris" ces deux adresses :
http://www.meteo-landeda.org/text/climatom.php
http://www.meteo-landeda.org/text/clima ... annee=2013
ne provoquent aucun message d'erreur,
le lien que tu donnes conduit à l'adresse suivante: http://www.meteo-landeda.org/text/clima ... 13&mois=01
et provoque le message d'erreur suivant
Warning: fopen(noaa201301.txt) [function.fopen]: failed to open stream: No such file or directory in /web/meteolandeda/www/text/climatom.php on line 104

Warning: filesize() [function.filesize]: stat failed for noaa201301.txt in /web/meteolandeda/www/text/climatom.php on line 105

Warning: fread() expects parameter 1 to be resource, boolean given in /web/meteolandeda/www/text/climatom.php on line 105

"pour ce que j'ai compris" ce problème vient si on cherche des infos sur le premier mois de 2013 :(2013&mois=01 dans ton lien, ou bien :stat failed for noaa201301.tx dans le message d'erreur) alors que mes rapports noaa commencent en mars 2013, date qui doit correspondre à ton coup de main à domicile ?
Quand penses tu ????
Cordialement :Jean
http://www.meteo-landeda.org/
Vantage Pro2
WsWin
FTP-Uploader2.0.3

Tudgur
Participation 6
Participation 6
Messages : 1770
Enregistré le : 13 mai 2007, 16:47
Localisation : 29880 Plouguerneau
Contact :

Re: Fichiers NOAA ....(moi aussi)

Message par Tudgur » 21 juin 2013, 17:20

Ach ! Kolossal ech'eur ! Fousillé demain matin à l'aube !
J'avais effectivement oublié ce détail...
Et donc pour mars, il n'y a pas ces erreurs.
As-tu essayé, comme le dit Rieux, de transférer tes fichiers en binaire ?
Cordialement.

Tudgur
http://meteo-plouguerneau.fr" onclick="window.open(this.href);return false;

Avatar du membre
webmaster
Site Admin
Site Admin
Messages : 2611
Enregistré le : 12 déc. 2006, 20:54
Localisation : Rieux 51 FRANCE
Contact :

Re: Fichiers NOAA ....(moi aussi)

Message par webmaster » 21 juin 2013, 20:16

Bonsoir,

Je viens de prendre ton fichier 2013 et chez moi il fonctionne.
D'où vient le fichier PHP que tu utilises, chriss également ?
Cordialement

Rieux

Landéda
Participation 0
Participation 0
Messages : 34
Enregistré le : 09 déc. 2012, 00:18
Localisation : 29870 Landéda

Re: Fichiers NOAA ....(moi aussi)

Message par Landéda » 21 juin 2013, 22:06

Pour Tugdur:
Ach la guerre gross malheur
Mon problème c'est pas les messages d'erreur, mais le fait que pour l'année 2013 ou les mois existants: 3,4,5,6 il ne se passe rien ????
danke schoen et auf wiedersen

Pour Rieux : ni dieu ni webmaster,
mais tout de même je me suis dit il est fort le Webmaster comment il a fait :
Je viens de prendre ton fichier 2013
mais comme tu connais le nom et l'adresse !bon sang mais c'est bien sur.
Merci d'avoir essayé , les PHP ils viennent de l'adresse indiquée par Tugdur dans le sujet précédent : http://www.plevenon-meteo.info/tags/com ... limato.zip
donc de chez Chriss si j'en crois le fichier d'aide
Merci encore
Cordialement :Jean
http://www.meteo-landeda.org/
Vantage Pro2
WsWin
FTP-Uploader2.0.3

Avatar du membre
webmaster
Site Admin
Site Admin
Messages : 2611
Enregistré le : 12 déc. 2006, 20:54
Localisation : Rieux 51 FRANCE
Contact :

Re: Fichiers NOAA ....(moi aussi)

Message par webmaster » 21 juin 2013, 22:34

Essaie avec ce script là pour voir:

Code : Tout sélectionner

<?php
################################################
#Variables définissant l'année ˆ partir de laquelle les rapports noaaAAAA.txt sont disponibles
################################################

$anneedebut = 2013;
################################################

$yearstr=$_GET['annee'];
$today = getdate();

if ($yearstr=='') {
  $yearstr = str_pad($today[year], 4, "0", STR_PAD_LEFT);
  
}

$nextyear = $yearstr+1;
$disablenext = '';
$disableprev = '';

if ($nextyear==$today['year']+1) {
$nextyear = $today['year'];
$disablenext="disabled='disabled'";
}

$prevyear = $yearstr-1;



if ($prevyear==$anneedebut-1)  {
$prevyear = $anneedebut;
$disableprev="disabled='disabled'";
}


$fichier="noaa".$yearstr.".txt";
$title="Relevés de l'annŽe en cours";
echo"
<head>
<title>Climatologie annuelle</title>
<script type='text/javascript'>

function donoaaprevyear()  {

var yearv='$prevyear'

mypath='climatoa.php?annee='+yearv

document.location.href=mypath
}

function moisnoaa()  {


mypath='climatom.php'

document.location.href=mypath
}

function donoaanextyear()  {
var yearv1='$nextyear'

mypath='climatoa.php?annee='+yearv1

document.location.href=mypath
}

</script>

</head>

"
;

$fp = fopen ("$fichier",'r');
$content = fread ($fp,filesize($fichier));

$separ_1 = explode("----------
",$content);
$separ_2 = explode("
----------",$separ_1[1]);
$table1 =$separ_2[0];
$total1 = $separ_1[2];

$separ_3 = explode("
----------",$separ_1[3]);
$table2 = $separ_3[0];
$total2 = $separ_1[4];
$separ_4 = explode("
----------",$separ_1[5]);
$table3 = $separ_4[0];
$total3 = $separ_1[6];
$separ_5 = explode("
----------",$separ_1[7]);
$table4 = $separ_5[0];
$total4 = $separ_1[8];
$linetitle= explode("
",$separ_1[0]);

$char = array (" ","W");
$newchar = array ("","O");

########################################
#Récupération des moyennes annuelles de temperature ##
########################################
$title1=trim($linetitle[0]);
$title2=trim($linetitle[2]);
$annee=$_GET['annee'];
$min1=$yearstr.'_1';
$min2=$yearstr.'_2';
$item_m = explode(",",$total1);
$meantemp_m = $item_m[1];
$lowtempmean_m = $item_m[2];
$lowtemp_m = $item_m[3];
$hourlowtemp_m = $item_m[4];
$monthlowtemp_m = $item_m[5];
$highttempmean_m = $item_m[6];
$highttemp_m = $item_m[7];
$hourhighttemp_m = $item_m[8];
$monthhighttemp_m = $item_m[9];
$icedays_m = $item_m[10];
$colddays_m = $item_m[11];
$cooldays_m = $item_m[12];
$summerdays_m = $item_m[13];
$heatdays_m = $item_m[14];



########################################
#Récupération des données journalieres##
########################################

$nb = substr_count ($table1, "
");

$ligne ="";
$color = array('#ffffff','#ffff00','#ff00ff','#ffffff');
$gel=0;
$fortgel=0;
$sansdegel=0;
$chaleur=0;
$canicule=0;
$pluie=0;
$pluie_1=0;
$pluie_5=0;
$pluie_10=0;
$maxrain=0;
$replow=array(' ',' ');
$rephight=array(' ',' ');
$repmean=array(' ',' ');


$line = explode("
",$table1);

for ($i=0; $i<$nb+1; $i++)

{
#selection ligne

$item = explode(",",$line[$i]);
#séparation et classement des valeurs
$mois = $item[0];
$meantemp = $item[1];
$lowtempmean = $item[2];
$lowtemp = $item[3];
$hourlowtemp = $item[4];
$daylowtemp = $item[5];
$highttempmean = $item[6];
$highttemp = $item[7];
$hourhighttemp = $item[8];
$dayhighttemp = $item[9];
$icedays = $item[10];
$colddays = $item[11];
$cooldays = $item[12];
$summerdays = $item[13];
$heatdays = $item[14];


$tempe = array($meantemp,$lowtempmean,$lowtemp,$highttempmean,$highttemp);
$color = array('#ff0000','#ffff00','#ff00ff','#ff00ff','#ffff00');
$white = array (0,0,0,0,0);
for ($c=0; $c<count($tempe); $c++)

{

#colorisation température
if($tempe[$c] <= '-25') {$color[$c]='#003366';}
elseif($tempe[$c] > '-25' && $tempe[$c] <= '-20')  {$color[$c]='#003399'; $white[$c]=1;}
elseif($tempe[$c] > '-20' && $tempe[$c] <= '-15')  {$color[$c]='#0000cc'; $white[$c]=1;}
elseif($tempe[$c] > '-15' && $tempe[$c] <= '-10')  {$color[$c]='#0000ff'; $white[$c]=1;}
elseif($tempe[$c] > '-10' && $tempe[$c] <= '-5')  {$color[$c]='#0099ff'; $white[$c]=0;}
elseif($tempe[$c] > '-5' && $tempe[$c] <= '0')  {$color[$c]='#66ffff'; $white[$c]=0; }
elseif($tempe[$c] > '0' && $tempe[$c] <= '5')  {$color[$c]='#66ff99'; $white[$c]=0; }
elseif($tempe[$c] > '5' && $tempe[$c] <= '10')  {$color[$c]='#66ff00'; $white[$c]=0;}
elseif($tempe[$c] > '10' && $tempe[$c] <= '15')  {$color[$c]='#ffff00'; $white[$c]=0; }
elseif($tempe[$c] > '15' && $tempe[$c] <= '20')  {$color[$c]='#ffcc00'; $white[$c]=0; }
elseif($tempe[$c] > '20' && $tempe[$c] <= '25')  {$color[$c]='#ff9900'; $white[$c]=0; }
elseif($tempe[$c] > '25' && $tempe[$c] <= '30')  {$color[$c]='#ff6600'; $white[$c]=0; }
elseif($tempe[$c] > '30' && $tempe[$c] <= '35')  {$color[$c]='#ff3300'; $white[$c]=0; }
elseif($tempe[$c] > '35' && $tempe[$c] <= '40')  {$color[$c]='#cc0000'; $white[$c]=0;}
elseif($tempe[$c] > '40')  {$color[$c]='#660000'; $white[$c]=0;}
else {$color[$c]='#ff00ff';}


}

#repère des extremes
$replow=array('','');
$rephight=array('','');
$repmean=array('','');
$colortext=array('','','','','','');

for ($c=0; $c<5; $c++)
{
	if ($white[$c]==1) {$colortext[$c]='color="white"';}
	else {$colortext[$c]='';}
}

if ($lowtemp == $lowtemp_m) {$replow = array("<b>","</b></font>");}
if ($highttemp == $highttemp_m) {$rephight = array("<b>","</b></font>");}
switch($mois)
  {
  case "janvier":
    $monthnum="01";
    break;
  case "février":
    $monthnum="02";
    break;
  case "mars":
    $monthnum="03";
    break;
  case "avril":
    $monthnum="04";
    break;
  case "mai":
    $monthnum="05";
    break;
  case "juin":
    $monthnum="06";
    break;
  case "juillet":
    $monthnum="07";
    break;
  case "août":
    $monthnum="08";
    break;
  case "septembre":
    $monthnum="09";
    break;
  case "octobre":
    $monthnum="10";
    break;
  case "novembre":
    $monthnum="11";
    break;
  case "décembre":
    $monthnum="12";
    break;
                  }

#incrémentation du tableau
if ($meantemp != ""){

$ligne .= "<tr >
              <td  align='center'><font color='white'><a href='climatom.php?annee=$yearstr&mois=$monthnum' target='_self'>$mois</a></td>
              <td  bgcolor='$color[2]' width='150' align='center'><font $colortext[2]> $replow[0] $lowtemp °C le $daylowtemp à $hourlowtemp $replow[1] </td>
              <td  bgcolor='$color[1]' width='65' align='center'><font $colortext[1]> $lowtempmean °C </td>
	          <td  bgcolor='$color[0]' width='65' align='center'><font $colortext[0]> $meantemp °C </td> 
	          <td  bgcolor='$color[3]' width='65' align='center' ><font $colortext[3]> $highttempmean °C </td>
              <td  bgcolor='$color[4]' width='150' align='center'><font $colortext[4]>$rephight[0] $highttemp °C le $dayhighttemp à $hourhighttemp $rephight[1]</td>
	          <td  width='55' align='center'><font> $icedays</td>
	          <td  width='55' align='center'><font> $colddays</td>
	          <td  width='55' align='center'><font> $heatdays</td>
             </tr>
              ";}

}
$ligne2="";
########################################
#Récupération desnormales temp ##
########################################
$item_m = explode(",",$total2);
$temp_m = $item_m[1];
$normtemp_m = $item_m[2];
$tempdev_m = $item_m[3];
$sun_m = $item_m[8];
$normsun_m = $item_m[9];
$ecartsun_m = $item_m[10];
$sunpou_m = $item_m[11];



$nb = substr_count ($table2, "
");
$line2 = explode("
",$table2);

for ($i=0; $i<$nb+1; $i++)

{
#selection ligne

$item = explode(",",$line2[$i]);
#séparation et classement des valeurs
$mois = $item[0];
$temp = $item[1];
$normtemp = $item[2];
$tempdev = $item[3];



$tempe = array($temp,$normtemp);


$color2 = array('#ff0000','#ffff00');
$color3 = array('#ff0000','#ffff00');
$white2 = array (0,0,0,0,0);
$white3 = array (0,0,0,0,0);
$color = array('#ff0000','#ffff00','#ff00ff','#ff00ff','#ffff00');
$white = array (0,0,0,0,0);
for ($c=0; $c<count($tempe); $c++)

{

#colorisation température
if($tempe[$c] <= '-25') {$color[$c]='#003366';}
elseif($tempe[$c] > '-25' && $tempe[$c] <= '-20')  {$color[$c]='#003399'; $white[$c]=1;}
elseif($tempe[$c] > '-20' && $tempe[$c] <= '-15')  {$color[$c]='#0000cc'; $white[$c]=1;}
elseif($tempe[$c] > '-15' && $tempe[$c] <= '-10')  {$color[$c]='#0000ff'; $white[$c]=1;}
elseif($tempe[$c] > '-10' && $tempe[$c] <= '-5')  {$color[$c]='#0099ff'; $white[$c]=0;}
elseif($tempe[$c] > '-5' && $tempe[$c] <= '0')  {$color[$c]='#66ffff'; $white[$c]=0; }
elseif($tempe[$c] > '0' && $tempe[$c] <= '5')  {$color[$c]='#66ff99'; $white[$c]=0; }
elseif($tempe[$c] > '5' && $tempe[$c] <= '10')  {$color[$c]='#66ff00'; $white[$c]=0;}
elseif($tempe[$c] > '10' && $tempe[$c] <= '15')  {$color[$c]='#ffff00'; $white[$c]=0; }
elseif($tempe[$c] > '15' && $tempe[$c] <= '20')  {$color[$c]='#ffcc00'; $white[$c]=0; }
elseif($tempe[$c] > '20' && $tempe[$c] <= '25')  {$color[$c]='#ff9900'; $white[$c]=0; }
elseif($tempe[$c] > '25' && $tempe[$c] <= '30')  {$color[$c]='#ff6600'; $white[$c]=0; }
elseif($tempe[$c] > '30' && $tempe[$c] <= '35')  {$color[$c]='#ff3300'; $white[$c]=0; }
elseif($tempe[$c] > '35' && $tempe[$c] <= '40')  {$color[$c]='#cc0000'; $white[$c]=0;}
elseif($tempe[$c] > '40')  {$color[$c]='#660000'; $white[$c]=0;}
else {$color[$c]='#ff00ff';}
}

#repère des extremes
$replow=array('','');
$rephight=array('','');
$repmean=array('','');
$colortext=array('','','','','','');

for ($c=0; $c<2; $c++)
{
	if ($white[$c]==1) {$colortext[$c]='color="white"';}
	else {$colortext[$c]='';}
	if ($white2[$c]==1) {$colortext2[$c]='color="white"';}
	else {$colortext2[$c]='';}
	if ($white3[$c]==1) {$colortext3[$c]='color="white"';}
	else {$colortext3[$c]='';}
}
if ($tempdev == 0) {$devcolor='';};
if($tempdev < 0) {$devcolor="bgcolor='#66ffff'";}
else {$devcolor="bgcolor='#ff6600'";};

switch($mois)
  {
  case "janvier":
    $monthnum="01";
    $lastday="31";
    break;
  case "février":
    $monthnum="02";
    $lastday="28";
    break;
  case "mars":
    $monthnum="03";
    $lastday="31";
    break;
  case "avril":
    $monthnum="04";
    $lastday="30";
    break;
  case "mai":
    $monthnum="05";
    $lastday="31";
    break;
  case "juin":
    $monthnum="06";
    $lastday="30";
    break;
  case "juillet":
    $monthnum="07";
    $lastday="31";
    break;
  case "août":
    $monthnum="08";
    $lastday="31";
    break;
  case "septembre":
    $monthnum="09";
    $lastday="30";
    break;
  case "octobre":
    $monthnum="10";
    $lastday="31";
    break;
  case "novembre":
    $monthnum="11";
    $lastday="30";
    break;
  case "décembre":
    $monthnum="12";
    $lastday="31";
    break;
                  }

#incrémentation du tableau
if ($temp != ""){

$ligne2 .= "<tr >
              <td  align='center'><font color='white'><a href='climatom.php?annee=$yearstr&mois=$monthnum' target='_self'>$mois</a></td>
              <td  bgcolor='$color[0]' width='65' align='center'><font $colortext[0]> $temp °C </td>
              <td  bgcolor='$color[1]' width='65' align='center'><font $colortext[1]> $normtemp °C </td>
              <td  $devcolor width='70' align='center'><font> $tempdev °C</td>
           </tr>

";}

}

$ligne3="";
########################################
#Récupération des moyennes annuelles de pluie ##
########################################
$item_m = explode(",",$total3);
$rain_m = $item_m[3];
$normrain_m = $item_m[1];
$raindev_m = $item_m[2];
$dayrain_m = $item_m[4];
$dayrain20_m = $item_m[6];
$rainpou_m = $item_m[7];

$nb = substr_count ($table3, "
");
$line3 = explode("
",$table3);

for ($i=0; $i<$nb+1; $i++)

{
#selection ligne

$item = explode(",",$line3[$i]);
#séparation et classement des valeurs
$mois = $item[0];
$normrain = $item[1];
$raindev = $item[2];
$rain = $item[3];
$dayrain = $item[4];
$dayrain2 = $item[5];
$dayrain20 = $item[6];
$rainpou = $item[7];


#colorisation pluie
if($rain > '0' && $rain < '20')  {$color[3]='#00fe96'; $white[3]=0;}
elseif($rain >= '20' && $rain < '40')  {$color[3]='#00fefe'; $white[3]=0;}
elseif($rain >= '40' && $rain < '60')  {$color[3]='#00c8fe'; $white[3]=0;}
elseif($rain >= '60' && $rain < '80')  {$color[3]='#0096fe'; $white[3]=0; }
elseif($rain >= '80' && $rain < '100')  {$color[3]='#0064fe'; $white[3]=1; }
elseif($rain >= '100' && $rain < '120')  {$color[3]='#3200fe'; $white[3]=1; }
elseif($rain >= '120' && $rain < '140')  {$color[3]='#6400fe'; $white[3]=1;}
elseif($rain >= '140' && $rain < '160')  {$color[3]='#9600fe'; $white[3]=1; }
elseif($rain >= '160' && $rain < '180')  {$color[3]='#c800fe'; $white[3]=1; }
elseif($rain >= '180')  {$color[]='#640064'; $white[3]=1;}
else {$color[3]='#ffffff'; $white[3]=0;}


#repère des extremes
$replow=array('','');
$rephight=array('','');
$repmean=array('','');
$colortext=array('','','','','','');


	if ($white[3]==1) {$colortext[3]='color="white"';}
	else {$colortext[3]='';}
if ($raindev == 0) {$devcolor='';};
if($raindev > 0) {$devcolor="bgcolor='#66ffff'";}
else {$devcolor="bgcolor='#ff6600'";}

switch(trim($mois))
  {
  case "janvier":
    $monthnum="01";
    break;
  case "février":
    $monthnum="02";
    break;
  case "mars":
    $monthnum="03";
    break;
  case "avril":
    $monthnum="04";
    break;
  case "mai":
    $monthnum="05";
    break;
  case "juin":
    $monthnum="06";
    break;
  case "juillet":
    $monthnum="07";
    break;
  case "août":
    $monthnum="08";
    break;
  case "septembre":
    $monthnum="09";
    break;
  case "octobre":
    $monthnum="10";
    break;
  case "novembre":
    $monthnum="11";
    break;
  case "décembre":
    $monthnum="12";
    break;
                  }

#incrémentation du tableau
if ($rain != ""){

$ligne3 .= "<tr >
              <td  align='center'><font color='white'><a href='climatom.php?annee=$yearstr&mois=$monthnum' target='_self'>$mois</a></td>
              <td  bgcolor='$color[3]' width='65' align='center'><font $colortext[3]> $rain mm </td>
              <td  width='65' align='center'><font> $dayrain</td>
	          <td  width='65' align='center'><font>$dayrain20</td>
	          <td  width='65' align='center'><font> $normrain mm</td>
	          <td  $devcolor width='65' align='right'><font> $raindev mm</td>
	          <td  $devcolor width='65' align='right'><font> $rainpou %</td>
	        </tr>
              ";}

}
$ligne4="";
########################################
#Récupération des moyennes annuelles de vent ##
########################################
$item_m = explode(",",$total4);
$vent_m = $item_m[1];
$ventmax_m = $item_m[2];
$ventmaxday_m = $item_m[4];
$secteur_m = $item_m[8];
$secteur_m=trim($secteur_m);
$gustmax_m = $item_m[5];
$gustmaxday_m = $item_m[7];


$nb = substr_count ($table4, "
");
$line4 = explode("
",$table4);

for ($i=0; $i<$nb+1; $i++)

{
#selection ligne

$item = explode(",",$line4[$i]);
#séparation et classement des valeurs
$mois = $item[0];
$vent = $item[1];
$ventmax = $item[2];
$ventmaxday = $item[4];
$ventmaxhour = $item[3];
$secteur = $item[8];
$secteur = trim($secteur);
$gustmax = $item[5];
$gustmaxday = $item[7];
$gustmaxhour = $item[6];



#colorisation vent
if($vent < '10' )  {$color[0]='#ffffff';}
elseif($vent >= '10' && $vent < '20')  {$color[0]='#ebebeb'; $white[0]=0;}
elseif($vent >= '20' && $vent < '30')  {$color[0]='#d7d7d7'; $white[0]=0;}
elseif($vent >= '30' && $vent < '40')  {$color[0]='#c4c4c4'; $white[0]=0; }
elseif($vent >= '40' && $vent < '50')  {$color[0]='#afafaf'; $white[0]=0; }
elseif($vent >= '50' && $vent < '60')  {$color[0]='#AB8787'; $white[0]=0; }
elseif($vent >= '60' && $vent < '70')  {$color[0]='#D07676'; $white[0]=0;}
elseif($vent >= '70' )  {$color[0]='#ff0000'; $white[0]=0; }
else {$color[0]='#222222';}

if($ventmax < '10' )  {$color[1]='#ffffff';}
elseif($ventmax >= '10' && $ventmax < '20')  {$color[1]='#ebebeb'; $white[1]=0;}
elseif($ventmax >= '20' && $ventmax < '30')  {$color[1]='#d7d7d7'; $white[1]=0;}
elseif($ventmax >= '30' && $ventmax < '40')  {$color[1]='#c4c4c4'; $white[1]=0; }
elseif($ventmax >= '40' && $ventmax < '50')  {$color[1]='#afafaf'; $white[1]=0; }
elseif($ventmax >= '50' && $ventmax < '60')  {$color[1]='#AB8787'; $white[1]=0; }
elseif($ventmax >= '60' && $ventmax < '70')  {$color[1]='#D07676'; $white[1]=0;}
elseif($ventmax >= '70' )  {$color[1]='#ff0000'; $white[1]=0; }
else {$color[1]='#222222';}

if($gustmax < '10' )  {$color[2]='#ffffff';}
elseif($gustmax >= '10' && $gustmax < '20')  {$color[2]='#ebebeb'; $white[2]=0;}
elseif($gustmax >= '20' && $gustmax < '30')  {$color[2]='#d7d7d7'; $white[2]=0;}
elseif($gustmax >= '30' && $gustmax < '40')  {$color[2]='#c4c4c4'; $white[2]=0; }
elseif($gustmax >= '40' && $gustmax < '50')  {$color[2]='#afafaf'; $white[2]=0; }
elseif($gustmax >= '50' && $gustmax < '60')  {$color[2]='#AB8787'; $white[2]=0; }
elseif($gustmax >= '60' && $gustmax < '70')  {$color[2]='#D07676'; $white[2]=0;}
elseif($gustmax >= '70' )  {$color[2]='#ff0000'; $white[2]=0; }
else {$color[2]='#222222';}

#repère des extremes
$replow=array('','');
$rephight=array('','');
$repmean=array('','');
$colortext=array('','','','','','');

for ($c=0; $c<3; $c++)
{
	if ($white[$c]==1) {$colortext[$c]='color="white"';}
	else {$colortext[$c]='';}
}

if ($ventmax == $ventmax_m) {$replow = array("<b>","</b></font>");}
if ($gustmax == $gustmax_m) {$rephight = array("<b>","</b></font>");}

switch(trim($mois))
  {
  case "janvier":
    $monthnum="01";
    break;
  case "février":
    $monthnum="02";
    break;
  case "mars":
    $monthnum="03";
    break;
  case "avril":
    $monthnum="04";
    break;
  case "mai":
    $monthnum="05";
    break;
  case "juin":
    $monthnum="06";
    break;
  case "juillet":
    $monthnum="07";
    break;
  case "août":
    $monthnum="08";
    break;
  case "septembre":
    $monthnum="09";
    break;
  case "octobre":
    $monthnum="10";
    break;
  case "novembre":
    $monthnum="11";
    break;
  case "décembre":
    $monthnum="12";
    break;
                  }
#incrémentation du tableau
if ($vent != ""){

$ligne4 .= "<tr >
              <td  align='center'><font color='white'><a href='climatom.php?annee=$yearstr&mois=$monthnum' target='_self'>$mois</a></td>
              <td  bgcolor='$color[0]' width='80' align='center'><font $colortext[0]> $vent km/h </td>
              <td  bgcolor='$color[1]' width='180' align='center'><font $colortext[1]>$replow[0] $ventmax km/h le $ventmaxday à $ventmaxhour $replow[1]</td>
	      <td  bgcolor='#ffffff' width='70' align='center'><font><font  ><img src='pictos/$secteur.gif'/>$secteur</td>	          
	        </tr>
              ";}

}

#################
#affichage final#
#################
echo "

<body bgcolor='#D6D6D6' text='black' link='blue' vlink='purple' alink='red' background='../images/00_bg1.jpg'>
<p align='center'><span style='font-size:22pt'><font face='Comic Sans MS' color='#009900'><b>$title1</b></font></span></p>
<font>$title2 </font><br><br>
<input onclick='donoaaprevyear();' type='button' $disableprev name='nooaprev'id='nooaprev' value='Ann&eacute;e pr&eacute;c&eacute;dente' >
<input onclick='donoaanextyear();' type='button' $disablenext name='nooanext'id='nooanext' value='Ann&eacute;e suivante' >
<input onclick='moisnoaa();' type='button' value='Climatologie mois' >
<form name='date' method='GET' action='redirclimatoa.php'>
<font face='Comic Sans MS'>Recherche 
    d'une année:</font>
<select name='annee' size='1'>";
$today = getdate();
$year = $today[year];
echo" <option>Année</option>";
for ($i=$anneedebut;$i <= $year; $i=$i+1){echo "<option value='$i'>$i</option>";
 }
echo"
    </select>
<input type='submit' name='AFFICHER' value='Afficher'>
</form>
</p>
<table style='border-collapse: collapse' border='1' bordercolor='#000000'>

<tr bgcolor='gray'>
<td align='center' rowspan='2'><font color='white'><b>Mois</b></font></td>
<td colspan='5' align='center'><font color='white'><b>Température</b></font></td>
<td align='center'><font color='white'>Jours</font></td>
<td align='center'><font color='white'>Jours</font></td>
<td align='center'><font color='white'>Jours</font></td>
</tr>

<tr bgcolor='gray'>

              <td align='center'><font color='white'>minimum</font></td>
              <td align='center'><font color='white'>moy min</font></td>
              <td align='center'><font color='white'>moyenne</font></td>
              <td align='center'><font color='white'>moy max</font></td>
              <td align='center'><font color='white'>maximum</font></td>
              <td align='center'><font color='white'>sans dégel</font></td>
              <td align='center'><font color='white'>de gel</font></td>
              <td align='center'><font color='white'>(Tmax >30°C)</font></td>

             </tr>

$ligne

<tr bgcolor='gray'>
<td><font color='white'><b>   </b></font></td>
<td align='center' border='2'><font color='white'>$lowtemp_m °C</font></td>
<td align='center'><font color='white'>$lowtempmean_m °C</font></td>
<td align='center'><font color='white'>$meantemp_m °C</font></td>
<td align='center'><font color='white'>$highttempmean_m °C</font></td>
<td align='center'><font color='white'>$highttemp_m °C</font></td>
<td align='center'><font color='white'>$icedays_m</font></td>
<td align='center'><font color='white'>$colddays_m</font></td>
<td align='center'><font color='white'>$heatdays_m</font></td>

</tr>
</table>
<p> </p>
<p> </p>

<table style='border-collapse: collapse' border='1' bordercolor='#000000'>

<tr bgcolor='gray'>
<td align='center' rowspan='2'><font color='white'><b>Mois</b></font></td>
<td colspan='3' align='center'><font color='white'><b>Temp&eacute;rature</b></font></td>

</tr>

<tr bgcolor='gray'>

              <td width='50' align='center'><font color='white'>&nbsp;moyenne&nbsp;</font></td>
              <td align='center'><font color='white'>&nbsp;normale&nbsp;</font></td>
              <td align='center'><font color='white'>&nbsp;&eacute;cart de la normale&nbsp;</font></td>
             </tr>

$ligne2

<tr bgcolor='gray'>
<td><font color='white'><b>   </b></font></td>
<td align='center' border='2'><font color='white'>$temp_m °C</font></td>
<td align='center'><font color='white'>$normtemp_m °C</font></td>
<td align='right'><font color='white'>$tempdev_m °C</font></td>
</tr>
</table>
<p> </p>
<p> </p>

<table style='border-collapse: collapse' border='1' bordercolor='#000000'>

<tr bgcolor='gray'>
<td align='center' rowspan='2'><font color='white'><b>Mois</b></font></td>
<td colspan='6' align='center'><font color='white'><b>Pluie</b></font></td>
</tr>

<tr bgcolor='gray'>

              <td width='50' align='center'><font color='white'>&nbsp;pluie totale&nbsp;</font></td>
              <td align='center'><font color='white'>&nbsp;jours pluie&nbsp;</font></td>
              <td align='center'><font color='white'>&nbsp;jours >20mm&nbsp;</font></td>
              <td align='center'><font color='white'>&nbsp;normale&nbsp;</font></td>
              <td align='center'><font color='white'>&nbsp;&eacute;cart de la normale&nbsp;</font></td>
              <td align='center'><font color='white'>%</font></td>
             </tr>

$ligne3

<tr bgcolor='gray'>
<td><font color='white'><b>   </b></font></td>
<td align='center' border='2'><font color='white'>$rain_m mm</font></td>
<td align='center'><font color='white'>$dayrain_m</font></td>
<td align='center'><font color='white'>$dayrain20_m</font></td>
<td align='center'><font color='white'>$normrain_m mm</font></td>
<td align='right'><font color='white'>$raindev_m mm</font></td>
<td align='right'><font color='white'>$rainpou_m %</font></td>
</tr>
</table>
<p> </p>
<p> </p>
<table style='border-collapse: collapse' border='1' bordercolor='#000000'>

<tr bgcolor='gray'>
<td align='center' rowspan='2'><font color='white'><b>Mois</b></font></td>
<td colspan='8' align='center'><font color='white'><b>Vent</b></font></td>
</tr>

<tr bgcolor='gray'>

              <td align='center'><font color='white'>vent moyen</font></td>
              <td align='center'><font color='white'>rafale</font></td>
              <td align='center'><font color='white'>secteur</font></td>


             </tr>

$ligne4

<tr bgcolor='gray'>
<td><font color='white'><b>   </b></font></td>
<td align='center' border='2'><font color='white'>$vent_m km/h</font></td>
<td align='center'><font color='white'>$ventmax_m km/h</font></td>
<td align='center'><font color='white'><img src='pictos/$secteur_m.gif'/>$secteur_m</font></td>
</tr>
</table>
";

?>

Cordialement

Rieux

Landéda
Participation 0
Participation 0
Messages : 34
Enregistré le : 09 déc. 2012, 00:18
Localisation : 29870 Landéda

Re: Fichiers NOAA ....(moi aussi)

Message par Landéda » 21 juin 2013, 23:05

J'ai changé le script mais toujours aucun affichage :
http://www.meteo-landeda.org/text/clima ... annee=2013
???
Modifié en dernier par Landéda le 22 juin 2013, 23:46, modifié 1 fois.
Cordialement :Jean
http://www.meteo-landeda.org/
Vantage Pro2
WsWin
FTP-Uploader2.0.3

Avatar du membre
vals
Participation 5
Participation 5
Messages : 833
Enregistré le : 13 déc. 2006, 20:27
Localisation : 69320 Feyzin
Contact :

Re: Fichiers NOAA ....(moi aussi)

Message par vals » 22 juin 2013, 00:23

Bonjour.
Avec ftp-uploader 1.4 j'avais eu ce même genre de problème.
La solution que j'avais trouvé:
Dans Projekte \Projektverwaltung onglet FTP-Programm
La case Einstellungen für den FTP-Uploader zum Transfermode Auto
Il faut rajouter ;txt
Il y a peut-être la même chose dans la version 2.0.3 ??
Image
Davis VantagePro2 + Wswin32 V2.96.10 + GraphWeather + ftp-uploader. Webcam.

Avatar du membre
webmaster
Site Admin
Site Admin
Messages : 2611
Enregistré le : 12 déc. 2006, 20:54
Localisation : Rieux 51 FRANCE
Contact :

Re: Fichiers NOAA ....(moi aussi)

Message par webmaster » 22 juin 2013, 08:55

Landéda a écrit :J'ai changé le script mais toujours aucun affichage :
http://www.meteo-landeda.org/text/clima ... annee=2013
???
Là je ne comprends pas car si je prends ton fichier TXT et le code que j'ai posté hier, ça donne ceci:
http://www.rieux-marne.net/test.php?annee=2013

Je vais regarder si je retrouve le code original, mais le problème est pour moi ailleurs.
Attendons de voir ce qu'il se passe dans le post voisin.
Cordialement

Rieux

Landéda
Participation 0
Participation 0
Messages : 34
Enregistré le : 09 déc. 2012, 00:18
Localisation : 29870 Landéda

Re: Fichiers NOAA ....(moi aussi)

Message par Landéda » 22 juin 2013, 15:47

Petit bilan provisoire:
  • J'ai pas encore fini d'explorer la piste FTP Uploader proposée par Vals, merci à lui .
  • Chez Rieux ça marche, avec ses fichiers bien sur mais aussi avec les miens.
  • Chez moi ça ne marche ni avec le script de Chris ni avec celui de Rieux , mais dans les deux cas ce sont mes fichiers noaa**** qui sont utilisés .
  • Il me semble qu'il reste a essayer: chez moi des fichiers noaa fournis par l'un d'entre vous ?
    Si quelqu'un peut me fournir ça merci à lui
Cordialement :Jean
http://www.meteo-landeda.org/
Vantage Pro2
WsWin
FTP-Uploader2.0.3

Avatar du membre
webmaster
Site Admin
Site Admin
Messages : 2611
Enregistré le : 12 déc. 2006, 20:54
Localisation : Rieux 51 FRANCE
Contact :

Re: Fichiers NOAA ....(moi aussi)

Message par webmaster » 22 juin 2013, 17:34

Essaie avec ce fichier:
http://www.rieux-marne.net/noaa2013.txt
Et ce code:

Code : Tout sélectionner

	
		<div id="contenu">

<?php
################################################
#Variables définissant l'année a partir de laquelle les rapports noaaAAAA.txt sont disponibles
################################################

$anneedebut = '2006';
################################################

$yearstr=$_GET['annee'];
$today = getdate();

if ($yearstr=='') {
  $yearstr = str_pad($today[year], 4, "0", STR_PAD_LEFT);
  
}

$nextyear = $yearstr+1;
$disablenext = '';
$disableprev = '';

if ($nextyear==$today['year']+1) {
$nextyear = $today['year'];
$disablenext="disabled='disabled'";
}

$prevyear = $yearstr-1;



if ($prevyear==$anneedebut-1)  {
$prevyear = $anneedebut;
$disableprev="disabled='disabled'";
}


$fichier="noaa".$yearstr.".txt";
$title="Relevés de l'année en cours";



$fp = fopen ("$fichier",'r');
$content = fread ($fp,filesize("$fichier"));

$separ_1 = explode("----------
",$content);
$separ_2 = explode("
----------",$separ_1[1]);
$table1 =$separ_2[0];
$total1 = $separ_1[2];

$separ_3 = explode("
----------",$separ_1[3]);
$table2 = $separ_3[0];
$total2 = $separ_1[4];
$separ_4 = explode("
----------",$separ_1[5]);
$table3 = $separ_4[0];
$total3 = $separ_1[6];
$separ_5 = explode("
----------",$separ_1[7]);
$table4 = $separ_5[0];
$total4 = $separ_1[8];
$linetitle= explode("
",$separ_1[0]);

$char = array (" ","W");
$newchar = array ("","O");

########################################
#Récupération des moyennes annuelles de temperature ##
########################################
$title1=trim($linetitle[0]);
$title2=trim($linetitle[2]);
$item_m = explode(",",$total1);
$meantemp_m = $item_m[1];
$lowtempmean_m = $item_m[2];
$lowtemp_m = $item_m[3];
$hourlowtemp_m = $item_m[4];
$monthlowtemp_m = $item_m[5];
$highttempmean_m = $item_m[6];
$highttemp_m = $item_m[7];
$hourhighttemp_m = $item_m[8];
$monthhighttemp_m = $item_m[9];
$icedays_m = $item_m[10];
$colddays_m = $item_m[11];
$cooldays_m = $item_m[12];
$summerdays_m = $item_m[13];
$heatdays_m = $item_m[14];



########################################
#Récupération des données journalieres##
########################################

$nb = substr_count ($table1, "
");

$ligne ="";
$color = array('#ffffff','#ffff00','#ff00ff','#ffffff');
$gel=0;
$fortgel=0;
$sansdegel=0;
$chaleur=0;
$canicule=0;
$pluie=0;
$pluie_1=0;
$pluie_5=0;
$pluie_10=0;
$maxrain=0;
$replow=array(' ',' ');
$rephight=array(' ',' ');
$repmean=array(' ',' ');


$line = explode("
",$table1);

for ($i=0; $i<$nb+1; $i++)

{
#selection ligne

$item = explode(",",$line[$i]);
#séparation et classement des valeurs
$mois = $item[0];
$meantemp = $item[1];
$lowtempmean = $item[2];
$lowtemp = $item[3];
$hourlowtemp = $item[4];
$daylowtemp = $item[5];
$highttempmean = $item[6];
$highttemp = $item[7];
$hourhighttemp = $item[8];
$dayhighttemp = $item[9];
$icedays = $item[10];
$colddays = $item[11];
$cooldays = $item[12];
$summerdays = $item[13];
$heatdays = $item[14];


$tempe = array($meantemp,$lowtempmean,$lowtemp,$highttempmean,$highttemp);
$color = array('#ff0000','#ffff00','#ff00ff','#ff00ff','#ffff00');
$white = array (0,0,0,0,0);
for ($c=0; $c<count($tempe); $c++)

{

#colorisation température
if($tempe[$c] <= '-25') {$color[$c]='#cc99ff';}
elseif($tempe[$c] > '-25' && $tempe[$c] <= '-20')  {$color[$c]='#ccccff'; $white[$c]=0;}
elseif($tempe[$c] > '-20' && $tempe[$c] <= '-15')  {$color[$c]='#ccffff'; $white[$c]=0;}
elseif($tempe[$c] > '-15' && $tempe[$c] <= '-10')  {$color[$c]='#00ccff'; $white[$c]=0;}
elseif($tempe[$c] > '-10' && $tempe[$c] <= '-5')  {$color[$c]='#33ccff'; $white[$c]=0;}
elseif($tempe[$c] > '-5' && $tempe[$c] <= '0')  {$color[$c]='#66ccff'; $white[$c]=0; }
elseif($tempe[$c] > '0' && $tempe[$c] <= '5')  {$color[$c]='#99ccff'; $white[$c]=0; }
elseif($tempe[$c] > '5' && $tempe[$c] <= '10')  {$color[$c]='#ccccff'; $white[$c]=0;}
elseif($tempe[$c] > '10' && $tempe[$c] <= '15')  {$color[$c]='#ffcccc'; $white[$c]=0; }
elseif($tempe[$c] > '15' && $tempe[$c] <= '20')  {$color[$c]='#ff9999'; $white[$c]=0; }
elseif($tempe[$c] > '20' && $tempe[$c] <= '25')  {$color[$c]='#ff6699'; $white[$c]=0; }
elseif($tempe[$c] > '25' && $tempe[$c] <= '30')  {$color[$c]='#ff6666'; $white[$c]=0; }
elseif($tempe[$c] > '30' && $tempe[$c] <= '35')  {$color[$c]='#ff3366'; $white[$c]=0; }
elseif($tempe[$c] > '35' && $tempe[$c] <= '40')  {$color[$c]='#ff3333'; $white[$c]=0;}
elseif($tempe[$c] > '40')  {$color[$c]='#ff3300'; $white[$c]=0;}
else {$color[$c]='#ff0000';}
}

#repére des extremes
$replow=array('','');
$rephight=array('','');
$repmean=array('','');
$colortext=array('','','','','','');

for ($c=0; $c<5; $c++)
{
	if ($white[$c]==1) {$colortext[$c]='color="white"';}
	else {$colortext[$c]='';}
}

if ($lowtemp == $lowtemp_m) {$replow = array("<b>","</b></font>");}
if ($highttemp == $highttemp_m) {$rephight = array("<b>","</b></font>");}
switch($mois)
  {
  case "janvier":
    $monthnum="01";
    break;
  case "février":
    $monthnum="02";
    break;
  case "mars":
    $monthnum="03";
    break;
  case "avril":
    $monthnum="04";
    break;
  case "mai":
    $monthnum="05";
    break;
  case "juin":
    $monthnum="06";
    break;
  case "juillet":
    $monthnum="07";
    break;
  case "août":
    $monthnum="08";
    break;
  case "septembre":
    $monthnum="09";
    break;
  case "octobre":
    $monthnum="10";
    break;
  case "novembre":
    $monthnum="11";
    break;
  case "décembre":
    $monthnum="12";
    break;
                  }

#incrémentation du tableau
if ($meantemp != ""){
#erreur premier mois 2005
#if ($monthnum =""){ };
}
$ligne .= "<tr >
              <td  bgcolor='#d4d4d4' align='center'><a href='../mois/noaam.php?annee=$yearstr&mois=$monthnum' target='_self'>$mois</a></td>
              <td  bgcolor='$color[0]' width='65' align='center' onmouseover=\"showtrail('../../../mesures/$yearstr/mini_m$yearstr$monthnum";
$ligne .= "t.gif','','',1,0,0);\" onmouseout='hidetrail();'><font $colortext[0]> $meantemp °C </td>
              <td  bgcolor='$color[1]' width='65' align='center' onmouseover=\"showtrail('../../../mesures/$yearstr/mini_m$yearstr$monthnum";
$ligne .= "t.gif','','',1,0,0);\" onmouseout='hidetrail();'><font $colortext[1]> $lowtempmean °C </td>
	          <td  bgcolor='$color[2]' width='65' align='center' onmouseover=\"showtrail('../../../mesures/$yearstr/mini_m$yearstr$monthnum";
$ligne .= "t.gif','','',1,0,0);\" onmouseout='hidetrail();'><font $colortext[2]>$replow[0] $lowtemp °C $replow[1]</td>
	          <td  width='65' align='center'><font> $daylowtemp </td>
	          <td  width='65' align='center'><font> $hourlowtemp</td>
	          <td  bgcolor='$color[3]' width='65' align='center' onmouseover=\"showtrail('../../../mesures/$yearstr/mini_m$yearstr$monthnum";
$ligne .= "t.gif','','',1,0,0);\" onmouseout='hidetrail();' ><font $colortext[3]> $highttempmean °C </td>
              <td  bgcolor='$color[4]' width='65' align='center' onmouseover=\"showtrail('../../../mesures/$yearstr/mini_m$yearstr$monthnum";
$ligne .= "t.gif','','',1,0,0);\" onmouseout='hidetrail();'><font $colortext[4]>$rephight[0] $highttemp °C $rephight[1]</td>
              <td  width='65' align='center'><font> $dayhighttemp </td>
	          <td  width='65' align='center'><font> $hourhighttemp</td>
	          <td  width='65' align='center'><font> $icedays</td>
	          <td  width='65' align='center'><font> $colddays</td>
	          <td  width='65' align='center'><font> $heatdays</td>
             </tr>
              ";}

$ligne2="";
########################################
#Récupération des normales temp ##
########################################
$item_m = explode(",",$total2);
$temp_m = $item_m[1];
$normtemp_m = $item_m[2];
$tempdev_m = $item_m[3];
$sun_m = $item_m[8];

$nb = substr_count ($table2, "
");
$line2 = explode("
",$table2);

for ($i=0; $i<$nb+1; $i++)

{
#selection ligne

$item = explode(",",$line2[$i]);
#séparation et classement des valeurs
$mois = $item[0];
$temp = $item[1];
$normtemp = $item[2];
$tempdev = $item[3];
$sun = $item[8];
$sun_cent = $item[9];
$sun_norm = $item[10];
$sunpour = $item[10];
$sunpou =0;
$sunpourc = $sunpour - $sunpou;
$sunpource = $item[9] / $sunpourc;
$sunpourcen = $sunpource * 100;
$sunpourcent = round ($sunpourcen);

$tempe = array($temp,$normtemp);
$color = array('#ff0000','#ffff00','#ff00ff','#ff00ff','#ffff00');
$white = array (0,0,0,0,0);
for ($c=0; $c<count($tempe); $c++)

{

#colorisation température
if($tempe[$c] <= '-25') {$color[$c]='#cc99ff';}
elseif($tempe[$c] > '-25' && $tempe[$c] <= '-20')  {$color[$c]='#ccccff'; $white[$c]=0;}
elseif($tempe[$c] > '-20' && $tempe[$c] <= '-15')  {$color[$c]='#ccffff'; $white[$c]=0;}
elseif($tempe[$c] > '-15' && $tempe[$c] <= '-10')  {$color[$c]='#00ccff'; $white[$c]=0;}
elseif($tempe[$c] > '-10' && $tempe[$c] <= '-5')  {$color[$c]='#33ccff'; $white[$c]=0;}
elseif($tempe[$c] > '-5' && $tempe[$c] <= '0')  {$color[$c]='#66ccff'; $white[$c]=0; }
elseif($tempe[$c] > '0' && $tempe[$c] <= '5')  {$color[$c]='#99ccff'; $white[$c]=0; }
elseif($tempe[$c] > '5' && $tempe[$c] <= '10')  {$color[$c]='#ccccff'; $white[$c]=0;}
elseif($tempe[$c] > '10' && $tempe[$c] <= '15')  {$color[$c]='#ffcccc'; $white[$c]=0; }
elseif($tempe[$c] > '15' && $tempe[$c] <= '20')  {$color[$c]='#ff9999'; $white[$c]=0; }
elseif($tempe[$c] > '20' && $tempe[$c] <= '25')  {$color[$c]='#ff6699'; $white[$c]=0; }
elseif($tempe[$c] > '25' && $tempe[$c] <= '30')  {$color[$c]='#ff6666'; $white[$c]=0; }
elseif($tempe[$c] > '30' && $tempe[$c] <= '35')  {$color[$c]='#ff3366'; $white[$c]=0; }
elseif($tempe[$c] > '35' && $tempe[$c] <= '40')  {$color[$c]='#ff3333'; $white[$c]=0;}
elseif($tempe[$c] > '40')  {$color[$c]='#ff3300'; $white[$c]=0;}
else {$color[$c]='#ff0000';}
}

#repére des extremes
$replow=array('','');
$rephight=array('','');
$repmean=array('','');
$colortext=array('','','','','','');

for ($c=0; $c<2; $c++)
{
	if ($white[$c]==1) {$colortext[$c]='color="white"';}
	else {$colortext[$c]='';}
}
if ($tempdev == 0) {$devcolor='';};
if($tempdev < 0) {$devcolor="bgcolor='#ccffff'";}
else {$devcolor="bgcolor='#ffcccc'";};

switch($mois)
  {
  case "janvier":
    $monthnum="01";
    $lastday="31";
    break;
  case "février":
    $monthnum="02";
    $lastday="28";
    break;
  case "mars":
    $monthnum="03";
    $lastday="31";
    break;
  case "avril":
    $monthnum="04";
    $lastday="30";
    break;
  case "mai":
    $monthnum="05";
    $lastday="31";
    break;
  case "juin":
    $monthnum="06";
    $lastday="30";
    break;
  case "juillet":
    $monthnum="07";
    $lastday="31";
    break;
  case "août":
    $monthnum="08";
    $lastday="31";
    break;
  case "septembre":
    $monthnum="09";
    $lastday="30";
    break;
  case "octobre":
    $monthnum="10";
    $lastday="31";
    break;
  case "novembre":
    $monthnum="11";
    $lastday="30";
    break;
  case "décembre":
    $monthnum="12";
    $lastday="31";
    break;
                  }

#colorisation ensoleillement
if($sun_cent <= '30') {$color[6]='#ffffcc'; $white[6]=0; }
elseif($sun_cent > '30' && $sun_cent <= '60')  {$color[6]='#ffff99'; $white[6]=0; }
elseif($sun_cent > '60' && $sun_cent <= '120')  {$color[6]='#ffff66'; $white[6]=0; }
elseif($sun_cent > '120' && $sun_cent <= '180')  {$color[6]='#ffff33'; $white[6]=0; }
elseif($sun > '180' && $sun <= '240')  {$color[6]='#ffff00'; $white[6]=0;}
elseif($sun > '240' && $sun <= '300')  {$color[6]='#ffcc00'; $white[6]=0; }
elseif($sun > '300' && $sun <= '360')  {$color[6]='#ff9900'; $white[6]=0; }
elseif($sun > '360') {$color[6]='#ff6600'; $white[6]=1; }
else {$color[6]='#ff6600';}

#incrémentation du tableau
if ($temp != ""){

$ligne2 .= "<tr >
              <td  bgcolor='#d4d4d4' align='center'><a href='climato.php?annee=$yearstr&mois=$monthnum' target='_self'>$mois</a></td>
              <td  bgcolor='$color[0]' width='65' align='center' onmouseover=\"showtrail('../../../mesures/$yearstr/mini_m$yearstr$monthnum";
$ligne2 .= "t.gif','','',1,0,0);\" onmouseout='hidetrail();'><font $colortext[0]> $temp °C </td>
              <td  bgcolor='$color[1]' width='65' align='center'><font $colortext[1]> $normtemp °C </td>
              <td  $devcolor width='65' align='right'><font> $tempdev °C</td>
			  <td  bgcolor='$color[6]' width='65' align='center' onmouseover=\"showtrail('../../../mesures/$yearstr/mini_m$yearstr$monthnum";
$ligne2 .= "st.gif','','',1,0,0);\" onmouseout='hidetrail();'><font $colortext[0]> $sun h </td>
	          <td  bgcolor='$color[6]' width='65' align='center'><font>$sunpourcent%</td>
           </tr>
              ";}

}

$ligne3="";
########################################
#Récupération des moyennes annuelles de pluie ##
########################################
$item_m = explode(",",$total3);
$rain_m = $item_m[3];
$normrain_m = $item_m[1];
$raindev_m = $item_m[2];
$dayrain_m = $item_m[4];
$dayrain20_m = $item_m[6];

$nb = substr_count ($table3, "
");
$line3 = explode("
",$table3);

for ($i=0; $i<$nb+1; $i++)

{
#selection ligne

$item = explode(",",$line3[$i]);
#séparation et classement des valeurs
$mois = $item[0];
$normrain = $item[1];
$raindev = $item[2];
$rain = $item[3];
$dayrain = $item[4];
$dayrain2 = $item[5];
$dayrain20 = $item[6];



#colorisation pluie
if($rain >= '0.2' && $rain <= '1')  {$color[3]='#ccffff'; $white[3]=0;}
elseif($rain > '1' && $rain <= '2.5')  {$color[3]='#99ffff'; $white[3]=0;}
elseif($rain > '2.5' && $rain <= '5')  {$color[3]='#66ffff'; $white[3]=0;}
elseif($rain > '5' && $rain <= '7.5')  {$color[3]='#33ffff'; $white[3]=0; }
elseif($rain > '7.5' && $rain <= '10')  {$color[3]='#00ffff'; $white[3]=0; }
elseif($rain > '10' && $rain <= '15')  {$color[3]='#00ccff'; $white[3]=0; }
elseif($rain > '15' && $rain <= '30')  {$color[3]='#0099ff'; $white[3]=0;}
elseif($rain > '30' && $rain <= '60')  {$color[3]='#0066ff'; $white[3]=0; }
elseif($rain > '60' && $rain <= '100')  {$color[3]='#0033ff'; $white[3]=0; }
elseif($rain > '100')  {$color[]='#0000ff'; $white[3]=0;}
else {$color[3]='#ffffff';}


#repére des extremes
$replow=array('','');
$rephight=array('','');
$repmean=array('','');
$colortext=array('','','','','','');


	if ($white[3]==1) {$colortext[3]='color="white"';}
	else {$colortext[3]='';}
if ($raindev == 0) {$devcolor='';};
if($raindev > 0) {$devcolor="bgcolor='#ccffff'";}
else {$devcolor="bgcolor='#ffffcc'";}

switch(trim($mois))
  {
  case "janvier":
    $monthnum="01";
    break;
  case "février":
    $monthnum="02";
    break;
  case "mars":
    $monthnum="03";
    break;
  case "avril":
    $monthnum="04";
    break;
  case "mai":
    $monthnum="05";
    break;
  case "juin":
    $monthnum="06";
    break;
  case "juillet":
    $monthnum="07";
    break;
  case "août":
    $monthnum="08";
    break;
  case "septembre":
    $monthnum="09";
    break;
  case "octobre":
    $monthnum="10";
    break;
  case "novembre":
    $monthnum="11";
    break;
  case "décembre":
    $monthnum="12";
    break;
                  }

#incrémentation du tableau
if ($rain != ""){

$ligne3 .= "<tr >
              <td  bgcolor='#d4d4d4' align='center'><a href='climato.php?annee=$yearstr&mois=$monthnum' target='_self'>$mois</a></td>
              <td  bgcolor='$color[3]' width='65' align='center' onmouseover=\"showtrail('../../../mesures/$yearstr/mini_m$yearstr$monthnum";
$ligne3 .= "p.gif','','',1,0,0);\" onmouseout='hidetrail();'><font $colortext[3]> $rain mm </td>
              <td  width='65' align='center'><font> $dayrain</td>
	          <td  width='65' align='center'><font>$dayrain20</td>
	          <td  width='65' align='center'><font> $normrain mm</td>
	          <td  $devcolor width='65' align='right'><font> $raindev mm</td>
	        </tr>
              ";}

}
$ligne4="";
########################################
#Récupération des moyennes annuelles de vent ##
########################################
$item_m = explode(",",$total4);
$vent_m = $item_m[1];
$ventmax_m = $item_m[2];
$ventmaxday_m = $item_m[4];
$secteur_m = $item_m[8];
$secteur_m=trim($secteur_m);
$gustmax_m = $item_m[5];
$gustmaxday_m = $item_m[7];


$nb = substr_count ($table4, "
");
$line4 = explode("
",$table4);

for ($i=0; $i<$nb+1; $i++)

{
#selection ligne

$item = explode(",",$line4[$i]);
#séparation et classement des valeurs
$mois = $item[0];
$vent = $item[1];
$ventmax = $item[2];
$ventmaxday = $item[4];
$ventmaxhour = $item[3];
$secteur = $item[8];
$secteur = trim($secteur);
$gustmax = $item[5];
$gustmaxday = $item[7];
$gustmaxhour = $item[6];



#colorisation vent
if($vent < '10' )  {$color[0]='#ffffff';}
elseif($vent >= '10' && $vent < '20')  {$color[0]='#ebebeb'; $white[0]=0;}
elseif($vent >= '20' && $vent < '30')  {$color[0]='#d7d7d7'; $white[0]=0;}
elseif($vent >= '30' && $vent < '40')  {$color[0]='#c4c4c4'; $white[0]=0; }
elseif($vent >= '40' && $vent < '50')  {$color[0]='#afafaf'; $white[0]=0; }
elseif($vent >= '50' && $vent < '60')  {$color[0]='#AB8787'; $white[0]=0; }
elseif($vent >= '60' && $vent < '70')  {$color[0]='#D07676'; $white[0]=0;}
elseif($vent >= '70' )  {$color[0]='#ff0000'; $white[0]=0; }
else {$color[0]='#222222';}

if($ventmax < '10' )  {$color[1]='#ffffff';}
elseif($ventmax >= '10' && $ventmax < '20')  {$color[1]='#ebebeb'; $white[1]=0;}
elseif($ventmax >= '20' && $ventmax < '30')  {$color[1]='#d7d7d7'; $white[1]=0;}
elseif($ventmax >= '30' && $ventmax < '40')  {$color[1]='#c4c4c4'; $white[1]=0; }
elseif($ventmax >= '40' && $ventmax < '50')  {$color[1]='#afafaf'; $white[1]=0; }
elseif($ventmax >= '50' && $ventmax < '60')  {$color[1]='#AB8787'; $white[1]=0; }
elseif($ventmax >= '60' && $ventmax < '70')  {$color[1]='#D07676'; $white[1]=0;}
elseif($ventmax >= '70' )  {$color[1]='#ff0000'; $white[1]=0; }
else {$color[1]='#222222';}

if($gustmax < '10' )  {$color[2]='#ffffff';}
elseif($gustmax >= '10' && $gustmax < '20')  {$color[2]='#ebebeb'; $white[2]=0;}
elseif($gustmax >= '20' && $gustmax < '30')  {$color[2]='#d7d7d7'; $white[2]=0;}
elseif($gustmax >= '30' && $gustmax < '40')  {$color[2]='#c4c4c4'; $white[2]=0; }
elseif($gustmax >= '40' && $gustmax < '50')  {$color[2]='#afafaf'; $white[2]=0; }
elseif($gustmax >= '50' && $gustmax < '60')  {$color[2]='#AB8787'; $white[2]=0; }
elseif($gustmax >= '60' && $gustmax < '70')  {$color[2]='#D07676'; $white[2]=0;}
elseif($gustmax >= '70' )  {$color[2]='#ff0000'; $white[2]=0; }
else {$color[2]='#222222';}

#repére des extremes
$replow=array('','');
$rephight=array('','');
$repmean=array('','');
$colortext=array('','','','','','');

for ($c=0; $c<3; $c++)
{
	if ($white[$c]==1) {$colortext[$c]='color="white"';}
	else {$colortext[$c]='';}
}

if ($ventmax == $ventmax_m) {$replow = array("<b>","</b></font>");}
if ($gustmax == $gustmax_m) {$rephight = array("<b>","</b></font>");}

switch(trim($mois))
  {
  case "janvier":
    $monthnum="01";
    break;
  case "février":
    $monthnum="02";
    break;
  case "mars":
    $monthnum="03";
    break;
  case "avril":
    $monthnum="04";
    break;
  case "mai":
    $monthnum="05";
    break;
  case "juin":
    $monthnum="06";
    break;
  case "juillet":
    $monthnum="07";
    break;
  case "août":
    $monthnum="08";
    break;
  case "septembre":
    $monthnum="09";
    break;
  case "octobre":
    $monthnum="10";
    break;
  case "novembre":
    $monthnum="11";
    break;
  case "décembre":
    $monthnum="12";
    break;
                  }
#incrémentation du tableau
if ($vent != ""){

$ligne4 .= "<tr >
              <td  bgcolor='#d4d4d4' align='center'><a href='climato.php?annee=$yearstr&mois=$monthnum' target='_self'>$mois</a></td>
              <td  bgcolor='$color[0]' width='65' align='center' onmouseover=\"showtrail('../../../mesures/$yearstr/mini_m$yearstr$monthnum";
$ligne4 .= "v.gif','','',1,0,0);\" onmouseout='hidetrail();'><font $colortext[0]> $vent km/h </td>
              <td  bgcolor='$color[1]' width='65' align='center' onmouseover=\"showtrail('../../../mesures/$yearstr/mini_m$yearstr$monthnum";
$ligne4 .= "v.gif','','',1,0,0);\" onmouseout='hidetrail();'><font $colortext[1]>$replow[0] $ventmax km/h $replow[1]</td>
              <td  width='65' align='center'><font> $ventmaxday</td>
	          <td  width='65' align='center'><font>$ventmaxhour</td>
	          <td  bgcolor='#ffffff' width='60' align='center' onmouseover=\"showtrail('../../../mesures/$yearstr/ddis_m$yearstr$monthnum.gif','','',1,0,0);\" onmouseout='hidetrail();'><font>$secteur</td>
	          <td  bgcolor='$color[2]' width='65' align='center' onmouseover=\"showtrail('../../../mesures/$yearstr/mini_m$yearstr$monthnum";
$ligne4 .= "gu.gif','','',1,0,0);\" onmouseout='hidetrail();' ><font $colortext[2]>$rephight[0] $gustmax km/h $rephight[1]</td>
              <td  width='65' align='center'><font> $gustmaxday</td>
	          <td  width='65' align='center'><font>$gustmaxhour</td>

	        </tr>
              ";}

}

#################
#affichage final#
#################
echo "

<body>
<font face='Arial' size='3'><center><b>$title1</b></center></font><br>

<table align='left'>
	<tr>
		<td>
			<input onclick='donoaaprevyear();' type='button' $disableprev name='nooaprev'id='nooaprev' value='Précédente' >
			<input onclick='donoaanextyear();' type='button' $disablenext name='nooanext'id='nooanext' value='Suivante' >
			<input onclick='moisnoaa();' type='button' value='Mois' >
			<form name='date' method='GET' action='redirclimatoa.php'>		
		</td>
		<td>
			<font face='Arial' size='2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Recherche :</font>
			<select name='annee' size='1'>";
			$today = getdate();
			$year = $today['year'];
			echo "<option value='vide'>Année</option>" ;
			for ($i=$anneedebut;$i <= $year; $i=$i+1){echo "<option value='$i'>$i</option>";
			 }
			echo"
		    </select>
		</td>
		<td>
			<input type='submit' class='bouton_php' name='AFFICHER' value='Afficher'>
			</form>
		</td
	</tr>
</table>	
<table class='tableau_php'>
	<tr>
		<td class='cellule_couleur_php' rowspan='2'><b>Mois</b></td>
		<td class='cellule_couleur_php' colspan='9'><b>Température</b></td>
		<td class='cellule_couleur_php'>Jours</td>
		<td class='cellule_couleur_php'>Jours</td>
		<td class='cellule_couleur_php'>Jours</td>
	</tr>
	<tr>
         <td class='cellule_couleur_php'>moy</td>
         <td class='cellule_couleur_php'>moy min</td>
         <td class='cellule_couleur_php'>min</td>
         <td class='cellule_couleur_php'>date min</td>
         <td class='cellule_couleur_php'>heure min</td>
         <td class='cellule_couleur_php'>moy max</td>
         <td class='cellule_couleur_php'>max</td>
         <td class='cellule_couleur_php'>date max</td>
         <td class='cellule_couleur_php'>heure max</td>
         <td class='cellule_couleur_php'>sans dégel</td>
         <td class='cellule_couleur_php'>de gel</td>
         <td class='cellule_couleur_php'>(Tmax > °C)</td>
	</tr>

$ligne

	<tr>
		<td></td>
		<td>$meantemp_m °C</td>
		<td>$lowtempmean_m °C</td>
		<td>$lowtemp_m °C</td>
		<td></td>
		<td></td>
		<td>$highttempmean_m °C</td>
		<td>$highttemp_m °C</td>
		<td></td>
		<td></td>
		<td>$icedays_m</td>
		<td>$colddays_m</td>
		<td>$heatdays_m</td>
	</tr>
</table>


<table class='tableau_bas_php'>
	<tr>
		<td class='cellule_couleur_php' width='20%' rowspan='2'><b>Mois</b></td>
		<td class='cellule_couleur_php' colspan='3'><b>Température</b></td>
		<td class='cellule_couleur_php' colspan='2'><b>Ensoleillement</b></td>
	</tr>
	<tr>
         <td class='cellule_couleur_php'>moyenne</td>
         <td class='cellule_couleur_php'>Moy. Météo France</td>
         <td class='cellule_couleur_php'>Ecart de la normale</td>
         <td class='cellule_couleur_php'>Mesuré</td>
         <td class='cellule_couleur_php'>Ecart</td>
	</tr>

$ligne2

	<tr>
		<td></td>
		<td>$temp_m °C</td>
		<td>$normtemp_m °C</td>
		<td>$tempdev_m °C</td>
		<td colspan='2'>$sun_m h</td>
	</tr>
</table>

<table class='tableau_bas_php'>
	<tr>
		<td class='cellule_couleur_php' rowspan='2' width='20%'><b>Mois</b></td>
		<td class='cellule_couleur_php' colspan='5'><b>Pluie</b></td>
	</tr>
	<tr>
         <td class='cellule_couleur_php'>pluie totale</td>
         <td class='cellule_couleur_php'>jours pluie</td>
         <td class='cellule_couleur_php'>jours > 20mm&nbsp;</td>
         <td class='cellule_couleur_php'>normale 1990-2005</td>
         <td class='cellule_couleur_php'>écart de la normale</td>
    </tr>

$ligne3

	<tr>
		<td></td>
		<td>$rain_m mm</td>
		<td>$dayrain_m</td>
		<td>$dayrain20_m</td>
		<td>$normrain_m mm</td>
		<td>$raindev_m mm</td>
	</tr>
</table>

<table class='tableau_bas_php'>
	<tr>
		<td class='cellule_couleur_php' width='20%' rowspan='2'><b>Mois</b></td>
		<td class='cellule_couleur_php' colspan='8'><b>Vent</b></td>
	</tr>
	<tr>
         <td class='cellule_couleur_php'>vent moyen</td>
         <td class='cellule_couleur_php'>vent 10min max</font></td>
         <td class='cellule_couleur_php'>jour</td>
         <td class='cellule_couleur_php'>heure</td>
         <td class='cellule_couleur_php'>secteur</td>
         <td class='cellule_couleur_php'>rafale maximum</td>
         <td class='cellule_couleur_php'>jour</td>
         <td class='cellule_couleur_php'>heure</td>
    </tr>

$ligne4
	
	<tr>
		<td></td>
		<td>$vent_m km/h</td>
		<td>$ventmax_m km/h</td>
		<td>$ventmaxday_m</td>
		<td></td>
		<td><img src='climato/$secteur_m.gif'/></td>
		<td>$gustmax_m km/h</td>
		<td>$gustmaxday_m</td>
		<td></td>
	</tr>
</table>

</body>";

?>
		</div>
Il y aura un problème de division part zéro, mais peu importe pour le test.
A mon avis, ça ne fonctionnera pas, ou je me mords un œil !
Cordialement

Rieux

Tudgur
Participation 6
Participation 6
Messages : 1770
Enregistré le : 13 mai 2007, 16:47
Localisation : 29880 Plouguerneau
Contact :

Re: Fichiers NOAA ....(moi aussi)

Message par Tudgur » 22 juin 2013, 18:05

HS :
Jean, c'est sans rapport avec le sujet mais je pense que tu devrais songer à étalonner ton pluvio !

64.2mm en mars à Landéda contre 91.4 à Plouguerneau
47.2mm en avril contre 68
33mm en mai contre 62.6
15.6mm au 22 juin contre 35.2

J'ai du mal à croire qu'il pleuve beaucoup moins à Landéda qu'à Plouguerneau...
As-tu un pluvio manuel pour vérification ?
As-tu étalonné ton pluvio ?
Cordialement.

Tudgur
http://meteo-plouguerneau.fr" onclick="window.open(this.href);return false;

Avatar du membre
webmaster
Site Admin
Site Admin
Messages : 2611
Enregistré le : 12 déc. 2006, 20:54
Localisation : Rieux 51 FRANCE
Contact :

Re: Fichiers NOAA ....(moi aussi)

Message par webmaster » 22 juin 2013, 18:35

Tudgur a écrit :HS :
J'ai du mal à croire qu'il pleuve beaucoup moins à Landéla qu'à Plouguerneau...
C'est pourtant bien connu:
A Plouguerneau il n'y a que de l'eau.
Ou:
S'il te faut de l'eau, prends celle de Plouguerneau, ils en ont plus qu'il n'en faut !
Et sans oublier:
Si ta tente prend l'eau, ne va pas à Plouguerneau
Va plutôt à Landéda, là-bas il ne pleut pas !
Et comme disaient les vieux bretons:
Si tu aimes les escagots, viens à plouguerneau
Ils sont bien plus gros et gras que si tu vas à landéda.
Cordialement

Rieux

Répondre