필터 지우기
필터 지우기

Error reading netcdf files online

조회 수: 3 (최근 30일)
Fanglou Liao
Fanglou Liao 2016년 2월 13일
편집: Bankim Chandra Yadav 2018년 4월 26일
Hi, everyone
when I read netcdf files online in matlab R2015a, I always encountered problems as follows:
*Error using netcdflib
The NetCDF library encountered an error during execution of 'open' function - 'Malformed or inaccessible DAP DDS
(NC_EDDS)'. If the data source was an OPeNDAP URL, see the OPeNDAP Troubleshooting section in the Users Guide.
Error in netcdf.open (line 59)
[varargout{:}] = netcdflib ( 'open', filename, varargin{1} );*
The code for reading nc file is as follows:
url=['http://www.cmar.csiro.au/dods/nph-dods/dods-data/bl/BRAN2.2/temp/ocean_temp_' Nyear '_01_01.nc'];
ncid=netcdf.open(ur1,'NC_NOWRITE');
Lat0=netcdf.getVar(ncid,'yt_ocean'); Lon0=netcdf.getVar(ncid,'xt_ocean');
Could anyone please tell me how to deal with the above problem?
Many thanks and kind regards,
Fanglou_
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2016년 2월 13일
편집: Geoff Hayes 2016년 2월 13일
Fanglou - have you verified that the URL is correct? Note that in your above code, you assign the URL to the variable url, but then try to open ur1 where the last character is a one and not an 'l'.

댓글을 달려면 로그인하십시오.

답변 (1개)

Bankim Chandra Yadav
Bankim Chandra Yadav 2018년 4월 26일
편집: Bankim Chandra Yadav 2018년 4월 26일
I have faced same situation: The most probable reason is while you are getting a list of .nc files using loop you are getting them as 'cell' type. When you try the read the file name at a particular cell value you can do that using
fileName = filesList(i)
where i = 1 to the numeber of files returned in your output.
The solution is: while using 'ncread' function use it as follows:
ncread(fileName{:},'variableName')
This will solve your problem. It solved mine. I was going through the exact problem of being able to use ncread in a single directory but not over a list of files obtained through loop.

카테고리

Help CenterFile Exchange에서 NetCDF에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by