I am a user of ROMS. I have faced an error to make forcing when using d_ecmwf2roms.m. I tested many methods to fix the following error; however, I am not able to fix this error. Please help me to solve this error.
Error using fclose
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in nc_interface (line 98)
fclose(fid);
Error in nc_getatt (line 61)
[method,~,~] = nc_interface(ncfile);
Error in nc_inq (line 69)
A = nc_getatt(ncfile); % NetCDF file global attributes
Error in nc_read (line 77)
Info = nc_inq(ncfile);
Error in d_ecmwf2roms (line 296)
lon = nc_read(InpFile, 'longitude',
...
Hi Javad,
Remove directories including netcdf functions added in matlab paths and call nc functions from the toolbox that is available in ROMS repository. It seems that the nc_read function you are using does not match.
Amin
d_ecmwf2rom.m is adapted from code I wrote a long time ago and may not work nicely with new versions of ECMWF outputs.
That said, the particular error you get indicates trouble opening a file, so you should check that it exists and that you've given the correct path. Easiest way is to set a debug stop point in nc_read before line 77 and check interactively the next steps in the code.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Hi,
Thank you so much for your cooperation.
Based on the previous comments, I do not understand how to do this Remove directories including netcdf functions added in matlab paths and call nc functions from the toolbox that is available in ROMS repository, please explain more. By the way,After changing some codes, I have faced the following error:
Error: File: nc_read.m Line: 91 Column: 1
This statement is not inside any function.
(It follows the END that terminates the definition of the function "nc_read".)
Error in d_ecmwf2roms (line 296)
lon = nc_read(InpFile, 'longitude',
That error it at the call to nc_interface. Read the help on nc_interface. Your system is having trouble figuring out the best method to read netcdf files. Are you running an old version of Matlab? Have you successfully read and written netcdf files before?
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu