Borrar filtros
Borrar filtros

Error reading netcdf files online

3 visualizaciones (últimos 30 días)
Fanglou Liao
Fanglou Liao el 13 de Feb. de 2016
Editada: Bankim Chandra Yadav el 26 de Abr. de 2018
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 comentario
Geoff Hayes
Geoff Hayes el 13 de Feb. de 2016
Editada: Geoff Hayes el 13 de Feb. de 2016
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'.

Iniciar sesión para comentar.

Respuestas (1)

Bankim Chandra Yadav
Bankim Chandra Yadav el 26 de Abr. de 2018
Editada: Bankim Chandra Yadav el 26 de Abr. de 2018
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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by