Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing values/updating a variable in a netcdf file #2854

Open
jbensabat opened this issue Feb 1, 2024 · 3 comments
Open

changing values/updating a variable in a netcdf file #2854

jbensabat opened this issue Feb 1, 2024 · 3 comments
Assignees
Milestone

Comments

@jbensabat
Copy link

Hello
I am trying to update a variable that has 4 dimensions (one of them NC_UNLIM) using the c version.
I get the values into a array (values)
then make changes to the to the array
when I try to write back the variable values to the netcdf file I get an error -101
Is it a limitation of netcdf or an error that I am making ?
thanks
jac

To report a non-security related issue, please provide:

  • the version of the software with which you are encountering an issue
  • environmental information (i.e. Operating System, compiler info, java version, python version, etc.)
  • a description of the issue with the steps needed to reproduce it

If you have a general question about the software, please view our Suggested Support Process.

@WardF
Copy link
Member

WardF commented Feb 1, 2024

Error -101 indicates an error at the HDF5 layer; it's not more specific, because it reflects an issue where libhdf5 has only told us "something went wrong" without additional detail. Can you provide a snippet of the code you're using? Perhaps something will stick out, because you should be able to do what you have described.

@WardF WardF self-assigned this Feb 1, 2024
@jbensabat
Copy link
Author

Hi
I found the cause of the problem. In order to update a variable I need to open the nc file NC_WRITE mode.
I won't do this error again but would it be possible to check this when attempting to write to an nc file (checking if the file was open in the correct mode)
best
jac

@WardF WardF added this to the 4.9.3 milestone Feb 13, 2024
@WardF
Copy link
Member

WardF commented Feb 13, 2024

It seems like it should be a thing we can do. @DennisHeimbigner am I overlooking something simple, or a reason why we aren't doing this already?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants