火曜日, 11月 01, 2011

離散データをグリッドデータへ(English) : from discretized data to grid data with using 'dgrid3d'

According to statistics of my blog,
'dgrid3d' utilization article described in Japanese have been often referred.
So, I have written it down in following  English description.

----------------------

We assume discretized data array were prepared, and
we use 'dgrid3d' utility command in gnuplot.

Because I have ever wanted to obtain grid interpolated data
with using neighboring some specific points.
----------------------

Following description is ideal data handling.

At first, we prepare contourline map like this.

 I created this image with free hand.
So, this is something messy.
----------------------

As a second phase, we obtain aligned plot data, in order of x,y,z ,
with following:


### X, Y, Z  ###
0.000000  250.000000 40.0
12.886600  244.845000 40.0
25.773200  238.402000 40.0
36.082500  225.515000 40.0
43.814400  208.763000 40.0
42.525800  192.010000 40.0
37.371100  175.258000 40.0
34.793800  161.082000 40.0
30.927800  149.485000 40.0
......
##
##
### X, Y, Z  ###
217.784000  104.381000 40.0
206.186000  99.226800 40.0
190.722000  97.938100 40.0
175.258000  88.917500 40.0
166.237000  85.051500 40.0
159.794000  76.030900 40.0
158.505000  64.433000 40.0
164.948000  60.567000 40.0
181.701000  64.433000 40.0
195.876000  68.299000 40.0



Subsequently, we plot this data with using gnuplot.
In case of normal mode, we can obtain this image.




the  figure above is created with 'with line' and 'with point' options of gnuplot.

Additonaly, we type in console following commands.


gnuplot> set dgrid3d 50, 50, 4 
gnuplot> splot "./map.lne" u 1:2:3 w l





we can obtain above image.
this diagram is shown with grid line.


All we need is to obtain this grid line data
in the form of grid ascii data.
----------------------
 As a third phase,

we type following commands,

gnuplot> set output "output.dat"
gnuplot> set table
gnuplot> replot



at this point, display  images is not changed.
however, 'output.dat' is created in current working directory.

----------------------

the contents of 'output.dat' is following:

 #Surface 0 of 1 surfaces

#IsoCurve 0, 50 points
#x y z type
 500  30.9278  41.6448 i
 500  40.4744  41.2966 i
 500  50.021  41.0037 i
 500  59.5676  40.7681 i
 500  69.1142  40.5872 i
 500  78.6608  40.4556 i
 


*snip*


 500  441.431  43.7643 i
 500  450.978  44.197 i
 500  460.525  44.6666 i
 500  470.071  45.1702 i
 500  479.618  45.7076 i
 500  489.164  46.2796 i
 500  498.711  46.8864 i

#IsoCurve 1, 50 points
#x y z type
 489.796  30.9278  41.2901 i
 489.796  40.4744  40.945 i
 ....


*snip*

 10.2041  489.164  43.1522 i
 10.2041  498.711  43.8984 i

#IsoCurve 49, 50 points
#x y z type
 0  30.9278  45.5525 i
 0  40.4744  45.1661 i
 0  50.021  44.7526 i
 0  59.5676  44.2973 i
 0  69.1142  43.7911 i
 

*snip*


 0  470.071  42.2797 i
 0  479.618  43.0064 i
 0  489.164  43.7655 i
 0  498.711  44.5343 i


 ----------------------
When I found out it, very impressed.
How about you?
----------------------


gnuplot> set dgrid3d 50, 50, 4
  



where, 50 and 50 indicate 50x50 grid data,
'4' is for weighting coefficient of 'power'.
----------------------



----------------------

0 件のコメント:

コメントを投稿