You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@DennisHeimbigner I'll be grateful for any context you can provide here; the exhibited behavior is how I expect things to work, but the comments (as pointed out by @wkliao) are a bit contradictory.
If I'm reading this right, the issue is that the documentation for ELATEFILL specifies that attributes can only be set in the 'initial' define mode. However, the behavior exhibited in the tests shows that you can add a _FillValue attribute during redefinition. If you go through and look at the comment for ELATEFILL in netcdf.h, you see Attempt to define fill value when data already exists.. This alludes to a different issue than setting _FillValue only in the initial definition.
Assuming that the comment in netcdf.h is correct, you should be able to define a _FillValue attribute until such time as you have written data. This is in line with my understanding of things, and assuming it's correct I think the fix is a simple documentation clarification. If redef is a relatively new operation (it may or may not be, I have no idea and am not inclined to track it down; it's not super relevant anyways) then the term initial may have had a different inference before redef was implemented.
Any insight you can provide will be appreciated @DennisHeimbigner, thanks!
Just want to point out that in the nc_test program, a new variable is defined right after nc_create, and immediately followed by nc_enddef. During nc_enddef, the variable will be filled with the default fill value. So later on when calling put_attr to add _FillValue, the data of that variable does already exit and hence NC_ELATEFILL should be expected.
I believe the term "initial" is relative to variables, not files. For example, when a new variable is created in a redef mode, to that variable, the define mode is its initial.
According to the NetCDF document for nc_put_att, the error code description for NC_ELATEFILL is:
Below is what I tried:
NC_ELATEFILL is expected from step 4 because it is not in the initial define mode, but I got NC_NOERR.
This behavior also appear in nc_test4/tst_vars2.c, line 70 but is considered normal (mistakenly?)
Here is my short test program.
The text was updated successfully, but these errors were encountered: