Hi All,
I'm trying to read an opendap url using a contraint expression in
NetCDF-Java. I checked out the thredds source code and built the latest
version (4.3.9-SNAPSHOT). It *sort of* works but I'm confused about reading
data. Here's my example:
% Note I'm testing this in Matlab. so the code may look like pseudo code.
nc = ucar.nc2.dataset.NetcdfDataset.openDataset('
http://geoport.whoi.edu/thredds/dodsC/examples/OS_M1_20081008_TS.nc?PSAL[0:1:100][0:1:0][0:1:0][0:1:0]'
);
vs = nc.getVariables;
psal = vs.get(0)
psal =
float PSAL(TIME=101, DEPTH=1, LATITUDE=1, LONGITUDE=1);
:_CoordinateAxes = "TIME DEPTH LATITUDE LONGITUDE ";
:missing_value = -1.0E34f; // float
:_FillValue = -1.0E34f; // float
:long_name = "Hourly sea_water_salinity";
:units = " ";
:standard_name = "sea_water_salinity";
:uncertainty = "0.02";
:valid_min = "30";
:valid_max = "36";
:cell_methods = "time: mean";
:history = "From m1_ctd0001_20081008_original";
% SO the above code worked as expected and everything looks good.
% However when I read the data like so:
array = psal.read()
psalData = array.copyToNDJavaArray();
size(psalData)
ans =
9043 11
???? I was expecting an array with a size of 101 by 1 as defined in the
contraint expression, but it returns the full 9043 by 11 psal dsdata set.
Is there a different way I'm supposed to read the data when a constraint
expression is used? Any guidance on this would be appreciated.
Cheers
-- B
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Brian Schlining
bschlining@xxxxxxxxx
Monterey Bay Aquarium Research Institute