From: Daniel J S. <dan...@ie...> - 2004-08-15 21:42:40
|
Daniel J Sebald wrote: > binary {3 | xy | xyz | xyzc} {format="string"} {endian=little} Or perhaps a better way of doing this would be binary {#} {columns} {format="string"} {endian=big} Here binary # : Matrix format, # specifies the number of components per matrix element. binary # columns : Binary data has # columns of "string" data format. How's that? No user functions, no strings, but I think that would cover most applications that use temporary data as opposed to, say, archived ascii where strings etc. are useful. I could implement that as df_readbinary() fairly easily. That would allow binary data for 2D data. So, how about 3D data? It already exists. But let's examine its structure. Basically, inside plot3d.c is the following: if (df_matrix) xdatum = df_3dmatrix(this_plot, NEED_PALETTE(this_plot)); else { <snip> while ((j = df_readline(v,MAXDATACOLS)) != DF_EOF) { Inside of df_3dmatrix is some code that looks very similar similar to df_readline (with using specs, etc.... maybe "using" can't be discarded afterall) , but instead df_3dmatrix does the work of storing the data in the plot structure, rather than passing data back to plot3d.c for interpretting. The question I pose is could df_3dmatrix be replaced by df_readline() which uses df_readbinary internally? The advantage of df_3dmatrix() is that it has a short little loop to do the storage rather than passing back a v[] vector. However, it isn't consistent with the most predominant gnuplot "paradigm" for interpretting and storing data. Plus, if there is a df_readline() which is very similar to df_3dmatrix, it is a bit of code repetition. Now, I know Ethan would like to pass in the plot structure pointer to the reading routine. Perhaps then the idea is to move away from that strategy, and df_3dmatrix is more the desired model. Here are some interesting comments from the code and online help: /* FIXME HBB 20001207: doesn't respect 'index' at all, even though it * could, and probably should. */ static float ** df_read_matrix(int *rows, int *cols) The `index` keyword is not supported, since the file format allows only one surface per file. The `every` and `using` filters are supported. `using` operates as if the data were read in the above triplet form. So, it seems maybe its desirable to have 'using' as part of the binary command. But, I don't think 'index' works from what is in a gnuplot-binary file. There is only the value <N+1> at the start of the file, not the other dimension. So there is no way of knowing when to end one record without something like "record=120x150". But, I'm drifting to the geezer camp, not allowing more than one record per file. Dan |