Commit 87abb253 authored by Logez Maxime's avatar Logez Maxime
Browse files

Calcul des temperatures decennales pour IIR

parents
No related merge requests found
Showing with 61 additions and 0 deletions
+61 -0
.gitignore 0 → 100644
.Rproj.user
.Rhistory
.RData
.Ruserdata
/data
\ No newline at end of file
IIR.Rproj 0 → 100644
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: knitr
LaTeX: pdfLaTeX
setwd("D:/IIR/temperatures/IIR")
require(fastmatch)
camp <- read.table("./data/camp_2017_06_21.txt", sep = "\t", header = TRUE, stringsAsFactor = FALSE)
wd <- "D:/Data/SAFRAN/"
temps <- matrix(numeric(), nrow(camp), 3)
colnames(temps) <- c("TMOY", "TMAX", "TAMP")
auxiJul <- seq(7, 10*12, 12)
auxiJan <- seq(1, 120, 12)
for (i in 1:nrow(camp)) {
if (grepl("NA", u <- camp$gridcode[i]))
temps[i,] <- NA
else {
temp <- read.table(sprintf("%s%s_month_tmp.txt", wd, u), sep = ";", header = TRUE, colClasses = c("character", "numeric"))
annee <- as.integer(substr(camp$Date[i], 7, 10))-1
d1 <- expand.grid(Annee = (annee-9):annee, Mois = sprintf("%02d", 1:12))
d1 <- do.call(paste0, d1[do.call(order, d1),])
temp <- temp$Tmp[fmatch(d1, temp$Date)]
tmean <- sum(temp)/120
tjul <- sum(temp[auxiJul])/12
tjan <- sum(temp[auxiJan])/12
tamp <- tjul - tjan
temps[i,] <- c(tmean, tjul, tamp)
}
}
camp$deltaT <- with(camp, (Altitude-AltitudePla)*0.65/100)
temps <- temps+camp$deltaT
camp <- cbind(camp, temps)
write.table(camp, file = "./data/camp_temp_2017_06_21.txt", sep = "\t", row.names = FALSE, quote = TRUE)
SPt <- SpatialPoints(coords = camp[, c("X", "Y")],
proj4string = CRS("+init=epsg:2154"))
FR_ctr_L93 <- rgdal::spTransform(FR_ctr_L2E, )
FR_ctr_W84 <- rgdal::spTransform(FR_ctr_L2E, CRS("+init=epsg:4326"))
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment