area.tcl

This example shows how to build surface by approximating areas with constant real numbers. In this example 5 different areas were used. Suppose that for three of them (area1, area3 and area5) exact values are known, for other two (area2 and area4) - only approximative values. So, we want to build surface, which approximates as exactly as possible values for areas 1,3 and 5, and "not so exactly" for areas 2 and 4.

See also:
area, area_add, completer
To produce this surface we should do the following things: Here is the image of the resulting surface (green colour for areas 1,3 and 5, red colour for areas 2 and 4):

surface built from areas

Pic 1. Surface built from areas

This result was obtained with "examples/surfit/curvs/area.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_area" 
00014 
00015 # set tolerance for cg solver
00016 set tol 5.01187e-006 
00017 
00018 ##
00019 ## load initial data 
00020 ##
00021  
00022 # load area from text file 
00023 area_read "area1.txt" "area1"  
00024  
00025 # load area from text file 
00026 area_read "area2.txt" "area2"  
00027  
00028 # load area from text file 
00029 area_read "area3.txt" "area3"  
00030  
00031 # load area from text file 
00032 area_read "area4.txt" "area4"  
00033  
00034 # load area from text file 
00035 area_read "area5.txt" "area5"  
00036  
00037 ##
00038 ## construct grid 
00039 ##
00040 grid_get -12 12 0.2 -12 12 0.2 
00041  
00042 ##
00043 ## create gridding rules
00044 ##
00045 
00046 # resulting surface in area = value... 
00047 area 10 "area1"  
00048 
00049 # resulting surface in area = value... 
00050 area 30 "area3"  
00051 
00052 # resulting surface in area = value... 
00053 area undef "area5"  
00054 
00055 # resulting surface should tend to be constant or plane 
00056 completer 1 1.6  
00057 
00058 # add "resulting surface in area = value..." with weight 
00059 area_add 20 0.07 "area2"  
00060 
00061 # add "resulting surface in area = value..." with weight 
00062 area_add 40 0.07 "area4"  
00063 
00064 ##
00065 ## run gridding algorithm
00066 ##
00067 surfit 
00068 
00069 ##
00070 ## save results 
00071 ##
00072 
00073 # unload grid from memory
00074 grid_unload 
00075 
00076 # save surface to surfit datafile 
00077 surf_save "area.dat" "map_area" 



surfit: open source gridding and contouring software.