mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-23 16:59:54 +08:00
lazy read of global atts now working
This commit is contained in:
parent
2dc6676bd8
commit
81add527f2
@ -175,9 +175,9 @@ NC4_del_att(int ncid, int varid, const char *name)
|
||||
NC_ATT_INFO_T *att;
|
||||
NCindex* attlist = NULL;
|
||||
hid_t locid = 0, datasetid = 0;
|
||||
int retval = NC_NOERR;
|
||||
int i;
|
||||
size_t deletedid;
|
||||
int retval;
|
||||
|
||||
if (!name)
|
||||
return NC_EINVAL;
|
||||
@ -204,6 +204,12 @@ NC4_del_att(int ncid, int varid, const char *name)
|
||||
BAIL(retval);
|
||||
}
|
||||
|
||||
/* Do we need to read the atts? */
|
||||
if (varid == NC_GLOBAL)
|
||||
if (grp->atts_not_read)
|
||||
if ((retval = nc4_read_grp_atts(grp)))
|
||||
return retval;
|
||||
|
||||
/* Get either the global or a variable attribute list. Also figure
|
||||
out the HDF5 location it's attached to. */
|
||||
attlist = getattlist(grp,varid,&var);
|
||||
|
@ -2439,8 +2439,9 @@ nc4_rec_read_metadata(NC_GRP_INFO_T *grp)
|
||||
}
|
||||
|
||||
/* Scan the group for global (i.e. group-level) attributes. */
|
||||
if ((retval = nc4_read_grp_atts(grp)))
|
||||
BAIL(retval);
|
||||
grp->atts_not_read = 1;
|
||||
/* if ((retval = nc4_read_grp_atts(grp))) */
|
||||
/* BAIL(retval); */
|
||||
|
||||
/* when exiting define mode, mark all variable written */
|
||||
for (i=0; i<ncindexsize(grp->vars); i++) {
|
||||
|
@ -460,6 +460,7 @@ nc4_find_grp_att(NC_GRP_INFO_T *grp, int varid, const char *name, int attnum,
|
||||
{
|
||||
NC_VAR_INFO_T *var;
|
||||
NCindex* attlist = NULL;
|
||||
int retval;
|
||||
|
||||
assert(grp && grp->hdr.name);
|
||||
LOG((4, "nc4_find_grp_att: grp->name %s varid %d name %s attnum %d",
|
||||
@ -467,7 +468,14 @@ nc4_find_grp_att(NC_GRP_INFO_T *grp, int varid, const char *name, int attnum,
|
||||
|
||||
/* Get either the global or a variable attribute list. */
|
||||
if (varid == NC_GLOBAL)
|
||||
{
|
||||
attlist = grp->att;
|
||||
|
||||
/* Do we need to read the atts? */
|
||||
if (grp->atts_not_read)
|
||||
if ((retval = nc4_read_grp_atts(grp)))
|
||||
return retval;
|
||||
}
|
||||
else
|
||||
{
|
||||
var = (NC_VAR_INFO_T*)ncindexith(grp->vars,varid);
|
||||
|
Loading…
Reference in New Issue
Block a user