Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Tom Rink
python
Commits
0b219169
Commit
0b219169
authored
5 months ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
a839bc9a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/util/acspo_validate.py
+28
-3
28 additions, 3 deletions
modules/util/acspo_validate.py
with
28 additions
and
3 deletions
modules/util/acspo_validate.py
+
28
−
3
View file @
0b219169
import
numpy
as
np
import
numpy
as
np
import
h5py
import
h5py
import
xarray
as
xr
from
util.util
import
get_grid_values_all
from
util.util
import
get_grid_values_all
...
@@ -68,13 +69,37 @@ def acspo_validate(oper_file, cspp_file):
...
@@ -68,13 +69,37 @@ def acspo_validate(oper_file, cspp_file):
both_clear
=
oper_clear
&
cspp_clear
both_clear
=
oper_clear
&
cspp_clear
sst_cspp
=
sst_cspp
[
both_clear
]
sst_cspp
=
sst_cspp
[
both_clear
]
sst_oper
=
sst_oper
[
both_clear
]
sst_oper
=
sst_oper
[
both_clear
]
lon_cspp
=
lon_cspp
.
flatten
()
lat_cspp
=
lat_cspp
.
flatten
()
lon_oper
=
lon_oper
.
flatten
()
lat_oper
=
lat_oper
.
flatten
()
lon_cspp
=
lon_cspp
[
both_clear
]
lat_cspp
=
lat_cspp
[
both_clear
]
lon_oper
=
lon_oper
[
both_clear
]
lat_oper
=
lat_oper
[
both_clear
]
both_valid
=
np
.
invert
(
np
.
isnan
(
sst_cspp
))
&
np
.
invert
(
np
.
isnan
(
sst_oper
))
both_valid
=
np
.
invert
(
np
.
isnan
(
sst_cspp
))
&
np
.
invert
(
np
.
isnan
(
sst_oper
))
print
(
'
number of clear and valid SSTs in both:
'
,
np
.
sum
(
both_valid
))
print
(
'
number of clear and valid SSTs in both:
'
,
np
.
sum
(
both_valid
))
valid_sst_cspp
=
sst_cspp
[
both_valid
]
valid_sst_oper
=
sst_oper
[
both_valid
]
valid_lon_cspp
=
lon_cspp
[
both_valid
]
valid_lat_cspp
=
lat_cspp
[
both_valid
]
valid_lon_oper
=
lon_oper
[
both_valid
]
valid_lat_oper
=
lat_oper
[
both_valid
]
xarray_data
=
xr
.
Dataset
({
'
sst_cspp
'
:
xr
.
DataArray
([
valid_sst_cspp
],
coords
=
None
,
dims
=
None
,
name
=
'
sst_cspp
'
),
'
sst_oper
'
:
xr
.
DataArray
([
valid_sst_oper
],
coords
=
None
,
dims
=
None
,
name
=
'
sst_oper
'
),
'
cspp_lat
'
:
xr
.
DataArray
([
valid_lat_cspp
],
coords
=
None
,
dims
=
None
,
name
=
'
cspp_lat
'
),
'
cspp_lon
'
:
xr
.
DataArray
([
valid_lon_cspp
],
coords
=
None
,
dims
=
None
,
name
=
'
cspp_lon
'
),
'
oper_lat
'
:
xr
.
DataArray
([
valid_lat_oper
],
coords
=
None
,
dims
=
None
,
name
=
'
oper_lat
'
),
'
oper_lon
'
:
xr
.
DataArray
([
valid_lon_oper
],
coords
=
None
,
dims
=
None
,
name
=
'
oper_lon
'
),
})
xarray_data
.
to_netcdf
(
'
/Users/tomrink/sst_values.nc
'
)
print
(
'
fraction approx equal:
'
,
print
(
'
fraction approx equal:
'
,
np
.
sum
(
np
.
isclose
(
sst_cspp
[
both_
valid
],
sst_oper
[
both_valid
]
,
rtol
=
0.001
))
/
np
.
sum
(
both_valid
))
np
.
sum
(
np
.
isclose
(
valid_
sst_cspp
,
valid
_
sst_oper
,
rtol
=
0.001
))
/
np
.
sum
(
both_valid
))
# print(np.histogram((sst_cspp[both_valid] - sst_oper[both_valid]), bins=10))
# print(np.histogram((sst_cspp[both_valid] - sst_oper[both_valid]), bins=10))
h5f_oper
.
close
()
h5f_cspp
.
close
()
\ No newline at end of file
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