NetCDF: No such file or directory?

NetCDF: No such file or directory?

by Faisal Halabeya -
Number of replies: 2

I have the following code in my main function to read the prediction:

NcFile ncfile("GWprediction.nc", NcFile::read)
rvector<std::complex<double>> predicted(ncfile.getDim("nt").getSize());
ncfile.getVar("f").getVar(predicted.data());

When I run the code, it compiles fine, but I get this error:
./ligo
terminate called after throwing an instance of 'netCDF::exceptions::NcException'
  what():  No such file or directory
file: ncFile.cpp  line:88
make: *** [all] Aborted

Is there a reason this is happening? The netCDF files are all in the same folder as the code, and they are included at the header of the cpp file as well as linked in the makefile.

In reply to Faisal Halabeya

Re: NetCDF: No such file or directory?

by Ramses van Zon -
The file is either not there or not readable. You can check if the file is there and was copied completely. You could, for instance, check the sizes of the original and copied file with "ls -l", which will also show you if it's readable. You can also check the format of the file with "ncdump -h GWprediction.nc".
In reply to Ramses van Zon

Re: NetCDF: No such file or directory?

by Faisal Halabeya -
The data files appear to have been copied properly; the file in the working directory is of the same type and size as the file in the original directory. I'm submitting the code since I think it should all work but it won't have the output text file since I am unable to actually run it. I tried to copy the data a different way and got the same error.