DaniSb170 / nctoolbox

Automatically exported from code.google.com/p/nctoolbox
0 stars 0 forks source link

Add support for nested datasets (new feature in Netcdf4) #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Download ftp://ftp.ncdc.noaa.gov/pub/download/CrIS_CRDR_Filled_v0.6_Draft.nc
2. In Matlab try: 
  >> nc = ncdataset(url);
  >> d = nc.data('Interferogram/UntrimmedDetectorData/igm_idat_lw')

What is the expected output? What do you see instead?

  >> d = ds.data('Interferogram/UntrimmedDetectorData/igm_idat_lw')
  ??? Attempt to reference field of non-structure array.

  Error in ==> ncdataset>ncdataset.data at 177
                  array = v.read();

Here's the first part of the CDL for the offending file:

netcdf /Users/brian/Desktop/CrIS_CRDR_Filled_v0.6_Draft.nc {
 dimensions:
   cris_rdr_scans_index = 4;
   cris_band_id = 3;
   cris_fov_index = 9;
   stage_index = 4;
 variables:
   String cris_band_id(cris_band_id=3);

 Group Calibration_Data {
   variables:
     byte instrument_id(cris_rdr_scans_index=4);
       :valid_min = 0UB; // byte
       :valid_max = 31UB; // byte
       :_FillValue = -7UB; // byte
       :long_name = "Instrument ID";
       :source = "APID1289:Calibration_Data_InstrumentID";
       :_Unsigned = "true";
     short pceappfswver(cris_rdr_scans_index=4);
       :valid_min = 0US; // short
       :valid_max = 2047US; // short
       :_FillValue = -7US; // short
       :long_name = "PCE Application FSW Version";
       :source = "APID1289:Calibration_Data_PCEAppFSWVer";
       :_Unsigned = "true";

   Group Epoch1to40_Info {
     dimensions:
       epoch1_index = 40;    
     variables:
       short iecca_calib_resistor_temp(cris_rdr_scans_index=4, epoch1_index=40);
         :valid_min = -8192S; // short
         :valid_max = 8191S; // short
         :_FillValue = -993S; // short
         :long_name = "IE CCA Cal Resistor Temp";
         :source = "APID1289:Calibration_Data_IECCACalibResistorTemp";
       short low_range_calib_resistor(cris_rdr_scans_index=4, epoch1_index=40);
         :valid_min = -8192S; // short
         :valid_max = 8191S; // short
         :_FillValue = -993S; // short
         :long_name = "Low Range Cal Resistor";
         :source = "APID1289:Calibration_Data_LowRangeCalibResistor";
       short high_range_calib_resistor(cris_rdr_scans_index=4, epoch1_index=40);
         :valid_min = -8192S; // short
         :valid_max = 8191S; // short
         :_FillValue = -993S; // short
         :long_name = "High Range Cal Resistor";
         :source = "APID1289:Calibration_Data_HighRangeCalibResistor";
       short ict_temp1(cris_rdr_scans_index=4, epoch1_index=40);
         :valid_min = -8192S; // short
         :valid_max = 8191S; // short
         :_FillValue = -993S; // short
         :long_name = "ICT Temp 1";
         :source = "APID1289:Calibration_Data_ICTTemp#1";
       short ict_temp2(cris_rdr_scans_index=4, epoch1_index=40);
         :valid_min = -8192S; // short
         :valid_max = 8191S; // short
         :_FillValue = -993S; // short
         :long_name = "ICT Temp 2";
         :source = "APID1289:Calibration_Data_ICTTemp#2";
   }

...

}

Original issue reported on code.google.com by bschlin...@gmail.com on 16 May 2011 at 9:07

GoogleCodeExporter commented 8 years ago
Im pretty sure this has to do with escaping the variable names before getting 
the netcdf variable object.

Original comment by crosb...@gmail.com on 16 May 2011 at 9:14

GoogleCodeExporter commented 8 years ago
Yep, you're right. When I comment out line 173 in ncdataset.m, it works. The 
offending line is:
  variable = ucar.nc2.NetcdfFile.escapeName(variable);

Original comment by bschlin...@gmail.com on 16 May 2011 at 9:23

GoogleCodeExporter commented 8 years ago
The current workaround is to comment out line 173. I added the escapeName line 
to handle some datasets that required it. I can put in a workaround to:
1. Try accessing the data without escaping the name
2. If that throws an Exception, escape the variable name and retry 

Original comment by bschlin...@gmail.com on 16 May 2011 at 9:28

GoogleCodeExporter commented 8 years ago
Posted a fix as outlined in the comment above. It's been pushed to the google 
code repo.

Original comment by bschlin...@gmail.com on 16 May 2011 at 9:40

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago

Original comment by bschlin...@gmail.com on 16 May 2011 at 9:46