Bug 102898 - modified netCDF datasource reader: problems with plots
Summary: modified netCDF datasource reader: problems with plots
Status: RESOLVED NOT A BUG
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-31 01:41 UTC by Kimberly Scott
Modified: 2005-04-04 21:37 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
.desktop file for netCDF datasource reader (1.67 KB, application/octet-stream)
2005-03-31 01:49 UTC, Kimberly Scott
Details
header file for netCDF datasource reader (1.95 KB, text/x-c-header)
2005-03-31 01:50 UTC, Kimberly Scott
Details
source code for netCDF datasource reader (8.42 KB, text/plain)
2005-03-31 05:45 UTC, Kimberly Scott
Details
.kst file (12.67 KB, text/xml)
2005-03-31 05:50 UTC, Kimberly Scott
Details
first patch (4.80 KB, patch)
2005-04-01 16:39 UTC, George Staikos
Details
cpp file (7.44 KB, text/x-c++src)
2005-04-04 21:13 UTC, George Staikos
Details
header file (1.95 KB, text/x-c++hdr)
2005-04-04 21:14 UTC, George Staikos
Details
updated kst file (1.67 KB, application/x-desktop)
2005-04-04 21:14 UTC, George Staikos
Details
Updated kst file (12.15 KB, text/plain)
2005-04-04 21:16 UTC, George Staikos
Details
cpp file (7.60 KB, text/x-c++src)
2005-04-04 21:37 UTC, George Staikos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kimberly Scott 2005-03-31 01:41:06 UTC
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.
Comment 1 Kimberly Scott 2005-03-31 01:49:25 UTC
Created attachment 10440 [details]
.desktop file for netCDF datasource reader
Comment 2 Kimberly Scott 2005-03-31 01:50:01 UTC
Created attachment 10441 [details]
header file for netCDF datasource reader
Comment 3 Kimberly Scott 2005-03-31 05:45:26 UTC
Created attachment 10446 [details]
source code for netCDF datasource reader
Comment 4 Kimberly Scott 2005-03-31 05:50:06 UTC
Created attachment 10447 [details]
.kst file
Comment 5 Kimberly Scott 2005-03-31 17:56:44 UTC
All of the files can be downloaded from:

http://www.astro.umass.edu/~wilson/kstbugreport/nc_datasource_files.tgz
Comment 6 George Staikos 2005-04-01 06:34:13 UTC
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.
Comment 7 George Staikos 2005-04-01 16:39:55 UTC
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.
Comment 8 George Staikos 2005-04-04 21:13:24 UTC
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.
Comment 9 George Staikos 2005-04-04 21:14:17 UTC
Created attachment 10512 [details]
header file

Header to go with the cpp file.
Comment 10 George Staikos 2005-04-04 21:14:58 UTC
Created attachment 10513 [details]
updated kst file
Comment 11 George Staikos 2005-04-04 21:15:38 UTC
Comment on attachment 10513 [details]
updated kst file

Oops, mistake
Comment 12 George Staikos 2005-04-04 21:16:11 UTC
Created attachment 10514 [details]
Updated kst file

Here is the updated kst file for real.
Comment 13 George Staikos 2005-04-04 21:37:24 UTC
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
Comment 14 George Staikos 2005-04-04 21:37:41 UTC
Not a Kst bug.