BOUT-dev icon indicating copy to clipboard operation
BOUT-dev copied to clipboard

Netcdf issues can be confusing

Open dschwoerer opened this issue 2 years ago • 1 comments

If netcdf fails, it fails often with a generic error. This is confusing for the user, as it can be, at least some of these issues:

  • File is not available (e.g. file only on login node, not on compute nodes)
  • File is not writable
  • File is locked
  • Path is wrong
  • Folder does not exist (if file is to be created)
  • No permissions to create file in folder

There are probably more, that I cannot think of right now.

It would be nice if

  1. BOUT++ could check which of those issues is the case
  2. BOUT++ could link to some documentation that lists common issues, and how to resolve them.

Obviously 1 would be nicer, but 2 would also be a good start. Might be worth to push this issue upstream, to throw nicer errors?

dschwoerer avatar Oct 13 '23 12:10 dschwoerer

Yep, very much agree!

I'd love to push some of this upstream, but their error system can only return a const char*, so they have no opportunity to customise the message. They do have some logging system though, and that could possibly be repurposed/adapted to give better error messages.

When it's an HDF5 error, we might be able to get the HDF5 error stack and parse that ourselves.

Some of this probably can't make it upstream at all, so it would definitely be nice if we handled them. Now we're using C++17, std::filesystem can give us some nice checking for directory existence, creating them if necessary, and so on.

ZedThree avatar Oct 13 '23 12:10 ZedThree