Problem opening NetCDF file

33 views (last 30 days)
Manolis Mylonakis
Manolis Mylonakis on 11 Dec 2022
Commented: millercommamatt on 13 Dec 2022
Hello everyone
I have downloaded hourly data from 200-2005 for wind speeds (two components vertical and horizontal) for a very specific geographical space from “Copernicus”. My data hold a NetCDF format with an ending “.nc”. My file is very small (2.1 mb). Anyone willing to help can get my file "WS.nc" from the attachements.
I have big problem trying to open my file in MATLAB. Anything I tried doesn’t seem to work. I have tried the following:
vardata = ncread('WS.nc');
And I get:
Error using netcdflib
Unable to perform requested action. Filename contains unsupported characters.
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);
Error in Loading_Data (line 9)
vardata = ncread('WS.nc');
Have also tried:
ncdisp('WS.nc');
And I get
Error using netcdflib
Unable to perform requested action. Filename contains unsupported characters.
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 ncdisp (line 62)
ncObj = internal.matlab.imagesci.nc(ncFile);
Error in Loading_Data (line 10)
ncdisp('WS.nc');
Am I doing something wrong, or my file is broken?
  2 Comments
Image Analyst
Image Analyst on 11 Dec 2022
Edited: Image Analyst on 11 Dec 2022
I don't know how you get any error at all. All the code is commented out except where you assign a string variable.
If you have any more questions, then attach your data (zipped up) and code to read it in with the paperclip icon after you read this:
millercommamatt
millercommamatt on 13 Dec 2022
Worked fine for me
>> a = ncinfo('C:/Users/mille/Desktop/WS.nc')
a =
struct with fields:
Filename: 'C:\Users\mille\Desktop\WS.nc'
Name: '/'
Dimensions: [1×3 struct]
Variables: [1×5 struct]
Attributes: [1×2 struct]
Groups: []
Format: '64bit'
>>

Sign in to comment.

Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!