E3SM-Project / E3SM-Project/scorpio

Consolidate checks for record variables

Open
#118 7 comments 0 reactions 1 assignee Claimed by @dqwu View on GitHub
enhancement Low Priority
Dominant language
C++
Stars
22
Forks
20
Avg merge
12d 19m
Merged PRs (30d)
1

Description

There are several ways that we currently determine if a variable has records,

1) var_desc has a "rec_var" member that is set to 0/1 based on whether the variable has an unlimited dimension
2) var_desc has a "record" member that contains the record being written out (Checking whether the "record" member >= 0 allows us to check if the variable has any records). The "record" member is set when the user calls pio_setframe() on the variable to set its current record. All variables with no record dimensions are supposed to have the "record" member set to -1.
3) comparing number of dimensions in file (fndims) and the number of dimensions in a decomposition (ndims). If fndims is greater than ndims the variable has a record dimension. This is a faulty check and is being fixed now - see PR #113

The issue with method 2, is that if the user chooses to call pio_setframe() on 1D variables with no record dimensions with a frame number >=0 we no longer can use the "record >= 0" check to determine if the variable has any records. Some E3SM code exhibits this behaviour. This is mostly a bug that we need to fix in the user code. However due to these kinds of bugs we now have code that check for both the number of dimensions and the record member to determine if a variables has any record dims.
The method (3) is being removed (PR #113) as explained above.
Using an approach like (1) should eliminate any need for guessing whether a variable has any records and we can consolidate all logic required to determine whether the variable has any records in a single place/function.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.