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
ffe4e0e0
Commit
ffe4e0e0
authored
4 months ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
339b54e3
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
+11
-6
11 additions, 6 deletions
modules/util/acspo_validate.py
with
11 additions
and
6 deletions
modules/util/acspo_validate.py
+
11
−
6
View file @
ffe4e0e0
...
...
@@ -32,6 +32,7 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None):
cspp_clear
=
(
l2p_flags_cspp
&
(
1
<<
15
))
==
0
oper_clear
=
(
l2p_flags_oper
&
(
1
<<
15
))
==
0
# Find the overlap Track indexes relative to each ------------------------
start_idx_oper
,
stop_idx_oper
=
-
1
,
-
1
start_idx_cspp
,
stop_idx_cspp
=
-
1
,
-
1
...
...
@@ -47,6 +48,7 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None):
print
(
'
oper start, stop
'
,
start_idx_oper
,
stop_idx_oper
)
print
(
'
cspp start, stop
'
,
start_idx_cspp
,
stop_idx_cspp
)
# --------------------------------------------------------------------------
lon_cspp
=
lon_cspp
[
start_idx_cspp
:
stop_idx_cspp
,
:]
lat_cspp
=
lat_cspp
[
start_idx_cspp
:
stop_idx_cspp
,
:]
...
...
@@ -58,8 +60,8 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None):
print
(
'
overlap shape, size:
'
,
overlap_shape
,
np
.
size
(
lon_cspp
))
# check lon/lat arrays ------------------------------------
print
(
np
.
sum
(
np
.
isclose
(
lon_cspp
,
lon_oper
,
rtol
=
rel_tol
)))
print
(
np
.
sum
(
np
.
isclose
(
lat_cspp
,
lat_oper
,
rtol
=
rel_tol
)))
print
(
'
num of close overlap lons:
'
,
np
.
sum
(
np
.
isclose
(
lon_cspp
,
lon_oper
,
rtol
=
rel_tol
)))
print
(
'
num of close overlap lats:
'
,
np
.
sum
(
np
.
isclose
(
lat_cspp
,
lat_oper
,
rtol
=
rel_tol
)))
sst_cspp_2d
=
sst_cspp
[
start_idx_cspp
:
stop_idx_cspp
,
:]
sst_oper_2d
=
sst_oper
[
start_idx_oper
:
stop_idx_oper
,
:]
...
...
@@ -75,6 +77,7 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None):
lat_cspp
=
lat_cspp
.
flatten
()
lon_oper
=
lon_oper
.
flatten
()
lat_oper
=
lat_oper
.
flatten
()
both_clear
=
oper_clear
&
cspp_clear
sst_cspp
=
sst_cspp
[
both_clear
]
sst_oper
=
sst_oper
[
both_clear
]
...
...
@@ -82,9 +85,10 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None):
lat_cspp
=
lat_cspp
[
both_clear
]
lon_oper
=
lon_oper
[
both_clear
]
lat_oper
=
lat_oper
[
both_clear
]
print
(
'
number of clear pixels in both:
'
,
np
.
sum
(
both_clear
))
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
pixels with
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
]
...
...
@@ -105,7 +109,6 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None):
print
(
'
fraction approx equal:
'
,
np
.
sum
(
np
.
isclose
(
valid_sst_cspp
,
valid_sst_oper
,
rtol
=
rel_tol
))
/
np
.
sum
(
both_valid
))
# print(np.histogram((sst_cspp[both_valid] - sst_oper[both_valid]), bins=10))
h5f_oper
.
close
()
h5f_cspp
.
close
()
...
...
@@ -122,11 +125,13 @@ def analyze_plot():
h5f_e
=
h5py
.
File
(
'
/Users/tomrink/20241107171000.nc
'
,
'
r
'
)
h5f_f
=
h5py
.
File
(
'
/Users/tomrink/20241107202000.nc
'
,
'
r
'
)
h5f_g
=
h5py
.
File
(
'
/Users/tomrink/20241107203000.nc
'
,
'
r
'
)
import
numpy
as
np
sst_cspp_all
=
np
.
concatenate
([
h5f_a
[
'
sst_cspp
'
][
0
,
:],
h5f_b
[
'
sst_cspp
'
][
0
,
:],
h5f_c
[
'
sst_cspp
'
][
0
,
:],
h5f_d
[
'
sst_cspp
'
][
0
,
:],
h5f_e
[
'
sst_cspp
'
][
0
,
:],
h5f_f
[
'
sst_cspp
'
][
0
,
:],
h5f_g
[
'
sst_cspp
'
][
0
,
:]])
sst_cspp_all
.
shape
print
(
sst_cspp_all
.
shape
)
sst_oper_all
=
np
.
concatenate
([
h5f_a
[
'
sst_oper
'
][
0
,
:],
h5f_b
[
'
sst_oper
'
][
0
,
:],
h5f_c
[
'
sst_oper
'
][
0
,
:],
h5f_d
[
'
sst_oper
'
][
0
,
:],
h5f_e
[
'
sst_oper
'
][
0
,
:],
h5f_f
[
'
sst_oper
'
][
0
,
:],
h5f_g
[
'
sst_oper
'
][
0
,
:]])
sst_oper_all
.
shape
print
(
sst_oper_all
.
shape
)
diff
=
sst_cspp_all
-
sst_oper_all
import
matplotlib.pyplot
as
plt
plt
.
hist
(
diff
,
bins
=
40
)
...
...
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