Why my interpolated map created in R is not similar to the one created with Surfer

0 votes
I would like to map rainfall data. I have to interpolate and then create the map. My problem is that my map created with R is not the same as the one created with Surfer software (of course using the same data). Can any one help how can i produce the same map as Surfer using R.

This is my data and the code used:

library(sp)
library(automap)
library(ggplot2)

#Create data
y<-c(215687.162238248, 238089.822076237, 169586.473794924, 195889.889928256, 205194.373578442,
203242.384734455, 233938.232064, 225888.454169139, 227892.68197848, 228389.845698433,
219493.009778054, 235794.339989575, 215433.810274294, 225144.310519959, 218885.551948723,  
243591.933789792, 257792.197343528, 217037.557117664, 255892.880828147, 255486.459028479,
278591.773470775, 261291.134681867, 260295.145384733, 265443.885999355)

x<-c(194393.587173876, 232138.542602024, 211732.972823955, 258937.28224625, 262389.890041292, 275140.51453176, 277435.541094655, 266482.171556925, 261633.445545259, 286033.757681761, 269635.833751565, 268233.432583096, 261607.625921525, 248286.676386486, 233887.717147903, 254739.22291816, 264985.237911372, 246590.210198199, 232333.235783993, 247634.978556728, 250981.32702818, 266084.042507046, 251387.993501201, 256939.477262534)

z<-c(326.4, 339.2, 254.2, 244.8, 314.1, 131.4, 203.9, 301.3, 316.3, 333.9, 400.2, 203.9, 199.7, 282.8, 390.1, 300.2, 293.8, 170.8, 289.5, 185.6, 277.7, 256.5, 213.5, 311.5)

#Create data frame
my_data<- data.frame("x"=x,"y"=y,"z"=z)

#create box
x.range<-c(148000, 306000)  #Xmin & Xmax
y.range<-c(119700 , 292600) #Ymin & Ymax
grd <- expand.grid(x=seq(from=x.range[1], to=x.range[2], by=500), y=seq(from=y.range[1], to=y.range[2], by=500))
coordinates(grd) <- ~ x+y  #library(sp)
gridded(grd) <- TRUE

coordinates(my_data) <- ~ x+y

# Ordinary kriging
kriging_result = autoKrige(z~1, my_data,grd)

# Universal kriging
#kriging_result = autoKrige(z~x+y, my_data,grd) **# Even suing universal kriging the map is not the same as Surfer**

krg.output=as.data.frame(kriging_result$krige_output)
interpolation.output=as.data.frame(krg.output)

#Plot map with ggplot
names(interpolation.output)[1:3]<-c("x","y","z")

tmp <- interpolation.output$z
interpolation.output$z <- ifelse(tmp <= 200, "100-200", interpolation.output$z)
interpolation.output$z <- ifelse(tmp > 200 & tmp <= 250, "200-250", interpolation.output$z)
interpolation.output$z <- ifelse(tmp > 250 & tmp <= 300, "250-300", interpolation.output$z)
interpolation.output$z <- ifelse(tmp > 300 & tmp <= 350, "300-350", interpolation.output$z)
interpolation.output$z <- ifelse(tmp > 350, "Upper 350", interpolation.output$z)
interpolation.output$z <- factor(interpolation.output$z)

ggplot()+ geom_raster(data=interpolation.output,mapping=aes(x,y,fill=z))+
 geom_path(color="black", linestyle=0.2)+     # draw boundaries
 scale_fill_manual(values = c("darkred","red","yellow","lightblue","blue"))
}

Map created with Surfer: These are options i used in Surfer:
   Gridding method: Kriging
   Kriging Type: Point
   Component type (variograme): Linear (Anisotropy: Ratio=1, Angle=0, Slope=1)
   Drift type: None
   Search: No search (use all data)

Unfortunately, i don't know why the two maps are differents.

Thanks for your help,
Feb 17, 2021 in Data Analytics by anonymous

edited Mar 4, 2025 309 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP