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
c0931f9b
Commit
c0931f9b
authored
4 years ago
by
rink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot..
parent
e70a887c
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
modules/aeolus/aeolus_amv.py
+10
-2
10 additions, 2 deletions
modules/aeolus/aeolus_amv.py
with
10 additions
and
2 deletions
modules/aeolus/aeolus_amv.py
+
10
−
2
View file @
c0931f9b
...
@@ -445,6 +445,7 @@ def create_amv_to_aeolus_match_file(aeolus_files_dir, amv_files_dir, outfile=Non
...
@@ -445,6 +445,7 @@ def create_amv_to_aeolus_match_file(aeolus_files_dir, amv_files_dir, outfile=Non
# dt_str_1: end time (YYYY-MM-DD_HH:MM)
# dt_str_1: end time (YYYY-MM-DD_HH:MM)
# returns:
# returns:
# amvs[ntimes, max_num_amvs_per_prof, num_of_params], profs[ntimes, max_num_levs_per_prof, num_of_params], times[ntimes]
# amvs[ntimes, max_num_amvs_per_prof, num_of_params], profs[ntimes, max_num_levs_per_prof, num_of_params], times[ntimes]
# longitude, latitude
def
subset_by_time
(
match_file
,
dt_str_0
,
dt_str_1
):
def
subset_by_time
(
match_file
,
dt_str_0
,
dt_str_1
):
rootgrp
=
Dataset
(
match_file
,
'
r
'
,
format
=
'
NETCDF4
'
)
rootgrp
=
Dataset
(
match_file
,
'
r
'
,
format
=
'
NETCDF4
'
)
all_dims
=
rootgrp
.
dimensions
all_dims
=
rootgrp
.
dimensions
...
@@ -459,6 +460,8 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
...
@@ -459,6 +460,8 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
a_dst_v
=
rootgrp
[
'
amv_dist
'
]
a_dst_v
=
rootgrp
[
'
amv_dist
'
]
a_prs_v
=
rootgrp
[
'
amv_pres
'
]
a_prs_v
=
rootgrp
[
'
amv_pres
'
]
p_lon_v
=
rootgrp
[
'
prof_longitude
'
]
p_lat_v
=
rootgrp
[
'
prof_latitude
'
]
p_azm_v
=
rootgrp
[
'
prof_azm
'
]
p_azm_v
=
rootgrp
[
'
prof_azm
'
]
p_spd_v
=
rootgrp
[
'
prof_spd
'
]
p_spd_v
=
rootgrp
[
'
prof_spd
'
]
p_hhb_v
=
rootgrp
[
'
prof_hhb
'
]
p_hhb_v
=
rootgrp
[
'
prof_hhb
'
]
...
@@ -482,6 +485,9 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
...
@@ -482,6 +485,9 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
time_idxs
=
time_idxs
[
valid
]
time_idxs
=
time_idxs
[
valid
]
n_times
=
time_idxs
.
shape
[
0
]
n_times
=
time_idxs
.
shape
[
0
]
lons
=
p_lon_v
[:]
lats
=
p_lat_v
[:]
prf_idx_start
=
np
.
sum
(
n_levs_per_prof
[
0
:
time_idxs
[
0
]])
prf_idx_start
=
np
.
sum
(
n_levs_per_prof
[
0
:
time_idxs
[
0
]])
amv_idx_start
=
np
.
sum
(
n_amvs_per_prof
[
0
:
time_idxs
[
0
]])
amv_idx_start
=
np
.
sum
(
n_amvs_per_prof
[
0
:
time_idxs
[
0
]])
...
@@ -505,7 +511,7 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
...
@@ -505,7 +511,7 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
c
=
accum_prf
c
=
accum_prf
d
=
accum_prf
+
n_levs
d
=
accum_prf
+
n_levs
amvs
[
idx
:
,
0
:
n_amvs
,
0
]
=
a_spd_v
[
a
:
b
]
amvs
[
idx
,
0
:
n_amvs
,
0
]
=
a_spd_v
[
a
:
b
]
amvs
[
idx
,
0
:
n_amvs
,
1
]
=
a_dir_v
[
a
:
b
]
amvs
[
idx
,
0
:
n_amvs
,
1
]
=
a_dir_v
[
a
:
b
]
amvs
[
idx
,
0
:
n_amvs
,
2
]
=
a_prs_v
[
a
:
b
]
amvs
[
idx
,
0
:
n_amvs
,
2
]
=
a_prs_v
[
a
:
b
]
amvs
[
idx
,
0
:
n_amvs
,
3
]
=
a_dst_v
[
a
:
b
]
amvs
[
idx
,
0
:
n_amvs
,
3
]
=
a_dst_v
[
a
:
b
]
...
@@ -518,6 +524,8 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
...
@@ -518,6 +524,8 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
accum_amv
+=
n_amvs
accum_amv
+=
n_amvs
accum_prf
+=
n_levs
accum_prf
+=
n_levs
return
amvs
,
profs
,
times
[
time_idxs
]
prof_times_locs
=
np
.
hstack
((
times
[
time_idxs
],
lons
[
time_idxs
],
lats
[
time_idxs
]))
return
profs
,
amvs
,
prof_times_locs
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