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.

[netcdfgroup] Reading MERRA HDF-EOS data with NetCDF C++ libraries

Hello (again),
I have netcdf-4.2.1-13.2 libraries installed on my openSUSE 12.1 machine. I
am trying to open a MERRA data file from within a C++ program, using
OPeNDAP.

A sample test.cpp program is below, which I compile using g++ test.cpp
-lnetcdf_c++ ,

#include<iostream>
#include<netcdfcpp.h>
int main()
{
   NcFile dataFile ("
http://goldsmr2.sci.gsfc.nasa.gov/opendap/MERRA/MAT1NXSLV.5.2.0/1979/01/MERRA100.prod.assim.tavg1_2d_slv_Nx.19790101.hdf";,
NcFile::ReadOnly);

   if(!dataFile.is_valid()){
      cout << "Failed" << endl;
      return 2;}
   cout << "Okay" << endl;
   return 0;
}

returns "Failed". Opening the local file
MERRA100.prod.assim.tavg1_2d_slv_Nx.19790101.hdf.nc (obtained by converting
to *.nc from the same OPeNDAP server, as was recommended to me in this
post:
https://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2013/msg00008.html)
returns "Okay". Material here (
http://www.hdfeos.org/workshops/ws13/presentations/day3/PRACTICAL_METHODS_FOR_MAKING_HDF_DATA_USABLE.pdf,
beginning on page 24) leads me to believe that I simply can not use NetCDF
libraries to open MERRA files with OPeNDAP.

How, if possible, can I modify test.cpp to remotely open a MERRA data file,
without having to first download it to my computer? Thank you for any help.

P.S. Please do not think that I have ignored earlier replies (I appreciate
them!), I've spent quite a lot of time on this recently.



-- 
Taylor Binnington
e. tbinnington@xxxxxxxxx
c. 647 926 4144
  • 2013 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: