Index subsetting on OPeNDAP sequences.


Bob Simons wrote:


John Caron wrote:

great, thanks. Do you have a URL where this happens?


"http://oceanwatch.pfeg.noaa.gov:8081/dods/GLOBEC/GLOBEC_MOC1?abund_m3,lat,long";


Bob Simons wrote:

In case you haven't been able to find the problem with variable.read(rowOrigin, rowShape) returning a full-sized Array that I mentioned before, I can provide more information:

The problem occurs with
   NetcdfDataset ncDataset = NetcdfDataset.openDataset(fullFileName);
where the fullFileName is an OPeNDAP sequence url.
The variables are found via
   structure = (Structure)rootGroupVariables.get(v);
then
   structure.getVariables()

The problem does not occur with a
   NetcdfFile ncFile = new NetcdfFile(fullFileName);
where fullFileName is a .nc file on my hard drive.
and where the variables are found via
   List variableList = ncFile.getVariables();

The variables are ArrayXxx.1D Arrays.

If I'm doing something wrong, please let me know. I'm still stumbling around trying to figure out how to do things.

I wrote a work-around in my code for the bug, so a fix isn't urgent.


Hi Bob, thanks for the info. The problem is that this is a sequence, which in 
the DAP-2 spec, doesnt allow index subsetting. (Probably I should throw an 
Exception if you try?)

The DDS is:

Dataset {
   Sequence {
       String date;
       String year;
       String program;
       String cruise_id;
       Int16 cast_no;
       String stn_id;
       Float64 lat;
       Float64 long;
       Int16 water_depth;
       Byte sample_id;
       Float64 min_sample_depth;
       Float64 max_sample_depth;
       Byte month_local;
       Int16 day_local;
       Int16 time_local;
       String d_n_flag;
       String gear_type;
       Byte gear_area_m2;
       Float64 gear_mesh;
       Float64 vol_filt;
       String counter_id;
       String comments;
       String perc_counted;
       String local_code;
       String nodc_code;
       String genus_species;
       String life_stage;
       Float64 abund_m3;
   } MOC1;
} MOC1;

This gives a netcdf file as:

netcdf dods://oceanwatch.pfeg.noaa.gov:8081/dods/GLOBEC/GLOBEC_MOC1 {
variables:
  Structure {
    String date;
      :long_name = "Date";
    String year;
      :long_name = "Year";
    String program;
      :long_name = "Program";
    String cruise_id;
      :long_name = "Cruise ID";
    short cast_no;
      :long_name = "Cast No";
    String stn_id;
      :long_name = "Station ID";
    double lat;
      :long_name = "Latitude";
    double long;
      :long_name = "Longitude";
    short water_depth;
      :long_name = "Water Depth";
    byte sample_id;
      :_unsigned = "true";
      :long_name = "Sample ID";
    double min_sample_depth;
      :long_name = "Minimum Sample Depth";
    double max_sample_depth;
      :long_name = "Maximum Sample Depth";
    byte month_local;
      :_unsigned = "true";
      :long_name = "Month Local";
    short day_local;
      :long_name = "Day Local";
    short time_local;
      :long_name = "Time Local";
    String d_n_flag;
      :long_name = "d_n_flag";
    String gear_type;
      :long_name = "Gear Type";
    byte gear_area_m2;
      :_unsigned = "true";
      :long_name = "Gear Area m2";
    double gear_mesh;
      :long_name = "Gear Mesh";
    double vol_filt;
      :long_name = "Volume Filtered";
    String counter_id;
      :long_name = "Counter Id";
    String comments;
      :long_name = "Comments";
    String perc_counted;
      :long_name = "Percentage Counted";
    String local_code;
      :long_name = "Local Code";
    String nodc_code;
      :long_name = "NODC Code";
    String genus_species;
      :long_name = "Genus Species";
    String life_stage;
      :long_name = "Life Stage";
    double abund_m3;
      :long_name = "Abundance m3";
  } MOC1(*);
}

The MOC1(*) means "variable length array". Thats how we are doing sequences 
right now. If you go to

http://oceanwatch.pfeg.noaa.gov:8081/dods/GLOBEC/GLOBEC_MOC1.html

Youll notice that you can only get all the values, (or you can add a relational 
constraint, which we are not currently supporting).

Anyway, we are still figuring out how to support sequences properly. Sorry for 
the confusion.

John.

PS: I hope you dont mind im cc'ing to netcdf-java email group since this is 
something others may be interested in.