add la couchonniere

This commit is contained in:
Simon 2024-08-16 10:09:52 +02:00
parent cea45ba9f9
commit d4632b7862

View file

@ -1,4 +1,5 @@
library(jsonlite)
library(httr)
base <- "https://public-api.meteofrance.fr"
dpobs <- "public/DPObs/v1/"
dpclim <- "public/DPClim/v1/"
@ -87,19 +88,29 @@ getStationPaquet <- function(id_station, format = "csv", headers = headersPaquet
# Test the function with dates and station ID
start_date <- as.Date("2024-03-24")
end_date <- as.Date("2024-04-23")
end_date <- as.Date("2024-08-14")
station_id <- "38269004"
allstation=getStations(headers)
allstations=getStations(headersLIM)
allstations=read.csv("allstations.csv")
#write.csv(file="allstations.csv",allstation,row.names=F)
lacouch=c(45.3722971,5.6387118)
alldist=dist(rbind(lacouch,cbind(allstations$Latitude,allstations$Longitude)))
staupre=allstation$Id_station[which.min(as.matrix(alldist)[1,-1])]
lamure=38269004
allmure=getStationData(start_date="2024-01-24",end_date="2024-04-23",station_id=lamure,headers=headersLIM)
alllavaldens=getStationData(start_date="2024-01-24",end_date="2024-04-23",station_id=38207001,headers=headersLIM)
allmure=getStationData(start_date="2024-06-24",end_date="2024-08-14",station_id=lamure,headers=headersLIM)
alllavaldens=getStationData(start_date="2024-06-24",end_date="2024-08-14",station_id=38207001,headers=headersLIM)
paquetLamure=getStationPaquet(id_station=lamure)
allcouch=getStationData(start_date="2024-06-24",end_date="2024-08-14",station_id=staupre,headers=headersLIM)
allal=getStationData(start_date="2024-01-24",end_date="2024-08-13",station_id=staupre,headers=headersLIM)
plot(getDate(alllavaldens[,2]),alllavaldens[,3],lwd=3,type="l",col="red")
plot(
plot(getDate(allmure[,2]),allmure[,3],lwd=3,type="l",col="blue",ylab="preciptitation (mm)")
plot(getDate(allmure[,2]),allmure[,3],pch=20,type="o",col="blue",ylab="preciptitation (mm)",main="La Mure/Lavalends",ylim=range(c(alllavaldens[,3],allmure[,3]),na.rm=T),cex=2)
points(getDate(alllavaldens[,2]),alllavaldens[,3],pch=20,col="red",cex=2,type="o")
points(getDate(allcouch[,2]),allcouch[,3],pch=20,col="green",cex=2,type="o")
legend("topleft",col=c("blue","red","green"),legend=c("La Mure","Lavaldens","St Aupre"),cex=2,pch=20)
plot(allmure[,3],alllavaldens[,3],col="red")
@ -164,3 +175,11 @@ plot(datetime_obj,alllavaldens[,3],lwd=2,type="l",col=2)
# Convert temperature from Kelvin to Celsius
temperature_celsius <- temperature_kelvin - 273.15
location <- "La Couchonnier, Saint Etienne de Crossey, France"
couch <- geocode(location)
couch <- osm_geocode(location)
# Print the latitude and longitude of La Salle en Beaumont
print(la_salle_geocode)
45.3722971,5.6387118