Version: 1.1.0 (using KDE KDE 3.3.2) My modified version of the netCDF datasource reader is able to read netCDF files that have fields with multiple samples per frame, and it seems to be reading files just fine. However, when we declare new vectors of our variables and try to plot curves, we do not see what we expect. Considering just two of our variables, "sf" is a field with one sample per frame, while "mf" has 64 samples per frame. sf is a counter, so it's vector values are like those for the "INDEX" field. mf counts from 0 to 63 within each frame of sf. I am trying to plot mf vs. sf. In the "New Vector" window, I choose the field sf, set the "Range" to 100, and indicate to count from the end of the file. The "Units" is set to frames, which seems to be the only option as of now. I do the same for the field mf, again setting the "Range" to 100, as I am expecting Kst to read 100 frames of data for the mf variable (that is, 100 x 64 samples for mf). When I plot mf vs. sf, I expect to see a "saw-tooth" pattern, with mf going from 0 to 63 within one frame of sf, dropping to zero at the start of the next frame of sf, and repeating this pattern 100 times. Instead, I only see 100 samples for mf plotted, starting with the first sf value. It seems that Kst is only plotting the first 100 samples for mf, not 100 frames. I am unsure if this is an issue with our datasource reader, or with the way that Kst thinks about frames and samples. The "Units" option in the "New Vector" window is set to frames, so I expect to be grabbing 100 frames of data, but it looks like for fields with multiple samples per frame, it only grabs 100 samples. Do you know why Kst does this? I am attaching copies of my modified code for the netCDF datasource reader, the .nc file I am using, and the .kst file of my sample plots. The "h0b8" field has 64 samples per frame like mf. The values of h0b8 are not important.
Created attachment 10440 [details] .desktop file for netCDF datasource reader
Created attachment 10441 [details] header file for netCDF datasource reader
Created attachment 10446 [details] source code for netCDF datasource reader
Created attachment 10447 [details] .kst file
All of the files can be downloaded from: http://www.astro.umass.edu/~wilson/kstbugreport/nc_datasource_files.tgz
The first problem is related to update. The datasource is making Kst think there is new data when there is not. I'll look at the source tomorrow to see where the problem is.
Created attachment 10471 [details] first patch This patch gets things started. A few problems fixed: 1) properly delete the ncfile object 2) don't use global variables. this is multi-threaded code and that will cause memory errors 3) initialize ncfile variable 4) a start at fixing readField() and general logic. The problem is that Kst thinks there is more data, but there isn't. Don't try to interpolate inside the datasource, let Kst do it. If the patch doesn't compile for you, it's probably because you're using an older Kst than the one in CVS. In that case, you can remove the setLastUpdateResult() and lastUpdateResult() changes.
Created attachment 10511 [details] cpp file This source file fixes almost all of the problems. There is still an issue with Kst thinking there is more data though. I'm working on it.
Created attachment 10512 [details] header file Header to go with the cpp file.
Created attachment 10513 [details] updated kst file
Comment on attachment 10513 [details] updated kst file Oops, mistake
Created attachment 10514 [details] Updated kst file Here is the updated kst file for real.
Created attachment 10515 [details] cpp file Ok, this fixes everything. The problems were all in the data source, not in Kst. Some of them included: 1) n=-1 means read 1 sample, not 1 frame 2) return the right amount of data 3) update properly 4) return proper values for frame count and samples per frame
Not a Kst bug.