OPenDAP url read error in Matlab

300 views
Skip to first unread message

Kelsey Brunner

unread,
Jul 21, 2016, 6:02:23 PM7/21/16
to sup...@unidata.ucar.edu
Hello,

I am a physical oceanography PhD student at Stony Brook University and I am trying to obtain hourly verified water level data (MSL) from tide gauge 8534720 in Atlantic City, NJ between January 1, 1996 and January 1, 2016. I am using the DODS access form http://opendap.co-ops.nos.noaa.gov/dods/IOOS/Hourly_Height_Verified_Water_Level.html and selecting the variables DATE_TIME, WL_VALUE, SIGMA, and I to get the provided OPeNDAP url http://opendap.co-ops.nos.noaa.gov/dods/IOOS/Hourly_Height_Verified_Water_Level?WATERLEVEL_HOURLY_VFD_PX._STATION_ID,WATERLEVEL_HOURLY_VFD_PX._DATUM,WATERLEVEL_HOURLY_VFD_PX._BEGIN_DATE,WATERLEVEL_HOURLY_VFD_PX._END_DATE,WATERLEVEL_HOURLY_VFD_PX.DATE_TIME,WATERLEVEL_HOURLY_VFD_PX.WL_VALUE,WATERLEVEL_HOURLY_VFD_PX.SIGMA,WATERLEVEL_HOURLY_VFD_PX.I&WATERLEVEL_HOURLY_VFD_PX._STATION_ID=8534720&WATERLEVEL_HOURLY_VFD_PX._DATUM=MSL&WATERLEVEL_HOURLY_VFD_PX._BEGIN_DATE=19960101&WATERLEVEL_HOURLY_VFD_PX._END_DATE=20160101. However, when I attempt to access and download the data in Matlab (using either ncdisp to simply display information about the data or ncread to actually access the data), the OPeNDAP URL is not recognized and I get the following error message: "Error using netcdflib. Unable to open file. File may be corrupt or filename may have invalid characters. If the data source was an OPeNDAP URL, see the OPeNDAP Troubleshooting section in the Users Guide.” I would appreciate any help in determining the source of the error. I have used Matlab to access OPenDAP data in the past without any issues. 

Regards,

Kelsey Brunner
School of Marine and Atmospheric Sciences
Stony Brook University 
Stony Brook, NY 11794
kelsey....@stonybrook.edu

James Gallagher

unread,
Jul 21, 2016, 10:46:42 PM7/21/16
to Kelsey Brunner, Support Unidata, support@opendap.org support
On Jul 21, 2016, at 5:35 PM, Kelsey Brunner <kelsey....@stonybrook.edu> wrote:

Hello,

I am a physical oceanography PhD student at Stony Brook University and I am trying to obtain hourly verified water level data (MSL) from tide gauge 8534720 in Atlantic City, NJ between January 1, 1996 and January 1, 2016. I am using the DODS access form http://opendap.co-ops.nos.noaa.gov/dods/IOOS/Hourly_Height_Verified_Water_Level.html and selecting the variables DATE_TIME, WL_VALUE, SIGMA, and I to get the provided OPeNDAP url http://opendap.co-ops.nos.noaa.gov/dods/IOOS/Hourly_Height_Verified_Water_Level?WATERLEVEL_HOURLY_VFD_PX._STATION_ID,WATERLEVEL_HOURLY_VFD_PX._DATUM,WATERLEVEL_HOURLY_VFD_PX._BEGIN_DATE,WATERLEVEL_HOURLY_VFD_PX._END_DATE,WATERLEVEL_HOURLY_VFD_PX.DATE_TIME,WATERLEVEL_HOURLY_VFD_PX.WL_VALUE,WATERLEVEL_HOURLY_VFD_PX.SIGMA,WATERLEVEL_HOURLY_VFD_PX.I&WATERLEVEL_HOURLY_VFD_PX._STATION_ID=8534720&WATERLEVEL_HOURLY_VFD_PX._DATUM=MSL&WATERLEVEL_HOURLY_VFD_PX._BEGIN_DATE=19960101&WATERLEVEL_HOURLY_VFD_PX._END_DATE=20160101. However, when I attempt to access and download the data in Matlab (using either ncdisp to simply display information about the data or ncread to actually access the data), the OPeNDAP URL is not recognized and I get the following error message: "Error using netcdflib. Unable to open file. File may be corrupt or filename may have invalid characters. If the data source was an OPeNDAP URL, see the OPeNDAP Troubleshooting section in the Users Guide.” I would appreciate any help in determining the source of the error. I have used Matlab to access OPenDAP data in the past without any issues. 

Can you send me the exact command your using in Matlab to access these data?

If you have Matlab 2012b or later, you can use the built-in OPeNDAP support in Matlab to read data from remote datasets. Here’s a short how-to blog entry: http://www.opendap.org/user/jimg/blog/matlab_2012a

Thanks,
James


Regards,

Kelsey Brunner
School of Marine and Atmospheric Sciences
Stony Brook University 
Stony Brook, NY 11794
kelsey....@stonybrook.edu

--
James Gallagher
jgall...@opendap.org

Kelsey Brunner

unread,
Jul 21, 2016, 10:55:18 PM7/21/16
to James Gallagher, Support Unidata, support@opendap.org support
Hi James,

Thanks for the quick response. I have Matlab 2015b and am using the commands as outlined in the quick blog entry. I have copied the two lines below:

>> url = 'http://opendap.co-ops.nos.noaa.gov/dods/IOOS/Hourly_Height_Verified_Water_Level?WATERLEVEL_HOURLY_VFD_PX._STATION_ID,WATERLEVEL_HOURLY_VFD_PX._DATUM,WATERLEVEL_HOURLY_VFD_PX._BEGIN_DATE,WATERLEVEL_HOURLY_VFD_PX._END_DATE,WATERLEVEL_HOURLY_VFD_PX.DATE_TIME,WATERLEVEL_HOURLY_VFD_PX.WL_VALUE,WATERLEVEL_HOURLY_VFD_PX.SIGMA,WATERLEVEL_HOURLY_VFD_PX.I&WATERLEVEL_HOURLY_VFD_PX._STATION_ID=8534720&WATERLEVEL_HOURLY_VFD_PX._DATUM=MSL&WATERLEVEL_HOURLY_VFD_PX._BEGIN_DATE=19960101&WATERLEVEL_HOURLY_VFD_PX._END_DATE=20160101’;
>> ncid = netcdf.open(url);

I receive the following error message:

Error using netcdflib
Unable to open file. File may be corrupt or filename may have invalid characters. If the data source was an OPeNDAP URL, see the OPeNDAP Troubleshooting section in the Users Guide.

I get the same error message if I try ncinfo(url) or any other commands from the netcdf package. There seems to be an issue with the url provided by the DODS access form, but I am not familiar with the url structure to identify where the problem is.

Regards,

Kelsey

fade...@gmail.com

unread,
Oct 18, 2016, 12:41:04 PM10/18/16
to User Support, sup...@unidata.ucar.edu, kelsey....@stonybrook.edu
Hi Kelsey,

Just wondering whether you resolved this problem? I'm getting the same issue when I use MATLAB commands such as ncread and ncdisp with the url generated from the OPeNDAP Data Access Form. I'm trying to access HYCOM reanalysis data using the following url: http://tds.hycom.org/thredds/dodsC/GLBu0.08/expt_19.1/2008?depth[5],lat[575],lon[3875],time[0:1:365],water_u[0:1:0][0:1:0][0:1:0][0:1:0],water_v[0:1:0][0:1:0][0:1:0][0:1:0].

Any help much appreciated.

Thanks
Mark
Reply all
Reply to author
Forward
0 new messages