Hi John,
John Caron wrote:
Tom Rink wrote:
Hi,
How can skip or stride reading be done in the Java
implementation of NetCDF? Is there an equivalent
operation?
Tom Rink
Hi Tom:
I seem to have overlooked implementing a stride-based read, probably
because the original (version 1) library doesnt have one. I will add
this to the to-do list.
Meanwhile, you can get a strided subset of an Array, which will be
equivilent except that you probably have to read more than you need:
Suppose you have a 3D Array, and you want to access it with stride 2,
1, and 3 in the three dimensions. The following will give you a
logical view of the data with those strides, using the same backing
data as the original:
Array data = var.read();
int[] shape = data.getShape();
Array dataS;
Range[] ranges = new Range[] { new Range(0,shape[0]-1, 2), null, new
Range(0,shape[2]-1, 3) };
try {
dataS = data.section( ranges);
} catch (InvalidRangeException e) {
System.out.println("testStride failed == "+ e);
}
Thanks for the work-around, but the read() in this case would be much
too much: I have MODIS
on a remote server that I'm accessing via DODS and I want to produce a
low-res image
of the entire swath so the user can decide what channels or regions
are important,
then subsetting/slicing can be used to focus on the point of interest.
For now, I'll have to sub-sample on the client, Is there any way to know
when the stride capability will be implemened?
Thanks again for you help,
Tom