Error reading .nc4 file: 'Unknown file format (NC_ENOTNC)'

조회 수: 83 (최근 30일)
juan ignacio gossn
juan ignacio gossn 2016년 11월 25일
댓글: Rimal Abeed 2020년 1월 7일
Hi there,
Am trying to read a .nc4 file using ncread('filename') and get:
>> ncread('S3A_OL_SRF_20160713_mean_rsr.nc4')
Error using netcdflib
The NetCDF library encountered an error during execution of 'open' function -
'Unknown file format (NC_ENOTNC)'.
Error in netcdf.open (line 60)
[varargout{:}] = netcdflib ( 'open', filename, varargin{1} );
Error in internal.matlab.imagesci.nc/openToRead (line 1249)
this.ncRootid = netcdf.open(this.Filename,'NOWRITE');
Error in internal.matlab.imagesci.nc (line 122)
this.openToRead();
Error in ncread (line 54)
ncObj = internal.matlab.imagesci.nc(ncFile);
Any suggestion will be kindly appreciated
Thanks,
Juancho

답변 (3개)

Tamir Suliman
Tamir Suliman 2016년 11월 25일
It might be corrupted file or over written try to re copy it again that's the message one gets if the file is not there with the netCDF functions.
  댓글 수: 2
juan ignacio gossn
juan ignacio gossn 2016년 11월 27일
Thanks Tamir for your reply, I tried downloading it again and used different versions of matlab but it continues to throw the same message
Juan
Rimal Abeed
Rimal Abeed 2020년 1월 7일
His suggestion fixed my problem!

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


Walter Roberson
Walter Roberson 2016년 11월 25일
Check the first few bytes of the file. If they are 'CDF' then it might be a valid netCDF file but it would not be a NetCDF-4 file. NetCDF-4 files are HDF5 files. If it is NetCDF-4 stored as HDF5, then the file should begin with
Hex: 89 48 44 46 0d 0a 1a 0a
ASCII: \211 HDF \r \n \032 \n
  댓글 수: 2
juan ignacio gossn
juan ignacio gossn 2016년 11월 27일
편집: Walter Roberson 2016년 11월 27일
Thanks Walter for your reply, the first bytes are completely different from what you state:
<!DOCTYPE html><html lang="en" xmlns:fb="http://ogp.me/ns/fb#" xml:lang="en" class="" xmlns="http://www.w3.org/1999/xhtml">
though its termination is clearly .nc4 .... :S
Walter Roberson
Walter Roberson 2016년 11월 27일
It appears that is related to JSON and to Facebook's OpenGraph protocol.
Possibly there is NetCDF-4 represented in the content, but the data structure itself is not NetCDF-4

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


juan ignacio gossn
juan ignacio gossn 2016년 12월 21일
Thank you, sorry for my late reply. Actually the file was corrupted, so, nothing to do with Matlab.
Thanks a lot!
Juancho

카테고리

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