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 option #519

Open
wkliao opened this issue Jun 2, 2023 · 0 comments · May be fixed by #594
Open

checking if a variable is a record variable when using PnetCDF option #519

wkliao opened this issue Jun 2, 2023 · 0 comments · May be fixed by #594
Assignees

Comments

@wkliao
Copy link
Member

wkliao commented Jun 2, 2023

For PnetCDF, checking whether a variable is a record variable can just check the
first dimension, because CDF-1,2,5 formats allow only the first dimension to be
unlimited.

scorpio/src/clib/pio_nc.c

Lines 1353 to 1365 in ac679a5

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;

The above code block can be simplified to the following.

int *p = (dimidsp) ? dimidsp : tmp_dimidsp;
file->varlist[varid].rec_var = (ndims > 0 && p[0] == NC_UNLIMITED) ? 1 : 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants