direct usage of parameter datastructure - allometry proof of concept#1528
direct usage of parameter datastructure - allometry proof of concept#1528rgknox wants to merge 1 commit into
Conversation
|
I have a prototype of an alternative approach, see this commit: In this approach, the idea more similar to our previous approach. Every parameter is associated with a uniquely named primitive data structure, with a few key differences.
|
|
Thanks for doing this Ryan. I really appreciate the effort to try to clean up our handling of parameters in FATES, as it has always felt a little haphazard to me. I guess I was hoping to discuss the problems your PR is hoping to solve. It seems like the main one is your goal of removing the "middle man" problem. However, I guess I see it differently. From my perspective, it is a good idea to have two separate classes (or types of classes) to handle the parameters: (1) read/parse the JSON file, handle string lookups, deal with raw data, etc. (i.e. your The readability and debugging feels easier to me if the parameters are held in the second class. Right now if we use the Additionally, if our I/O method ever changes, we do not have to re-factor the entire model, just where it's translated to the "holder" class. What I would really like to see with the parameters class(es) is either have one class that holds all the parameters in named variables, or several (one for each "category"), i.e. leaf_params, fire_params, etc., though I feel like this needs to be fairly well constrained. The idea here would be that we initialize the But I'd like to talk more about this since I realize I am suggesting something really different than what you wrote. |
|
Thanks for your thoughts @adrifoster , yeah, I'm curious what others think on this too. I also like the idea of moving back to one data structure to hold all parameter constants. So if we do go with the plan of transferring to the holder data structure, and removing the json data structure, lets stick with one structure, instanced in FatesParametersInterfaceMod, which has almost no dependencies. Something we could do to mitigate some of the issues described thus far: If we went with maintaining just the "pstruct" data structure, the index that identifies a parameter could have the same exact syntax as the parameter name in the file: for instance the parameter 'fates_leaf_vcmax25top', could use integer index fates_leaf_vcmax25top. This would actually reduce the number of names used, as right now we call this %vcmax25top. This would reduce ambiguity, we only need remember the name as it appears in the file, should be easily searchable in the code. That being said, the part that I also don't like about exclusively using the pstruct% json data structure to access the parameters in the code, is that we will dealing with these different array types in our code: %r_data_1d, sometimes %i_data_1d, etc ... It doesn't come across as very clean, and people might not understand what is going on. Maybe I'm coming around on this idea of using a holder structure and deallocating the pstruct json structure. |
|
Adding my thoughts:
I really like the idea of aligning the parameter names so they are closer if not exactly the same.
I was thinking this as well. Initially I was going to suggest some sort of function call with the parameter ID as input argument to return the data, but I think that might be overkill in this particular instance. I want to 👍 your suggestion to use In thinking about this, I really like maintaining a "separation of concerns" here with the design as suggested by @adrifoster, i.e. having a derived type for IO and a separate derived type for accessing the data. So I think @rgknox suggestion of creating a new type with a pointer to the I do strongly agree that we should keep the parameter metadata, specifically the units. I would like us eventually to develop (or make use of) a module that handles unit conversions in a more automated and safe manner. Keeping the units stored with the parameters would help move us in that direction. |
Description:
With the introduction of the parameter data structure, we can access parameters directly from that structure and bypass the middle-man, ie the allocated data primitive arrays that we fill from the parameter data structure.
Following initial review and discussion, the relevant data primitives will be removed.
Collaborators:
Expectation of Answer Changes:
This should not change any answers, B4B
Checklist
If this is your first time contributing, please read the CONTRIBUTING document.
All checklist items must be checked to enable merging this pull request:
Contributor
Integrator
If satellite phenology regressions are not b4b, please hold merge and notify the FATES development team.
Documentation
Test Results:
TBD
CTSM (or) E3SM (specify which) test hash-tag:
CTSM (or) E3SM (specify which) baseline hash-tag:
FATES baseline hash-tag:
Test Output: