-
Notifications
You must be signed in to change notification settings - Fork 141
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
Dm get fns #885
Dm get fns #885
Conversation
Fills in CMOR_MISSING_VALUE for missing_value if none is given Adds rountines for fmsDiagObject_type
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
I added several comments but you may first want to read the longer one for
function "get_metadata". If you want we can discuss these in a meeting, etc.
@@ -396,17 +422,323 @@ function diag_obj_is_static (obj) result (rslt) | |||
rslt = obj%static |
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 whole function looks wierd to me. is member "static" and id ?
This mayneed a "!TODO:"
end function get_metadata | ||
!> @brief Gets static | ||
!! @return true if the variable is static | ||
function get_static (obj) & |
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.
What you have works, but we should discuss if its a good idea to follow a convention that adds
a function ( doesn;t get rig of the get_satic, but adds another ) named is_static
It is used like
if (obj%is_static() ) then
In the end, waht you ahve passes the litmus test that these two statements be
equivalent (if static had been public)
s = obj%static
s = obj%get_static()
(this is because staic is another intrisic (logical) like int, real etc.
end function get_static | ||
!> @brief Gets regisetered | ||
!! @return true if the object is registered | ||
function get_registered (obj) & |
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.
See get_static comment. Do we want a user to have if (obj%is_registered()
?
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, we WANT the user to check if something is allocated or registered. What happens if they don't?
@@ -35,7 +35,7 @@ module fms_diag_object_mod | |||
integer, allocatable, private :: diag_id !< unique id for varable | |||
class(FmsNetcdfFile_t), dimension (:), pointer :: fileob => NULL() !< A pointer to all of the | |||
!! file objects for this variable | |||
character(len=:), allocatable, dimension(:) :: metadata !< metedata for the variable | |||
character(len=:), allocatable, dimension(:) :: metadata !< metadata for the variable | |||
logical, private :: static !< true is this is a static var | |||
logical, allocatable, private :: registered !< true when registered |
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 its less complex and more efficient if the intrinsic primitives (like logical, integer, real) are not allocatable
and have a default set in the type definiition. E.g. like this
logical, private :: registered => .false.
it would help to add functions like logical is_registered()
(see comments below). Probably, type fms_dia_object
may nedd one or more initialize functions that the constructor calls.
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.
There was a reason I did it this way, but I can't remember now. I think it was so that objects could be unregistered and without deallocating the object. Also, I think some of the optional variables were left allocatable so that someone could check if they were allocated first.
if (obj%allocated_metadata()) metadata = obj%get_metadata()
I actually just finished the allocated functions. We should still discuss.
!! @return the variable name | ||
function get_varname (obj) & | ||
result(rslt) | ||
class (fmsDiagObject_type), intent(in) :: obj !< diag object |
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 guess in this case the getter litterally returns the member field (seems to pass the litmus test). But I will read (or as) what exatly does the assignemnt (=
) do. Hope we dont have to look at assemberr :-)
!> @brief Gets longname | ||
!! @return the variable long name or a single string if there is no long name | ||
function get_longname (obj) & | ||
result(rslt) |
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.
And in this case we dont follow the litmus test with the else = " "
statement. Too confusing to not follow one rule for such getters. BTW, One possibility is again with the default values in the type definition. Where
fields like longName is initialized (with =>) to "" or " " or some class or saystem default.
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 added a varaible called diag_null_sring
that is a parameter and has the value " ". This can be used in if statments
if (obj%get_longname() .ne. diag_null_string) longname = obj%get_longname()
procedure :: get_interp_method | ||
procedure :: get_frequency | ||
procedure :: get_output_units | ||
procedure :: get_t |
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.
Wat is "t" ? Is this a good name? Are there comments somewhere?
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 it was something that was temporarily being used. It should probably get deleted.
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 will remove it in a later PR.
Makes all integer get functions return diag_null if the variable is not allocated
Description
Fixes #884
How Has This Been Tested?
make
with intel compilersChecklist:
make distcheck
passes