import numpy as np
import csv
import matplotlib.pyplot as plt
#from mpl_toolkits.basemap import Basemap
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
import os
import glob
#import wradlib as wrl
import cartopy
import cartopy.crs as ccrs
import sys
import pandas
with open('fr_data_LUX_actual.csv') as DataFile:
data = csv.reader(DataFile,delimiter=';')
rows = []
for row in data:
rows.append(row)
print(rows)
date=list(rows[1])
p=list(rows[4])
rh=list(rows[5])
t=list(rows[6])
wd=list(rows[8])
ws=list(rows[10])
wv=list(rows[12])
icon=list(rows[14])
if wd[1]== 'Sud':
wd[1]= 180
if wd[1]== 'Est':
wd[1]= 90
if wd[1]== 'Nord':
wd[1]= 360
if wd[1]== 'Ouest':
wd[1]= 270
if wd[1]== 'SO':
wd[1]= 235
if wd[1]== 'SE':
wd[1]= 135
if wd[1]== 'NO':
wd[1]= 315
if wd[1]== 'NE':
wd[1]= 45
if wd[1]== '':
wd[1]= 'var'
from datetime import datetime
today = datetime.today()
date2=datetime.strptime(date[1], '%d-%m-%Y %H:%M:%S').strftime('%Y%m%d000000')
date3=today.strftime('%Y%m%d000000')
print(date2)
print(date3)
with open(date3+'_OBSFINDEL.TXT', 'w', newline='') as csvfile:
obswriter = csv.writer(csvfile, delimiter='|')
obswriter.writerow(['865 Findel'])
obswriter.writerow([date2,icon[1],rh[1],t[1],wd[1],ws[1],p[1]])
[['\ufeffsep=', ''], ['created', '13-07-2023 08:35:51', ''], ['DESCRIPTION', 'VALUE', 'UNIT'], ['weather', 'Nuageux', ''], ['pressure', '1019', 'hPa'], ['humidity', '67', '%'], ['temp', '16', '°C'], ['temp_feels_like', '16', '°C'], ['wind_direction_text', 'Ouest', ''], ['wind_direction_tooltip', 'Ouest', ''], ['wind_force', '13', 'km/h'], ['wind_gusts', '', ''], ['wind_variable', 'variable entre Ouest et NO', ''], ['visibility', '10 km ou plus', ''], ['icon', '04', ''], ['photo', '04', '']] 20230713000000 20230713000000