Skip to content

Commit

Permalink
bugfix that occurred when compositing already composited ppi's with i…
Browse files Browse the repository at this point in the history
…dw method
  • Loading branch information
adokter committed Feb 27, 2020
1 parent f207504 commit a5c9048
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/composite_ppi.R
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ composite_ppi <- function(x, param = "DBZH", nx = 100, ny = 100, xlim, ylim, res
#weights<-raster::pointDistance(as.matrix(data.frame(x=lons.radar,y=lats.radar)), coordinates(raster(spGrid)),lonlat=T)
for(i in 1:length(projs)){
brick_data <- raster::setValues(brick_data, projs[[i]], layer=i)
weights<-raster::pointDistance(as.matrix(data.frame(x=lons.radar,y=lats.radar))[i,], coordinates(raster(spGrid)),lonlat=T)
latlon.radar <- unique(data.frame(lat=c(lats.radar), lon=c(lons.radar)))
weights<-raster::pointDistance(as.matrix(data.frame(x=latlon.radar$lon,y=latlon.radar$lat))[i,], coordinates(raster(spGrid)),lonlat=T)
if(!is.na(idw_max_distance)) weights[weights>idw_max_distance]=NA
weights = 1/(weights^idp)

Expand Down

0 comments on commit a5c9048

Please sign in to comment.