contour.tcl

This example shows how to build surface using contours. In this example 3 different contours were used. Two of them were (cntr_big_circle, cntr_center) approximated by resulting surface. Another one (cntr_big_circle) was used to modify completer gridding rule with weight.

See also:
contour, contour_add, completer
Here is the image of the resulting surface:

surface built from areas

Pic 1. Surface built from contours

This result was obtained with "examples/surfit/curvs/contour.tcl" script.

00001 #
00002 # This script was generated with funner v2.1beta (www.gridding.info)
00003 
00004 # 
00005 # load plugins
00006 # 
00007 load libsurfit[info sharedlibextension]
00008 
00009 # remove all previous data and gridding rules
00010 clear_data 
00011 
00012 # set name of surface
00013 set map_name "map_cntr" 
00014 
00015 # set solver
00016 set_solver "cg" 
00017 
00018 # set tolerance for solver
00019 set tol 1e-005 
00020 
00021 ##
00022 ## load initial data 
00023 ##
00024  
00025 # load contour from text file 
00026 cntr_read "cntr_small_circle.xyz" "cntr_small_circle"  
00027  
00028 # load contour from text file 
00029 cntr_read "cntr1.xyz" "cntr1"  
00030  
00031 # load contour from text file 
00032 cntr_read "cntr2.xyz" "cntr2"  
00033  
00034 # load contour from text file 
00035 cntr_read "cntr_big_circle.xyz" "cntr_big_circle"  
00036  
00037 # load contour from text file 
00038 cntr_read "cntr_center.xyz" "cntr_center"  
00039  
00040 ##
00041 ## construct grid 
00042 ##
00043 grid_get -1000 1000 20 -1000 1000 20 
00044  
00045 ##
00046 ## create gridding rules
00047 ##
00048 
00049 # resulting surface at contour = contour values 
00050 contour "cntr_small_circle" 
00051 
00052 # resulting surface at contour = contour values 
00053 contour "cntr_center" 
00054 
00055 # resulting surface should tend to be constant or plane 
00056 completer 
00057 
00058 # add "resulting surface at contour = contour values" with weight 
00059 contour_add 0.5 "cntr_big_circle" 
00060 
00061 ##
00062 ## run gridding algorithm
00063 ##
00064 surfit 
00065 
00066 ##
00067 ## save results 
00068 ##
00069 
00070 # unload grid from memory
00071 grid_unload 
00072 
00073 # save surface to surfit datafile 
00074 surf_save "contour.dat" "map_cntr" 



surfit: open source gridding and contouring software.