error in nc_read

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
javadi
Posts: 115
Joined: Mon Jan 27, 2020 5:55 pm
Location: UoT

error in nc_read

#1 Unread post by javadi »

Dear users
Thank you so much for your help. I have faced an error when using d_ecmwf2roms.m . I downloaded data from ECMWF and then I tried to use d_ecmwf2roms.m. I ran this code when checking line by line to detect error of this code in my system. The first time I have faced an error in line 396 before starting Convert forcing data to floating-point and scale to ROMS units.

** Creating ROMS NetCDF forcing file: gom_sms_era.nc **
Error: File: nc_read.m Line: 91 Column: 2
This statement is not inside any function.
(It follows the END that terminates the definition of the function "nc_read".)


This refer to this line in nc_read.m


[method,~,~] = nc_interface(ncfile);
switch(method)
case {'native'}
f = nc_read_matlab(ncfile,Vname,Tindex,ReplaceValue,PreserveType,Info);
case {'java'}
f = nc_read_java (ncfile,Vname,Tindex,ReplaceValue,PreserveType,Info);
case {'mexnc'}
f = nc_read_mexnc (ncfile,Vname,Tindex,ReplaceValue,PreserveType,Info);
otherwise
error('NC_READ: unable to determine NetCDF processing interface');
end

To solve this error, I did many actions:
1- It is not related to the version of my MATLAB as I checked both the 2014a and 2020a version. Both of them I have the same error.
2- It is not related to the wrong direction of NetCDF as I put all files (interface, NC read.) in one folder
3- I added all folders to my MATLAB path
4- I reviewed other comments in this forum and I understood the philosophy of this method. I guessed that my MATLAB tested all methods to read but this could not.


Please help me with your interesting comments
Thank you so much for your cooperation.

Post Reply