-
Notifications
You must be signed in to change notification settings - Fork 136
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
Add some of the io for the field's metadata #1102
Add some of the io for the field's metadata #1102
Conversation
|
||
!> @brief Loops through all the files, open the file, writes out axis and | ||
!! variable metadata and data when necessary. | ||
subroutine fms_diag_do_io(this, time_step, is_end_of_run) |
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.
@thomas-robinson
The behavior of this function will need to be updated #391 (comment)
But we should leave it the way it is now because it makes it easier to test (to check if all metadata is there). I will update this in the next, next PR
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.
OK, we should also reach out to the scientists and make sure that they are ok with this behavior change
@@ -220,9 +229,14 @@ subroutine fms_register_diag_field_obj & | |||
!> get the optional arguments if included and the diagnostic is in the diag table | |||
if (present(longname)) this%longname = trim(longname) | |||
if (present(standname)) this%standname = trim(standname) | |||
if (present(units)) this%units = trim(units) | |||
|
|||
!> Ignore the units if the file they are set to "none". This it to reproduce previous diag_manager |
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.
you have a typo. Should be "This is to reproduce previous diag_manager"
character(len=120), intent(out), allocatable :: rslt(:) | ||
|
||
integer :: i !< For do loops | ||
integer :: j !< For do loops |
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 not for do loops, it's the axis ID.
allocate(rslt(naxis)) | ||
|
||
do i = 1, size(this%axis_ids) | ||
j = this%axis_ids(i) |
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 suggest renaming this variable to axis_id or something more descriptive. I also think you can make it a "pointer for convenience"
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 was replaced with a pointer 6d73416
trim(time_var_name)//"_bounds", str_len=len_trim(time_var_name//"_bounds")) | ||
trim(time_var_name)//"_bnds", str_len=len_trim(time_var_name//"_bnds")) |
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.
Is this to get it in like with the current?
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.
yes, it should be _bnds
class(fmsDiagFile_type), pointer :: diag_file !< Diag_file object to open | ||
|
||
integer :: i !< For do loops | ||
integer :: j !< For do loops |
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 a field ID not an index for looping. It should probably be a pointer.
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 was replaced with a pointer 6d73416
!TODO I think if the area and the volume field are no in the same file, a global attribute containing the | ||
!the file that the fields are in needs to be added |
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.
Do we need to discuss this?
|
||
do i = 1, size(diag_file%field_ids) | ||
j = diag_file%field_ids(i) | ||
if (.not. diag_file%field_registered(i)) cycle !TODO do something else here |
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.
Maybe instead of a do
this could be a where
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.
The where
won't work because you are writing.
integer :: naxis !< Number of axis for the field | ||
class(fmsDiagAxisContainer_type), pointer :: axis_ptr !diag_axis(this%axis_ids(i), for convenience |
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 so much cleaner now.
@@ -1120,6 +1121,51 @@ subroutine write_field_metadata(this, fileobj, file_id, yaml_id, diag_axis, unli | |||
trim(adjustl(cell_measures)), str_len=len_trim(adjustl(cell_measures))) | |||
|
|||
end subroutine write_field_metadata | |||
!> @brief Gets a fields data buffer | |||
!! @return a pointer to the data buffer |
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.
We'll have to see if there are any issues with returning a pointer down the road.
|
||
do i = 1, size(diag_file%field_ids) | ||
j = diag_file%field_ids(i) | ||
if (.not. diag_file%field_registered(i)) cycle !TODO do something else here |
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.
The where
won't work because you are writing.
Add some of the io for the field's metadata
Add some of the io for the field's metadata
Description
Fixes # (issue)
How Has This Been Tested?
CI
Checklist:
make distcheck
passes