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.
Hi Taylor: Having a reproducible example helps. I believe the URL you are using will use the http service, which will indeed downlaod the HDF file. For the OpeNDAP response using instead (i didn't check that we are pointing at the same file): http://goldsmr2.sci.gsfc.nasa.gov/opendap/hyrax/MERRA/MAT1NXSLV.5.2.0/1979/01/MERRA100.prod.assim.tavg1_2d_slv_Nx.19790101.hdf The way I got this is from: http://goldsmr2.sci.gsfc.nasa.gov/opendap/hyrax/MERRA/MAT1NXSLV.5.2.0/1979/01/contents.html I asked for the html response, which takes me to a page that will show be the URL for an OPeNDAP request among other things, that is to the page: http://goldsmr2.sci.gsfc.nasa.gov/opendap/hyrax/MERRA/MAT1NXSLV.5.2.0/1979/01/MERRA100.prod.assim.tavg1_2d_slv_Nx.19790101.hdf.html If you only want part of the file, you can include the constraints in the URL. HTH. -Roy On Jan 18, 2013, at 3:59 PM, Taylor Binnington <tbinnington@xxxxxxxxx> wrote: > 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 > _______________________________________________ > netcdfgroup mailing list > netcdfgroup@xxxxxxxxxxxxxxxx > For list information or to unsubscribe, visit: > http://www.unidata.ucar.edu/mailing_lists/ ********************** "The contents of this message do not reflect any position of the U.S. Government or NOAA." ********************** Roy Mendelssohn Supervisory Operations Research Analyst NOAA/NMFS Environmental Research Division Southwest Fisheries Science Center 1352 Lighthouse Avenue Pacific Grove, CA 93950-2097 e-mail: Roy.Mendelssohn@xxxxxxxx (Note new e-mail address) voice: (831)-648-9029 fax: (831)-648-8440 www: http://www.pfeg.noaa.gov/ "Old age and treachery will overcome youth and skill." "From those who have been given much, much will be expected" "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
netcdfgroup
archives: