From: Matt on
hi there,

I'm writing a script that manipulates data from a netCDF file. It was working but all of a sudden.
This is my line of code which I can see nothing wrong with and the file name is correct with the file...

UKMOSST = netcdf.open(20080602.nc','NC_NOWRITE')

The error is:

??? Error using ==> netcdflib
Unable to open netCDF file, library error message "NetCDF: Unknown file format"

Error in ==> open at 54
[varargout{:}] = netcdflib ( 'open', filename, mode );

Error in ==> Simple_UKMO_SST_PlotScript at 4
UKMOSST = netcdf.open('20080602.nc','NC_NOWRITE');


can anyone help?

Thanks!
From: TideMan on
On Jun 4, 2:56 am, "Matt " <matthew.mpyo...(a)gmail.com> wrote:
> hi there,
>
> I'm writing a script that manipulates data from a netCDF file. It was working but all of a sudden.
> This is my line of code which I can see nothing wrong with and the file name is correct with the file...
>
> UKMOSST = netcdf.open(20080602.nc','NC_NOWRITE')
>
> The error is:
>
> ??? Error using ==> netcdflib
> Unable to open netCDF file, library error message "NetCDF: Unknown file format"
>
> Error in ==> open at 54
>     [varargout{:}] = netcdflib ( 'open', filename, mode );
>
> Error in ==> Simple_UKMO_SST_PlotScript at 4
> UKMOSST = netcdf.open('20080602.nc','NC_NOWRITE');
>
> can anyone help?
>
> Thanks!

Well, in spite of what you say, Matlab is saying that the file is not
on the PWD.
What do you get when you type this:
which 20080602.nc
Have you by any chance changed the directory?
Or moved the .nc file?
From: dpb on
TideMan wrote:
> On Jun 4, 2:56 am, "Matt " <matthew.mpyo...(a)gmail.com> wrote:
....
>> UKMOSST = netcdf.open(20080602.nc','NC_NOWRITE')
>>
>> The error is:
>>
>> ??? Error using ==> netcdflib
>> Unable to open netCDF file, library error message "NetCDF:
>> Unknown file format"
>>
>> Error in ==> open at 54
>> [varargout{:}] = netcdflib ( 'open', filename, mode );
>>
....

> Well, in spite of what you say, Matlab is saying that the file is not
> on the PWD.
....

Actually, 'File not found' isn't the message; it's 'Unknown file format'

That sounds like the file has been corrupted or written over to me, not
that it's not there...

--

From: TideMan on
On Jun 4, 8:59 am, dpb <n...(a)non.net> wrote:
> TideMan wrote:
> > On Jun 4, 2:56 am, "Matt " <matthew.mpyo...(a)gmail.com> wrote:
> ...
> >> UKMOSST = netcdf.open(20080602.nc','NC_NOWRITE')
>
> >> The error is:
>
> >> ??? Error using ==> netcdflib
> >> Unable to open netCDF file, library error message "NetCDF:
> >> Unknown file format"
>
> >> Error in ==> open at 54
> >>     [varargout{:}] = netcdflib ( 'open', filename, mode );
>
> ...
>
> > Well, in spite of what you say, Matlab is saying that the file is not
> > on the PWD.
>
> ...
>
> Actually, 'File not found' isn't the message; it's 'Unknown file format'
>
> That sounds like the file has been corrupted or written over to me, not
> that it's not there...
>
> --

Well in my experience, that's the message one gets if the file is not
there with the netCDF functions.
But I bow to your superior knowledge in this instance.
From: dpb on
TideMan wrote:
....

> Well in my experience, that's the message one gets if the file is not
> there with the netCDF functions.
> But I bow to your superior knowledge in this instance.

I have no knowledge (what more "superior" :) ) of the netCDF functions;
I was just reading and interpreting the message literally.

So, if you have _any_ experience that trumps me... :)

--