diagnostics #256
Replies: 20 comments
-
My questions:
|
Beta Was this translation helpful? Give feedback.
-
For 1: The old diagnostics are like this: class Foo(object):
def __init__(self):
pass
list_of_foos = [Foo(), Foo(), Foo()]
state = State(...., list_of_foos) But really, every So instead: class Foo(object):
def __init__(self, state):
pass
list_of_foos = [Foo, Foo, Foo]
state = State(..., list_of_foos) and class State(object):
def __init__(self, list_of_foos):
self.list_of_foos = [foo(self) for foo in list_of_foos] |
Beta Was this translation helpful? Give feedback.
-
Alternately, because this is sort of icky in its circular references, we could add a |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
How about if you're using the Sum diagnostic field, which requires you to tell it which fields to sum? |
Beta Was this translation helpful? Give feedback.
-
Maybe, we would need to think harder about how to design this. |
Beta Was this translation helpful? Give feedback.
-
An addition that I thought could be useful is to find the perturbation in a diagnostic variable (at the moment we only do it for prognostic variables?), which I thought I should mention because it seems vaguely relevant to Jemma's second problem. |
Beta Was this translation helpful? Give feedback.
-
Yes @tommbendall, that's exactly the problem that we'd like to solve - I suppose you want a perturbation Exner pressure? We need to be able to define a diagnostic field that calculates the Exner pressure, a diagnostic field that calculates the background Exner pressure and have the Difference diagnostic cope with that without my current hack (which is on one of Hiroe's branches) of checking if the arguments are fields or diagnostic field class instances. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I actually have a lot of hacked up diagnostic variables like that related to moisture somewhere on a branch! One thing I'd previously thought of is having a list of initial diagnostic fields that is a property of the diagnostics class, which could then be passed to other diagnostics, i.e. class Diagnostics(object):
def __init__(self, state):
self.perturbation_fields = [] You'd also need an initialisation step though, like |
Beta Was this translation helpful? Give feedback.
-
@tommbendall I'd be interested to see your hack-diagnostics-on-a-branch - could you point me to it? |
Beta Was this translation helpful? Give feedback.
-
Maybe we need to postpone the setup of diagnostic fields until after state has been constructed - a bit like to do with initialisation (maybe this is what you meant @tommbendall ?) So state would need a setup_diagnostic_fields method which we would call from the setup file - then we could pass instances of the diagnostic field classes as we do now (so things like Sum would still work), and we would have state available so we can set up solvers in the init method. I'm still not understanding how we can avoid something like the code in #104 lines 265-269 of diagnostics.py where we have to figure out if Sum needs to add 2 fields that are already in state.fields or whether it needs to get them from another diagnostic fields class. Would it help if diagnostic fields were added to state.fields? Then we would need some way of telling whether the diagnostic field had been calculated already that timestep before we tried to do anything with it. I seem to have more questions than answers... |
Beta Was this translation helpful? Give feedback.
-
The problem is that a |
Beta Was this translation helpful? Give feedback.
-
The stuff I'd done is in diagnostics.py on the moist_hydrostatic branch. I wouldn't recommend doing what I did though -- in my test cases I was setting up new fields (e.g. initial Exner pressure). These initial fields don't do anything except get read into diagnostics. |
Beta Was this translation helpful? Give feedback.
-
OK, here's my train of thought and possible solution...
So, how about we replace the
where I think something like this could be made to work, but I'm not sure if people think it is good code practise or not. Thoughts? |
Beta Was this translation helpful? Give feedback.
-
One possible problem with a generic
? Can we ever just |
Beta Was this translation helpful? Give feedback.
-
I have a proposal that's relevant to some of the issues raised here. I've made a subclass of I think this allows us to view perturbed diagnostic fields in an easy way. I'm not sure it solves either of the problems Jemma originally raised however... If we're looking to do some major rewriting of |
Beta Was this translation helpful? Give feedback.
-
What branch is that on Tom? I'm still interested in making this all a bit tidier... |
Beta Was this translation helpful? Give feedback.
-
I'm afraid it's not on its own branch at the moment! It's actually on the moist_hydrostatic branch. I actually added another feature yesterday. I can now do two things: make the base diagnostic state from the initial prognostic variables, or you can choose your own base diagnostic state. It's not very neat but it allowed me to do both of those things easily... |
Beta Was this translation helpful? Give feedback.
-
Hi Tom,
We should talk about getting your stuff into master in incremental chunks
otherwise you are going to drift further and further away from what we have!
cheers
--cjc
…On 11 July 2017 at 19:19, tommbendall ***@***.***> wrote:
I'm afraid it's not on its own branch at the moment! It's actually on the
moist_hydrostatic branch.
I actually added another feature yesterday. I can now do two things: make
the base diagnostic state from the initial prognostic variables, or you can
choose your own base diagnostic state.
It's not very neat but it allowed me to do both of those things easily...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#106 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF0q8szLkOJ2swydJFol-St0QrUh5_ONks5sM66qgaJpZM4NwPoy>
.
|
Beta Was this translation helpful? Give feedback.
-
I know! I don't think it should be much of a problem, I was going to put in pull requests in stages after the Gung Ho meeting next week. |
Beta Was this translation helpful? Give feedback.
-
Each diagnostic field is a subclass of the DiagnosticField class and as such is required to have a name and a compute method. The diagnostic field classes are instantiated in the setup file and passed in to state. This causes several problems:
Suggested solutions (from @wence- ):
Discuss! @colinjcotter @hiroe- @dorugeber @thomasgibson @tommbendall (I'm tagging you but you don't have to care and conversely, if you're not tagged, I still want to hear from you if you do care!)
Beta Was this translation helpful? Give feedback.
All reactions