NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
"From: Bill Hibbard " wrote: > where samples is an array float[3][number_of_samples]. > Before the constructor call, put in a loop like: > > for (int i=0; i<number_of_samples; i++) { > float x = samples[0][i]; > float y = samples[1][i]; > float z_surface = some_function_of(x, y); > samples[2][i] = z_surface - samples[2][i]; > } > Set set = new Gridded3DSet(set_type, samples, ...); > > This will convert your surface-relative depths to altitude > above sea level, which can be converted to any other > absolute depth measure. thanks, bill. it occurs to me that i may have a way of doing this that doesn't involve creating a new Gridded3DSet. it depends on whether i grok the semantics of getSamples(). my data are handed to me in a netCDF file, and i'm using Plain to extract 'em. if i plunge down through the various constructs in my data, i eventually reach something that looks like: Tuple aDay = (Tuple) (modelRun.getSample(0)); // there's an extraneous datum in the tuple, so we get component 1, not 0 FlatField aGrid = (FlatField) (aDay.getComponent(1)); Gridded3DSet aDomain = (Gridded3DSet) (aGrid.getDomainSet()); float[][] samples = aDomain.getSamples(false); // don't copy int number_of_samples = samples[0].length; now, if i understand how the copy parameter to getSamples works, i can just dive into the for-loop you describe above. it'll reach in and convert depth to altitude on the existing data set, no? rw
visad
archives: