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.

Re: [netcdfgroup] Subsetting data with C++ API calls

Taylor,
  I can't help thinking that the C++ library you are using seems a little more 
brittle than the C route at this phase in its evolution.  Have you considered 
making calls to the C API from your C++ call?  THe methods for extracting 
subsets of variables are quite clear in the C API...

On Mar 3, 2013, at 4:34 PM, Taylor Binnington <tbinnington@xxxxxxxxx> wrote:

> Hello,
> 
> I'm attempting to read only certain parts (specific indices of specific 
> variable arrays), remotely, from a MERRA HDFEOS file.
> 
> I've recently upgraded to NetCDF 4.2.1.1, using Lynton's C++ library. At 
> first, I was using trying to subset the data directly from an OPeNDAP URL 
> supplied to NcFile, but it's been suggested to me, by an earlier post in the 
> OPeNDAP forums, that this is not a good way to go. Instead, I should use 
> NetCDF API calls.
> 
> I have carefully read through the C++ interface guide, including this example:
> 
> http://www.unidata.ucar.edu/software/netcdf/docs/cxx4/test_var_8cpp-example.html
> 
> but am struggling to understand how to do this. A push in the right direction 
> would be very appreciated. The example (I don't fully understand it, but was 
> trying to emulate some of the example that I linked above)
> 
> #include <iostream>
> #include <netcdf>
> int main() {
> NcFile 
> dataFile("http://goldsmr2.sci.gsfc.nasa.gov/opendap/hyrax/MERRA/MAT1NXSLV.5.2.0/1991/01/MERRA100.prod.assim.tavg1_2d_slv_Nx.19910101.hdf";,
>  NcFile::read);
> NcGroup grouptest(dataFile.addGroup("Dataset"));
> }
> 
> gives me the error:
> 
> terminate called after throwing an instance of 'netCDF::exceptions::NcNotNc4'
>   what():  NcNotNc4: Attempting netcdf-4 operation on netcdf-3 file.
> file: ncGroup.cpp  line:265
> Aborted
> 
> This is not surprising, since the file is not a NetCDF-3 file.
> 
> Thank you in advance.
> Taylor
> 
> -- 
> Taylor Binnington
> e. tbinnington@xxxxxxxxx
> 
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe,  visit: 
> http://www.unidata.ucar.edu/mailing_lists/

--
Dr. Christopher Lynnes, NASA/GSFC, ph: 301-614-5185





  • 2013 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: