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
9b761859
Commit
9b761859
authored
4 years ago
by
rink
Browse files
Options
Downloads
Patches
Plain Diff
add support for Carr stereo winds
parent
08e862ff
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
+28
-7
28 additions, 7 deletions
modules/aeolus/aeolus_amv.py
with
28 additions
and
7 deletions
modules/aeolus/aeolus_amv.py
+
28
−
7
View file @
9b761859
...
@@ -46,6 +46,15 @@ def get_datetime_ops(pathname):
...
@@ -46,6 +46,15 @@ def get_datetime_ops(pathname):
return
dto
return
dto
def
get_datetime_carr
(
pathname
):
fname
=
os
.
path
.
split
(
pathname
)[
1
]
toks
=
fname
.
split
(
'
_
'
)
dtstr
=
toks
[
3
]
dto
=
datetime
.
datetime
.
strptime
(
dtstr
,
'
%Y%j.%H%M
'
).
replace
(
tzinfo
=
timezone
.
utc
)
return
dto
def
get_file_containing_time
(
timestamp
,
files_path
,
file_time_span
,
amv_source
=
'
OPS
'
,
band
=
'
14
'
):
def
get_file_containing_time
(
timestamp
,
files_path
,
file_time_span
,
amv_source
=
'
OPS
'
,
band
=
'
14
'
):
global
first_time
,
ftimes
,
flist
global
first_time
,
ftimes
,
flist
...
@@ -57,6 +66,9 @@ def get_file_containing_time(timestamp, files_path, file_time_span, amv_source='
...
@@ -57,6 +66,9 @@ def get_file_containing_time(timestamp, files_path, file_time_span, amv_source='
elif
amv_source
==
'
SSEC
'
:
elif
amv_source
==
'
SSEC
'
:
flist
=
glob
.
glob
(
files_path
+
'
*WINDS_AMV_EN-
'
+
band
+
'
*.nc
'
)
flist
=
glob
.
glob
(
files_path
+
'
*WINDS_AMV_EN-
'
+
band
+
'
*.nc
'
)
dto_func
=
get_datetime
dto_func
=
get_datetime
elif
amv_source
==
'
CARR
'
:
flist
=
glob
.
glob
(
files_path
+
'
tdw_qc_GOES*
'
+
'
ch_
'
+
band
+
'
.nc
'
)
dto_func
=
get_datetime_carr
for
pname
in
flist
:
# TODO: make better with regular expressions (someday)
for
pname
in
flist
:
# TODO: make better with regular expressions (someday)
dto
=
dto_func
(
pname
)
dto
=
dto_func
(
pname
)
...
@@ -219,6 +231,15 @@ def get_search_box(nav, lon, lat):
...
@@ -219,6 +231,15 @@ def get_search_box(nav, lon, lat):
return
c_rng
,
l_rng
return
c_rng
,
l_rng
amv_dir_name
=
'
Wind_Dir
'
amv_spd_name
=
'
Wind_Speed
'
amv_lon_name
=
'
Longitude
'
amv_lat_name
=
'
Latitude
'
amv_elem_name
=
'
Element
'
amv_line_name
=
'
Line
'
amv_press_name
=
'
MedianPress
'
# aeolus_dict: time -> profiles
# aeolus_dict: time -> profiles
# amv_files_path: directory containing AMVs, '/home/user/amvdir/'
# amv_files_path: directory containing AMVs, '/home/user/amvdir/'
# return dict: aeolus time -> tuple (amv_lon, amv_lat, amv_pres, amv_spd, amv_dir)
# return dict: aeolus time -> tuple (amv_lon, amv_lat, amv_pres, amv_spd, amv_dir)
...
@@ -250,13 +271,13 @@ def match_amvs_to_aelous(aeolus_dict, amv_files_path, amv_source='OPS', band='14
...
@@ -250,13 +271,13 @@ def match_amvs_to_aelous(aeolus_dict, amv_files_path, amv_source='OPS', band='14
if
f_idx
!=
last_f_idx
:
if
f_idx
!=
last_f_idx
:
last_f_idx
=
f_idx
last_f_idx
=
f_idx
ds
=
Dataset
(
fname
)
ds
=
Dataset
(
fname
)
amv_lons
=
ds
[
'
Longitude
'
][:]
amv_lons
=
ds
[
amv_lon_name
][:]
amv_lats
=
ds
[
'
Latitude
'
][:]
amv_lats
=
ds
[
amv_lat_name
][:]
amv_spd
=
ds
[
'
Wind_Speed
'
][:]
amv_spd
=
ds
[
amv_spd_name
][:]
amv_dir
=
ds
[
'
Wind_Dir
'
][:]
amv_dir
=
ds
[
amv_dir_name
][:]
amv_pres
=
ds
[
'
MedianPress
'
][:]
amv_pres
=
ds
[
amv_press_name
][:]
cc
=
ds
[
'
Element
'
][:]
cc
=
ds
[
amv_elem_name
][:]
ll
=
ds
[
'
Line
'
][:]
ll
=
ds
[
amv_line_name
][:]
# cc, ll = nav.earth_to_lc_s(amv_lons, amv_lats)
# cc, ll = nav.earth_to_lc_s(amv_lons, amv_lats)
ds
.
close
()
ds
.
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