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
eaeb0f5e
Commit
eaeb0f5e
authored
4 years ago
by
rink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot..
parent
946b92b3
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/aeolus/aeolus_amv.py
+14
-3
14 additions, 3 deletions
modules/aeolus/aeolus_amv.py
with
14 additions
and
3 deletions
modules/aeolus/aeolus_amv.py
+
14
−
3
View file @
eaeb0f5e
...
@@ -2,6 +2,7 @@ import datetime, os
...
@@ -2,6 +2,7 @@ import datetime, os
from
datetime
import
timezone
from
datetime
import
timezone
import
glob
import
glob
import
numpy
as
np
import
numpy
as
np
import
xarray
as
xr
from
netCDF4
import
Dataset
,
Dimension
,
Variable
from
netCDF4
import
Dataset
,
Dimension
,
Variable
from
aeolus.geos_nav
import
GEOSNavigation
from
aeolus.geos_nav
import
GEOSNavigation
from
util.util
import
haversine_np
from
util.util
import
haversine_np
...
@@ -444,8 +445,8 @@ def create_amv_to_aeolus_match_file(aeolus_files_dir, amv_files_dir, outfile=Non
...
@@ -444,8 +445,8 @@ def create_amv_to_aeolus_match_file(aeolus_files_dir, amv_files_dir, outfile=Non
# dt_str_0: start time (YYYY-MM-DD_HH:MM)
# dt_str_0: start time (YYYY-MM-DD_HH:MM)
# dt_str_1: end time (YYYY-MM-DD_HH:MM)
# dt_str_1: end time (YYYY-MM-DD_HH:MM)
# returns:
# returns:
# amvs[n
time
s, max_num_amvs_per_prof, num_of_params], profs[n
time
s, max_num_levs_per_prof, num_of_params],
times[ntimes]
# amvs[n
prof
s, max_num_amvs_per_prof, num_of_params], profs[n
prof
s, max_num_levs_per_prof, num_of_params],
#
longitude, latitude
#
prof_times_locs[nprofs, (time, lon, lat)
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
...
@@ -526,6 +527,16 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
...
@@ -526,6 +527,16 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
prof_times_locs
=
np
.
column_stack
([
times
[
time_idxs
],
lons
[
time_idxs
],
lats
[
time_idxs
]])
prof_times_locs
=
np
.
column_stack
([
times
[
time_idxs
],
lons
[
time_idxs
],
lats
[
time_idxs
]])
return
profs
,
amvs
,
prof_times_locs
coords
=
{
'
num_profs
'
:
times
[
time_idxs
],
'
num_params
'
:
[
'
speed
'
,
'
azimuth
'
,
'
layer_bot
'
,
'
layer_top
'
]}
prof_da
=
xr
.
DataArray
(
profs
,
coords
=
coords
,
dims
=
[
'
num_profs
'
,
'
max_num_levels
'
,
'
num_params
'
])
coords
=
{
'
num_profs
'
:
times
[
time_idxs
],
'
num_params
'
:
[
'
speed
'
,
'
azimuth
'
,
'
pressure
'
,
'
distance
'
]}
amvs_da
=
xr
.
DataArray
(
amvs
,
coords
=
coords
,
dims
=
[
'
num_profs
'
,
'
max_num_amvs
'
,
'
num_params
'
])
prof_locs_da
=
xr
.
DataArray
(
np
.
column_stack
([
lons
[
time_idxs
],
lats
[
time_idxs
]]),
coords
=
[
times
[
time_idxs
],
[
'
longitude
'
,
'
latitude
'
]],
dims
=
[
'
num_profs
'
,
'
space
'
])
return
prof_da
,
amvs_da
,
prof_locs_da
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