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

checking if a variable is a record variable when using PnetCDF #594

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions src/clib/pio_nc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1357,19 +1357,13 @@ int PIOc_inq_var_impl(int ncid, int varid, char *name, int namelen, nc_type *xty
}
if(!ierr && (file->num_unlim_dimids > 0))
{
/* For PnetCDF, checking whether a variable is a record
* variable can be done by checking the first dimension,
* because CDF-1,2,5 formats allow only the first dimension to
* be unlimited.
*/
int *p = (dimidsp) ? dimidsp : tmp_dimidsp;
int is_rec_var = file->varlist[varid].rec_var;
for(int i=0; (i<ndims) && (!is_rec_var); i++)
{
for(int j=0; (j<file->num_unlim_dimids) && (!is_rec_var); j++)
{
if(p[i] == file->unlim_dimids[j])
{
is_rec_var = 1;
}
}
}
file->varlist[varid].rec_var = is_rec_var;
file->varlist[varid].rec_var = (ndims > 0 && p[0] == PIO_UNLIMITED) ? 1 : 0;
}
free(tmp_dimidsp);
}
Expand Down