Problem to access OPeNDAP data behind https:// urls

27 次查看(过去 30 天)
Hi!
I'm trying to access an OPeNDAP server with the https:// handle. I have the R2019b version of matlab. As far as I understand, matlab can't access the file directly because of security reasons(?). But it seems as though sometimes my code works and extracts the variable, sometimes not. See here
>> m=1
chl_A(m)=ncread(url, 'chlor_a', [lonnumber(m)-1,latnumber(m)-1,timeM(m)-1],[1 1 1]); %this code extracts data
>> m=2
>> chl_A(m)=ncread(url, 'chlor_a', [lonnumber(m)-1,latnumber(m)-1,timeM(m)-1],[1 1 1]); %this does not
Error using netcdflib
The NetCDF library encountered an error during execution of 'open' function - 'I/O failure (NC_EIO)'. If the data source was an OPeNDAP URL,
see the OPeNDAP Troubleshooting section in the Users Guide.
Error in netcdf.open (line 67)
[varargout{:}] = netcdflib ( 'open', filename, varargin{1} );
Error in internal.matlab.imagesci.nc/openToRead (line 1278)
this.ncRootid = netcdf.open(this.Filename,'NOWRITE');
Error in internal.matlab.imagesci.nc (line 121)
this.openToRead();
Error in ncread (line 61)
ncObj = internal.matlab.imagesci.nc(ncFile);
and basically matlab does this to the whole data. I have 158 points to extract and it only extracts about 30 of them, for the others the error comes up. Why?
This code used to work when the server was a http:// one. Is there any way to fix it or bypass it?
Thanks in advance!
  2 个评论
Rashed Mohammed
Rashed Mohammed 2020-11-26
Hi Sofya
Could you please provide the URL and Operating System you are using so that we can replicate the issue
Sofya Kuzmina
Sofya Kuzmina 2020-11-26
Yes, sorry:
url = 'https://rsg.pml.ac.uk/thredds/dodsC/CCI_ALL-v4.2-DAILY';
and i'm using Windows 10.
Hopefully that'll be enough now.

请先登录,再进行评论。

采纳的回答

Rashed Mohammed
Rashed Mohammed 2020-11-27
Hi Sofya
Thanks for the information. I was able to reproduce the issue and I have brought this issue to the notice of our developers. They will investigate the matter further.
In the meantime, can you try upgrading to the latest release of MATLAB and see if the issue persists as I was not able to reproduce the issue in R2020b.
  6 个评论
BN
BN 2022-11-9

I have same problem in R2021a. Did you find any solution?

Sofya Kuzmina
Sofya Kuzmina 2022-11-9
编辑:Sofya Kuzmina 2022-11-9
Hello everyone. Based on my experience with different servers, this problem seems to just pop up every once in a while. I have since installed R2021b and it still occurs sometimes, albeit less often.
My only solution (@BN, thanks for the nudge, your reply was the only one that managed to get to my inbox!) would be:
a) give it some time, try again later. I know, not the most elegant solution, but if your desired data is not large, perhaps a try-catch loop can work.
b) find other ways to access your data, lol. For me the only problem has been with a specific dataset (now I think about it, it was quite a big one, while other .nc files I've accessed were smaller, so maybe that's part of the issue? idk), whereas other https:// servers worked fine. Never encountered this problem with an http:// server though, so I have no idea how one could fix that...
c) make sure your url is working! access it through your brщwser to check that it does exist on the server! @Subhrajit Rath and @Barbara Bentz's errors appear to be different to mine, so maybe that's a whole different issue.
Sorry I can't be of more help.

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by