ncread - error - 'getVarDouble' function - 'HDF error (NC_EHDFERR)'

3 visualizzazioni (ultimi 30 giorni)
Attempting to load netCDF data from a known source - and have successfully opened similar files from this same source.
ginfo = ncinfo(in_file); and ncdisp(in_file); display normal, expected results. But
Lats = ncread(in_file,'lat'); produces
"The NetCDF library encountered an error during execution of 'getVarDouble' function - 'HDF error (NC_EHDFERR)'."
I notice the following differences from previous files from ginfo and ncdisp:
ginfo format is 'netcdf4' - previous files were 'classic'
Global Attributes: GMT_version now 6.2.0 (64-bit) previous files used 6.1.1 (64-bit)
Everything else looks normal and unchanged.

Risposte (1)

Vatsal
Vatsal il 29 Set 2023
Modificato: Vatsal il 29 Set 2023
I understand that you are getting the “NC_EHDFERR” error while reading the variable ‘lat’.
Based on the error message you received ('HDF error (NC_EHDFERR)'), it is likely that the netCDF file you are working with is corrupted. To investigate further, it would be helpful to determine if the error is specific to MATLAB or if it persists when using other tools.
I recommend using third-party tools, such as the Python netcdf4 package, to read the netCDF file. This will allow you to verify if the error persists and help identify any potential issues with the file itself. You can find a tutorial on reading netCDF data using Python in the following article:
Please try using the Python netcdf4 package to read the file and observe if the same error occurs. This will provide valuable information for troubleshooting the issue further.

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by