miércoles, 4 de julio de 2018

New rWind release on CRAN! (v1.0.2)

Hi there!

Just a few lines to inform you about the new release of rWind R package (v1.0.2). This version have several new features. Here you have an example of one of them, the function wind.dl_2 to download time series of wind data. In this example we create a bunch of PNG files to be converted later into a GIF of wind speed of east Asia region.


 # We will create a gif of wind speed for east Asia during the end of June (2018)  
 # First, we should load the packages that we will use. Use install.packages() to   
 # download and install the new version of rWind (v1.0.2)  
 # Now, we use lubridate package to create a sequence of dates/times (each three  
 # hours)  
 dt <- seq(ymd_hms(paste(2018,6,25,00,00,00, sep="-")),  
      ymd_hms(paste(2018,7,4,21,00,00, sep="-")),by="3 hours")  
 # Now, we use the new function wind.dl_2 to download the whole time series of  
 # wind data. We use the "dt" object created with lubridate to provide the input   
 # to wind.dl_2. Since it's a large area and many days, it could take a while...  
 wind_series <- wind.dl_2(dt,90,150,5,40)  
 # Next, we can use wind2raster function from rWind package directly over the   
 # output from wind.dl_2, it has been adapted to work with this lists of wind  
 # data.  
 wind_series_layer <- wind2raster(wind_series)  
 # Finally, we will create a bunch of PNG files to be converted later in a GIF  
 for (i in 1:72) {  
  id <- sprintf("%03d", i)  
  png(paste("asia",id,".png", sep=""), width=1000, height=600, units="px",  
  image.plot(wind_series_layer[[i]]$wind.speed, col=bpy.colors(1000),  
        zlim=c(0,18), main =wind_series[[i]]$time[1])  
  lines(getMap(resolution = "low"), lwd=3)  

4 comentarios:

  1. I have installed the latest version, but appeared the following error message: "could not find function "wind.dl_2"". What it could be?

  2. Hi! Could you check your session info? You can use sessionInfo() and see if R version is ≥ 3.4 and if you are actually using the last rWind version (1.0.2)

  3. even though I'm a somehow advanced R user, I still find things that impress me. Thanks for sharing!!

  4. titanium ring for sale - ITYBILE ROCK
    The titanium knee replacement gold titanium jewelry ring is a perfect fit for you to titanium 4000 take your 2016 ford focus titanium money wherever you want 메이저 토토 사이트 and make it easy to move your money in.