[Rnomads-user] Questions to rNOMADS

Ling Jin ling.jin at ensta-paristech.fr
Tue Jul 19 11:40:16 CEST 2016


Hello! 

I am Ling, a student from France. I am very glad to use the package rNOMADS which is pretty comprehensive and useful. 

I encountered some problems when I used it. I would like to download all temperatures, precipitations and wind speeds from 1st January, 2014 to 31st December, 2015. The problem is that I can not get other parameters except temperatures. The codes are below: (you can just read red lines to save time. ) 



library(xml2) 
library(rvest) 
library(rNOMADS) 
#Latitude et longitude de Île de France 
lat <- 48.8499 
lon = 2.6370 

abbrev <- "gfsanl" 
model.seq = seq(as.Date(as.character(20140101), format = "%Y%m%d"), by = "day", length.out = 730) 
model.seq.format = format(model.seq, format = "%Y%m%d") 
model.run <- c(00, 06, 12, 18) 
pred <- 00 
#nombre de jours 
d = 730 
#nombre de prédictions 
p = 4 
Matrix_tmp = matrix(data = NA, nrow = d, ncol = p) 
Matrix_prcp = matrix(data = NA, nrow = d, ncol = p) 
Matrix_awnd = matrix(data = NA, nrow = d, ncol = p) 

ptm <- proc.time() 
for(i in 1:d) 
{ 
for(k in 1:p) 
{ 
## Not run: 
##télécharger des données 
model.info <- ArchiveGribGrab(abbrev, model.seq.format[i], model.run[k], pred, file.type = "grib2") 
##lire des données 
model.data <- ReadGrib(model.info$file.name, c("2 m above ground"), c("TMP", "WIND", "PWAT", "PRATE", "APCP")) 
#prendre des données de certaine point 

#In profile, there is just TMP but no other parameters like WIND... 

profile <- BuildProfile(model.data, lon, lat, TRUE) 
#écrire des données de chaque 6 heures à une liste 
tmp = profile[[1]]$profile.data[1,1,1] - 272.15 
print(tmp) 
Matrix_tmp[i,k] <- tmp 
print(Matrix_tmp) 
} 
} 
data_tmp = write.table(Matrix_tmp, file = "data_tmp.csv", row.names = T, col.names = c("00","06","12","18"),sep = ";") 
proc.time() - ptm 




There are not so many things about problem solutions of rNOMADS, so I ask for your help directly. 




Looking for your answers and that will be very helpful for me! Thank you! 




Best regards, 


Ling JIN 



Élève ingénieur 2ème année 
	


ENSTA ParisTech 

828, boulevard des Maréchaux 

91120 PALAISEAU [ plan ] 

www.ensta-paristech.fr 


Nos réseaux : Facebook | Twitter | Google+ | YouTube | LinkedIn 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rnomads-user/attachments/20160719/f4cebc54/attachment.html>


More information about the Rnomads-user mailing list