E3SM-Project / scorpio

A high-level Parallel I/O Library for structured grid applications
19 stars 16 forks source link

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

Open wkliao opened 1 year ago

wkliao commented 1 year ago

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. https://github.com/E3SM-Project/scorpio/blob/ac679a546c2345e1b94e0fbb54d06115b91e792c/src/clib/pio_nc.c#L1353-L1365

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;