error in opening netcdf nc4 files

5 ビュー (過去 30 日間)
Vincent Moron
Vincent Moron 2021 年 1 月 25 日
コメント済み: Caroline Mallary 2021 年 5 月 27 日
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

採用された回答

Vincent Moron
Vincent Moron 2021 年 1 月 26 日
The error is related to extra blank space at the end of the file names ...
>> DATA(i,:,:)=ncread(NAME_file(M(i),1:64),'precipitationCal');
makes the job
V
  1 件のコメント
Caroline Mallary
Caroline Mallary 2021 年 5 月 27 日
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.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNetCDF についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by