Commits

Paul Hiemstra  committed 800dc66

Deleted some unnecessary comments

  • Participants
  • Parent commits b7f31e4

Comments (0)

Files changed (1)

File R/autofitVariogram.r

 {
     # Check for anisotropy parameters
     if('alpha' %in% names(list(...))) warning('Anisotropic variogram model fitting not supported, see the documentation of autofitVariogram for more details.')
-
+  
     # Take the misc fit options and overwrite the defaults by the user specified ones
     miscFitOptionsDefaults = list(merge.small.bins = TRUE, min.np.bin = 5)
     miscFitOptions = modifyList(miscFitOptionsDefaults, miscFitOptions)
-
-    # The boundaries could also be fitted automatically. This could be done by fitting
-    # a function between lag-distance and bin-width. The fitting criterium could be
-    # how good it looks but it is hard to put into formal language. A more simple approach
-    # is chosen here. A standard boundary set is used and is scaled for the size of the area.
-    # This could give problems if the extent of the area is much smaller or larger then the corellation
-    # length of the phenomenon that is studied.
+  
+    # Create boundaries
     longlat = !is.projected(input_data)
     if(is.na(longlat)) longlat = FALSE
     diagonal = spDists(t(bbox(input_data)), longlat = longlat)[1,2]                # 0.35 times the length of the central axis through the area
     boundaries = c(2,4,6,9,12,15,25,35,50,65,80,100) * diagonal * 0.35/100         # Boundaries for the bins in km
     
     
-	# If you specifiy a variogram model in GLS.model the Generelised least squares sample variogram is constructed
-	if(!is(GLS.model, "variogramModel")) {
-		experimental_variogram = variogram(formula, input_data,boundaries = boundaries, ...)
-	} else {
-		if(verbose) cat("Calculating GLS sample variogram\n")
-		g = gstat(NULL, "bla", formula, input_data, model = GLS.model, set = list(gls=1))
-		experimental_variogram = variogram(g, boundaries = boundaries, ...)
-	}
+  	# If you specifiy a variogram model in GLS.model the Generelised least squares sample variogram is constructed
+  	if(!is(GLS.model, "variogramModel")) {
+  		experimental_variogram = variogram(formula, input_data,boundaries = boundaries, ...)
+  	} else {
+  		if(verbose) cat("Calculating GLS sample variogram\n")
+  		g = gstat(NULL, "bla", formula, input_data, model = GLS.model, set = list(gls=1))
+  		experimental_variogram = variogram(g, boundaries = boundaries, ...)
+  	}
 
-	# If there are bins with less than 5 point pairs we merge the first two bins and 
-	# rebuild the variogram and check again etc etc. This stops if no bins have less than
-	# 5 point pairs, request by Jon Skoien
+    # request by Jon Skoien
     if(miscFitOptions[["merge.small.bins"]]) {
       if(verbose) cat("Checking if any bins have less than 5 points, merging bins when necessary...\n\n")
       while(TRUE) {
           }
       }	
     }
-      #experimental_variogram = experimental_variogram[experimental_variogram$np >5,] # FILTER!!!!! Clip points that have less then 5 point pairs
 
-    # If the value in start_vals == NA:
-    # Automatically choosing the initial guess for fit.variogram
-    # initial_sill = mean(max(semi_var) + median(semi-var))
-    # initial_range = 0.10 * central axis of the area.
-    # initial_nugget = minimum semi-variance value
+    # set initial values
     if(is.na(start_vals[1])) {  # Nugget
         initial_nugget = min(experimental_variogram$gamma)
     } else {