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
f2563282
Commit
f2563282
authored
4 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
minor
parent
e3a6322b
Branches
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/aeolus/aeolus_amv.py
+22
-21
22 additions, 21 deletions
modules/aeolus/aeolus_amv.py
with
22 additions
and
21 deletions
modules/aeolus/aeolus_amv.py
+
22
−
21
View file @
f2563282
...
...
@@ -1494,8 +1494,9 @@ def match_aeolus_to_clavrx(aeolus_dict, clvrx_files):
keys
=
list
(
aeolus_dict
.
keys
())
last_f_idx
=
-
1
cnt
=
0
param_nd
=
None
dataset
=
None
dataset_s
=
[]
for
key
in
keys
:
fname
,
ftime
,
f_idx
=
clvrx_files
.
get_file_containing_time
(
key
)
...
...
@@ -1508,14 +1509,8 @@ def match_aeolus_to_clavrx(aeolus_dict, clvrx_files):
if
f_idx
!=
last_f_idx
:
last_f_idx
=
f_idx
ds
=
Dataset
(
fname
)
param_s
=
[]
for
param
in
clvrx_params
:
param_s
.
append
(
ds
[
param
][:,:])
param_nd
=
np
.
stack
(
param_s
,
axis
=
0
)
ds
.
close
()
dataset
=
Dataset
(
fname
)
dataset_s
.
append
(
dataset
)
for
prof
in
prof_s
:
lat
=
prof
[
0
,
0
]
...
...
@@ -1530,10 +1525,14 @@ def match_aeolus_to_clavrx(aeolus_dict, clvrx_files):
# if c_rng is None:
# continue
tiles
=
param_nd
[:,
cc
-
4
:
cc
+
5
,
ll
-
4
:
ll
+
5
]
match_dict
[
cnt
]
=
(
key
,
cc
,
ll
,
f_idx
,
prof
,
tiles
)
data
=
[]
for
param
in
clvrx_params
:
data
.
append
(
dataset
[
param
][
cc
-
4
:
cc
+
5
,
ll
-
4
:
ll
+
5
])
param_nd
=
np
.
stack
(
data
,
axis
=
0
)
match_dict
[
cnt
]
=
(
key
,
cc
,
ll
,
f_idx
,
prof
,
param_nd
)
cnt
+=
1
for
ds
in
dataset_s
:
ds
.
close
()
return
match_dict
...
...
@@ -1574,6 +1573,9 @@ def create_file_2(match_dct, filename, clvrx_params):
elems
=
np
.
array
(
elems
)
lines
=
np
.
array
(
lines
)
# Sample file to retrieve and copy variable attributes
rg_exmpl
=
Dataset
(
'
/home/rink/data/clavrx/clavrx_OR_ABI-L1b-RadF-M6C01_G16_s20192930000343.level2.nc
'
,
'
r
'
)
# the top level group for the output file
rootgrp
=
Dataset
(
filename
,
'
w
'
,
format
=
'
NETCDF4
'
)
...
...
@@ -1604,15 +1606,14 @@ def create_file_2(match_dct, filename, clvrx_params):
# ----- Product variables ----------------
nc4_vars
=
[]
#out_params = amv_files.get_out_parameters()
#meta_dict = amv_files.get_meta_dict()
var_s
=
rg_exmpl
.
variables
for
pidx
,
param
in
enumerate
(
clvrx_params
):
#u, t = meta_dict.get(
param
)
u
=
None
t
=
'
f4
'
var
=
rootgrp
.
createVariable
(
param
,
t
,
[
'
num_aeolus_profs
'
,
'
grd_y_len
'
,
'
grd_x_len
'
]
)
if
u
is
not
None
:
var
.
units
=
u
v
=
var_s
[
param
]
var
=
rootgrp
.
createVariable
(
param
,
v
.
dtype
,
[
'
num_aeolus_profs
'
,
'
grd_y_len
'
,
'
grd_x_len
'
])
# copy attributes from example to new output variable of the same name
attr_s
=
v
.
ncattrs
(
)
for
attr
in
attr_s
:
var
.
setncattr
(
attr
,
v
.
getncattr
(
attr
))
nc4_vars
.
append
(
var
)
# Write data to file ---------------------
...
...
@@ -1637,7 +1638,7 @@ def create_file_2(match_dct, filename, clvrx_params):
for
pidx
,
param
in
enumerate
(
clvrx_params
):
nc4_vars
[
pidx
][
idx
,
:,
:]
=
param_nd
[
pidx
,
:,
:]
rg_exmpl
.
close
()
rootgrp
.
close
()
...
...
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