Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 641337864
  • Loading branch information
yaniyuval authored and NeuralGCM authors committed Jun 7, 2024
1 parent 85ab37f commit 4ad8faf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions neuralgcm/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ def __init__(
method_precipitation: str = 'cumulative',
method_evaporation: str = 'rate',
name: Optional[str] = None,
field_name: str = 'precipitation_cumulative',
):
# del aux_features
super().__init__(name=name)
Expand All @@ -308,6 +309,7 @@ def __init__(
self.water_density = self.physics_specs.nondimensionalize(
scales.WATER_DENSITY
)
self.field_name = field_name

def __call__(
self,
Expand Down Expand Up @@ -339,9 +341,9 @@ def __call__(
)
elif self.method_precipitation == 'cumulative': # units: length
previous = model_state.diagnostics.get(
'precipitation_cumulative', jnp.zeros(surface_nodal_shape)
self.field_name, jnp.zeros(surface_nodal_shape)
)
output_dict['precipitation_cumulative'] = previous - (
output_dict[self.field_name] = previous - (
((e_minus_p + evaporation['evaporation']) / self.water_density)
* self.dt
)
Expand Down

0 comments on commit 4ad8faf

Please sign in to comment.