Skip to content
Snippets Groups Projects
Commit d8302405 authored by Frisinghelli Daniel's avatar Frisinghelli Daniel
Browse files

Calculate precipitation amount from gamma distribution.

parent 1a42b5b5
No related branches found
No related tags found
No related merge requests found
......@@ -63,13 +63,12 @@ def predict_ERA5(net, ERA5_ds, predictand, batch_size=16, **kwargs):
'tasmin': EoDataset.add_coordinates(target[:, 1, ...].squeeze())}
elif predictand == 'pr':
ds = {'prob': EoDataset.add_coordinates(target[:, 0, ...].squeeze()),
'shape': EoDataset.add_coordinates(target[:, 1, ...].squeeze()),
'scale': EoDataset.add_coordinates(target[:, 2, ...].squeeze()),
# amount of precipitation: expected value of gamma distribution
# pr = shape * scale
'pr': EoDataset.add_coordinates((target[:, 1, ...] *
target[:, 2, ...]).squeeze())}
'pr': EoDataset.add_coordinates(
(np.exp(target[:, 1, ...]) *
np.exp(target[:, 2, ...])).squeeze())}
else:
# single predictand
ds = {predictand: EoDataset.add_coordinates(target)}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment