error in opening netcdf nc4 files
2 views (last 30 days)
Show older comments
Vincent Moron
on 25 Jan 2021
Commented: Caroline Mallary
on 27 May 2021
Dear all
I have an error when I try to read data in netcdf files. Basically, I used a file list and a loop to fill a matrix with data in a 3-D output (called "DATA") ; I have the same error when I simply open this file with netcdf.open or if I try to look at its info with ncinfo or ncdisp;
>> DATA(i,:,:)=ncread(NAME_file(M(i),:),'precipitationCal');
Error using internal.matlab.imagesci.nc/openToRead (line 1272)
Could not open 3B-HHR.MS.MRG.3IMERG.20130101-S000000-E002959.0000.V06B.HDF5.nc4 for reading.
Error in internal.matlab.imagesci.nc (line 121)
this.openToRead();
Error in ncread (line 61)
ncObj = internal.matlab.imagesci.nc(ncFile);
But when I look into this file with "ncdump" for example, there are data in it that can be read
>> !ncdump 3B-HHR.MS.MRG.3IMERG.20130101-S000000-E002959.0000.V06B.HDF5.nc4 | head
netcdf \3B-HHR.MS.MRG.3IMERG.20130101-S000000-E002959.0000.V06B.HDF5 {
dimensions:
time = 1 ;
lon = 3600 ;
lat = 801 ;
variables:
float precipitationCal(time, lon, lat) ;
precipitationCal:DimensionNames = "time,lon,lat" ;
precipitationCal:Units = "mm/hr" ;
precipitationCal:units = "mm/hr" ;
Any idea to solve this issue ?
Thank you in advance
Vincent
0 Comments
Accepted Answer
Vincent Moron
on 26 Jan 2021
1 Comment
Caroline Mallary
on 27 May 2021
Thank you for this. This extra space also occurs with MERRA2's .nc4 files, e.g. MERRA2_400.tavgM_2d_aer_Nx.201901.nc4 had an extra space at the end when I initially tried to load it into Matlab.
This is a good thing to be aware of for users who are downloading satellite weather data. My file came from earthdata.nasa.gov; if yours did too, perhaps their system is adding the extra space.
More Answers (0)
See Also
Categories
Find more on NetCDF in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!