Version: 1.9.0_devel (using Devel) OS: Linux Installed from: Compiled sources PROBLEM: data files in dirfile format (Dirfile Standards version 7) cannot be recognized by kst 1.9_devel STEPS TO REPRODUCE: 1)use the following code to generate data files: #include <getdata.h> #include <stdlib.h> #include <stdio.h> int main(void) { /* dirfile name */ const char *dirfile_name = "/home/freebody/test_dirfile"; /* field code */ const char *field_code = "datafield"; gd_type_t data_type = GD_FLOAT64; gd_spf_t spf = 5; int fragment_index = 0; off_t first_frame = 0; off_t first_sample = 0; size_t num_frames = 100; /* Open the dirfile */ DIRFILE *dirfile = dirfile_open(dirfile_name, GD_RDWR|GD_CREAT|GD_TEXT_ENCODED); /**/ if (get_error(dirfile)) { printf("GetData error: failed to create a datafile\n"); dirfile_close(dirfile); exit(1); } /* Add a raw field*/ dirfile_add_raw(dirfile, field_code, data_type, spf, fragment_index); /* Allocate a buffer */ double *data_buffer = malloc(sizeof(double) * spf * (num_frames - first_frame)); /* Fill up the buffer */ int i = 0; int count = 0; for (i=0; i<spf * (num_frames - first_frame); i++) { data_buffer[i] = count - 25.0; count++; } /* Write the dirfile*/ putdata(dirfile, field_code, first_frame, 0, num_frames - first_frame, 0, data_type, data_buffer); if (get_error(dirfile)) { printf("GetData error: failed to write the datafile\n"); dirfile_close(dirfile); exit(1); } /* Clean up */ free(data_buffer); dirfile_close(dirfile); return 0; } 2)open data wizard in kst. RESULTS: Files created by the above code are not recognized as dirfiles. I also tried other encodings; not working either. EXPECTED RESULTS: kst should load dirfiles properly.
Sounds like your kst is using the (old, deprecated) internal dirfile reader, rather than using libgetdata. Can you confirm that configure (or cmake) properly located libgetdata so that it was used during compile time?
Matt, are you saying that you've tried this and found it to work okay with kst and the external getdata? On my machine with kst 1.9.0_devel and getdata 0.6.0 the data cannot be read in. Andrew
Whoops. No. I've only tried this with 1.8.0.
Although I think if it works in 1.8.0 then it should also work in 1.9.0_devel, as I don't think that the dirfile has changed between the two versions (other than to insist on at least version 0.6.0 of getdata because of other problems with earlier versions). We'll investigate further.
with kst1.9.0_devel and external getdata(0.6.1): in the data wizard, after the data folder is selected, kst recognized it as "Directory of Binary Files". When hitting "finish", kst displays an error message "Sorry, unable to load the data file '/home/freebody/test_dirfile/'." with kst1.9.0_devel and internal dirfile reader: in the data wizard, after the data folder is selected, the "next" button is greyed out.
with kst1.9.0_devel and external getdata(0.6.1): if replace GD_TEXT_ENCODED with GD_UNENCODED(or just simply delete GD_TEXT_ENCODED), kst can successfully plot files genereated by the code. It seems kst cannot recognize encoded dirfiles.
This appears to be a problem exclusively with the getdata library and/or its interaction with the dirfile datasource. After some simple testing it seems that the first call to GetNFrames returns 100 (indicating support for the data) but all subsequent calls return 0.
There appears to be some memory corruption somewhere in the GetData legacy API. I'm looking into it.
Yeah, the GetData developer should be flogged. He was overwriting the name of the ASCII data file with the data IN the file. I'll see if I can't put out a 0.6.2 later today or tomorrow that fixes the problem.
Created attachment 40866 [details] Patch to GetData-0.6.1 to fix ASCII get_n_frames. Although, if you really don't want to wait, here's a patch to GetData-0.6.1.
The problem is the result of memory corruption in the getdata library. This is being addressed in getdata 0.6.2