Skip to content
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

Merged
merged 4 commits into from
Jan 31, 2023

Conversation

uramirez8707
Copy link
Contributor

@uramirez8707 uramirez8707 commented Jan 4, 2023

Description

  • Writes the field's metadata to the corresponding netcdf file. There is still more work needed for the diurnal variables and the uncompressed land files, but that will be done in a seperate PR

Fixes # (issue)

How Has This Been Tested?
CI

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included
  • make distcheck passes

@uramirez8707 uramirez8707 marked this pull request as ready for review January 4, 2023 20:00

!> @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)
Copy link
Contributor Author

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

Copy link
Member

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

@uramirez8707 uramirez8707 mentioned this pull request Jan 23, 2023
8 tasks
@@ -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
Copy link
Member

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
Copy link
Member

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)
Copy link
Member

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"

Copy link
Contributor Author

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

Comment on lines -911 to +956
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"))
Copy link
Member

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?

Copy link
Contributor Author

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

diag_manager/fms_diag_file_object.F90 Show resolved Hide resolved
class(fmsDiagFile_type), pointer :: diag_file !< Diag_file object to open

integer :: i !< For do loops
integer :: j !< For do loops
Copy link
Member

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.

Copy link
Contributor Author

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

Comment on lines +1167 to +1168
!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
Copy link
Member

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
Copy link
Member

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

Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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.

@thomas-robinson thomas-robinson merged commit af0b3ca into NOAA-GFDL:dmUpdate Jan 31, 2023
rem1776 pushed a commit to rem1776/FMS that referenced this pull request May 1, 2024
 Add some of the io for the field's metadata
rem1776 pushed a commit to rem1776/FMS that referenced this pull request May 1, 2024
 Add some of the io for the field's metadata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants