MPAS-Dev / MPAS-Model

Repository for MPAS models and shared framework releases.
238 stars 317 forks source link

Update test Registry.xml to have numeric missing_values #1104

Closed dimomatt closed 1 year ago

dimomatt commented 1 year ago

PR #1101 created a new array of names of numeric attributes, one of which is the "missing_value" attribute. In the test core, however, the only uses of "missing_value" assign it to the string "FILLVAL". This is nonnumeric, and causes compiler errors on that branch. This PR updates the two uses of "FILLVAL" to numeric values- 0.0 in the case of the one real valued field, and -999 in the case of the integer valued field to match other variables in the registry.

The test core compiles and runs properly with these modifications.

mgduda commented 1 year ago

Apologies for not doing a better job of checking the current behavior of the code earlier. It does appear that the registry code generator does translate the string "FILLVAL" into a numeric constant that is the specified fill value for real and integer values.

In the test core, we have, for example,

<var name="indexToCellID"                     type="integer"  dimensions="nCells" missing_value="FILLVAL"/>

in the Registry.xml file.

The logic beginning around line 454 in gen_inc.c translates "FILLVAL" to a numeric constant in the missing_value string for a variable.

Then, missing_value is used in the fortprintf call that writes a numeric attribute for a variable around line 1640 of gen_inc.c (and elsewhere for var_arrays).

It might be worth taking a look at PR #1101 to see if we can handle "FILLVAL" specifications for numerical attributes in an elegant way.