Modifydiag_field_add_attribute to accept r4 and r8#1625
Modifydiag_field_add_attribute to accept r4 and r8#1625rem1776 merged 4 commits intoNOAA-GFDL:mainfrom
diag_field_add_attribute to accept r4 and r8#1625Conversation
diag_manager/diag_manager.F90
Outdated
| type is (real(kind=r4_kind)) | ||
| call diag_field_add_attribute_scalar_r(diag_field_id, att_name, real(att_value)) | ||
| type is (real(kind=r8_kind)) | ||
| call diag_field_add_attribute_scalar_r(diag_field_id, att_name, real(att_value)) | ||
| type is (integer(kind=i4_kind)) |
There was a problem hiding this comment.
This is enforcing the attribute value to be the same as the default precision specifiec at compile time, shouldn't it be the same as the incoming type-value?
There was a problem hiding this comment.
I think @bensonr is right here. If I build FMS as r4 then this:
type is (real(kind=r8_kind))
call diag_field_add_attribute_scalar_r(diag_field_id, att_name, real(att_value))
will cast the r8 real I pass down into an r4 (since that is what real means).
In my attempt at this, I essentially "doubled up" and made two diag_field_add_attribute_scalar_r4 and a diag_field_add_attribute_scalar_r8 (and similar for the r1d → r41d, r81d)
There was a problem hiding this comment.
In the old diag manager, it ends up always writing the att_value as NF90_FLOAT.
FMS/diag_manager/diag_manager.F90
Line 4547 in d79c3b5
In 4829fe8, I made the changes so that the new diag manager uses the actual precision of att_value.
| type is (real(kind=r4_kind)) | ||
| CALL diag_field_attribute_init(diag_field_id, att_name, NF90_FLOAT, rval=real((/att_value/))) | ||
| type is (real(kind=r8_kind)) | ||
| CALL diag_field_attribute_init(diag_field_id, att_name, NF90_FLOAT, rval=real((/att_value/))) |
There was a problem hiding this comment.
If a r8 value is coming in, shouldn't this be an NF90_DOUBLE in both?
There was a problem hiding this comment.
In both routines, not both lines, that is.
Description
Modifies
diag_field_add_attributeto accept r4 and r8Adds a test
Fixes #1621
How Has This Been Tested?
CI including new test
Checklist:
make distcheckpasses