open and read *.nc file to visualize a contour plot

34 views
Skip to first unread message

Khaled Tahoon

unread,
May 14, 2024, 7:56:11 PM5/14/24
to idl-pvwave
attach file is an outcomes of regional climate model with *.nc format.
I wrote the following code to open and read it. 
=============================
fdata='C:\Users\pr_200401.nc'
d=ncread(fdata)
unfortunately, I have got the following error
NCDF_OPEN: Unable to open the file "C:\Users\ pr_200401 .nc". (NC_ERROR=-51)
How can I correct this error and write a command for contour plot.
Please, attach as an example data

pr_200401.nc

markus.sc...@gmail.com

unread,
May 15, 2024, 1:03:08 PM5/15/24
to idl-pvwave
Hi Khaled, 
error -51 means "Not a netcdf file."
The file you attached I could open with 
nCDF_Browser, fdata
from the Coyote library http://www.idlcoyote.com/fileio_tips/ncdf_browser.html
I don't have a function  ncread,  you need to tell us, which library you use.
The error message has spaces in the file name, that might be the problem. You can check, whether a file exists and is readable by
file_test(fdata,/read)
I hope this helps, Markus
Reply all
Reply to author
Forward
0 new messages