-
Notifications
You must be signed in to change notification settings - Fork 137
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
Modifydiag_field_add_attribute
to accept r4 and r8
#1625
base: main
Are you sure you want to change the base?
Conversation
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
CALL diag_field_attribute_init(diag_field_id, att_name, NF90_FLOAT, rval=att_value) |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a r8 value is coming in, shouldn't this be an NF90_DOUBLE
in both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In both routines, not both lines, that is.
Description
Modifies
diag_field_add_attribute
to accept r4 and r8Adds a test
Fixes #1621
How Has This Been Tested?
CI including new test
Checklist:
make distcheck
passes