Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Climax
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
earth_observation_public
Climax
Commits
79090f87
Commit
79090f87
authored
3 years ago
by
Frisinghelli Daniel
Browse files
Options
Downloads
Patches
Plain Diff
Apply sigmoid to P(pr).
parent
8946d4cb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
climax/core/predict.py
+15
-10
15 additions, 10 deletions
climax/core/predict.py
with
15 additions
and
10 deletions
climax/core/predict.py
+
15
−
10
View file @
79090f87
...
@@ -59,19 +59,24 @@ def predict_ERA5(net, ERA5_ds, predictand, batch_size=16, **kwargs):
...
@@ -59,19 +59,24 @@ def predict_ERA5(net, ERA5_ds, predictand, batch_size=16, **kwargs):
# convert numpy array to xarray.Dataset
# convert numpy array to xarray.Dataset
if
predictand
==
'
tas
'
:
if
predictand
==
'
tas
'
:
# in case of tas, the netwokr predicts both tasmax and tasmin
# in case of tas, the netwokr predicts both tasmax and tasmin
ds
=
{
'
tasmax
'
:
EoDataset
.
add_coordinates
(
target
[:,
0
,
...].
squeeze
()
)
,
ds
=
{
'
tasmax
'
:
target
[:,
0
,
...].
squeeze
(),
'
tasmin
'
:
EoDataset
.
add_coordinates
(
target
[:,
1
,
...].
squeeze
()
)
}
'
tasmin
'
:
target
[:,
1
,
...].
squeeze
()}
elif
predictand
==
'
pr
'
:
elif
predictand
==
'
pr
'
:
ds
=
{
'
prob
'
:
EoDataset
.
add_coordinates
(
target
[:,
0
,
...].
squeeze
()),
ds
=
{
# probability of precipitation
# amount of precipitation: expected value of gamma distribution
'
prob
'
:
torch
.
sigmoid
(
target
[:,
0
,
...].
squeeze
()),
# pr = shape * scale
'
precipitation
'
:
EoDataset
.
add_coordinates
(
# amount of precipitation: expected value of gamma distribution
(
np
.
exp
(
target
[:,
1
,
...])
*
# pr = shape * scale
np
.
exp
(
target
[:,
2
,
...])).
squeeze
())}
'
precipitation
'
:
(
np
.
exp
(
target
[:,
1
,
...])
*
np
.
exp
(
target
[:,
2
,
...])).
squeeze
()
}
else
:
else
:
# single predictand
# single predictand
ds
=
{
predictand
:
EoDataset
.
add_coordinates
(
target
)}
ds
=
{
predictand
:
target
}
# add coordinates to arrays
ds
=
{
k
:
EoDataset
.
add_coordinates
(
v
)
for
k
,
v
in
ds
.
items
()}
# create xarray dataset: dtype=Float32
# create xarray dataset: dtype=Float32
ds
=
xr
.
Dataset
(
data_vars
=
ds
,
ds
=
xr
.
Dataset
(
data_vars
=
ds
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment