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
27308d25
Commit
27308d25
authored
4 years ago
by
rink
Browse files
Options
Downloads
Patches
Plain Diff
remove dead code
parent
bc302211
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
+1
-90
1 addition, 90 deletions
modules/aeolus/aeolus_amv.py
with
1 addition
and
90 deletions
modules/aeolus/aeolus_amv.py
+
1
−
90
View file @
27308d25
...
@@ -14,11 +14,6 @@ num_elems = 5424
...
@@ -14,11 +14,6 @@ num_elems = 5424
num_lines
=
5424
num_lines
=
5424
first_time
=
True
ftimes
=
[]
flist
=
None
class
MyGenericException
(
Exception
):
class
MyGenericException
(
Exception
):
def
__init__
(
self
,
message
):
def
__init__
(
self
,
message
):
self
.
message
=
message
self
.
message
=
message
...
@@ -141,70 +136,6 @@ class CarrStereo(AMVFiles):
...
@@ -141,70 +136,6 @@ class CarrStereo(AMVFiles):
return
self
.
meta_dict
return
self
.
meta_dict
def
get_datetime
(
pathname
):
fname
=
os
.
path
.
split
(
pathname
)[
1
]
toks
=
fname
.
split
(
'
_
'
)
dstr
=
toks
[
4
]
tstr
=
toks
[
5
]
dtstr
=
dstr
+
tstr
dto
=
datetime
.
datetime
.
strptime
(
dtstr
,
'
%Y%j%H%M
'
).
replace
(
tzinfo
=
timezone
.
utc
)
return
dto
def
get_datetime_ops
(
pathname
):
fname
=
os
.
path
.
split
(
pathname
)[
1
]
toks
=
fname
.
split
(
'
_
'
)
dtstr
=
toks
[
3
]
dtstr
=
dtstr
[:
-
3
]
dto
=
datetime
.
datetime
.
strptime
(
dtstr
,
'
s%Y%j%H%M
'
).
replace
(
tzinfo
=
timezone
.
utc
)
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.ch
'
).
replace
(
tzinfo
=
timezone
.
utc
)
return
dto
def
get_file_containing_time
(
timestamp
,
files_path
,
file_time_span
,
amv_source
=
'
OPS
'
,
band
=
'
14
'
):
global
first_time
,
ftimes
,
flist
if
first_time
is
True
:
if
amv_source
==
'
OPS
'
:
flist
=
glob
.
glob
(
files_path
+
'
OR_ABI-L2-DMWF*
'
+
'
C
'
+
band
+
'
*.nc
'
)
dto_func
=
get_datetime_ops
elif
amv_source
==
'
SSEC
'
:
flist
=
glob
.
glob
(
files_path
+
'
*WINDS_AMV_EN-
'
+
band
+
'
*.nc
'
)
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)
dto
=
dto_func
(
pname
)
dto_start
=
dto
dto_end
=
dto
+
datetime
.
timedelta
(
minutes
=
file_time_span
)
ftimes
.
append
((
dto_start
.
timestamp
(),
dto_end
.
timestamp
()))
first_time
=
False
k
=
-
1
for
i
in
range
(
len
(
ftimes
)):
if
(
timestamp
>=
ftimes
[
i
][
0
])
and
(
timestamp
<
ftimes
[
i
][
1
]):
k
=
i
break
if
k
<
0
:
return
None
,
None
,
None
return
flist
[
k
],
ftimes
[
k
],
k
# imports the S4 NOAA output
# imports the S4 NOAA output
# filename: full path as a string, '/home/user/filename'
# filename: full path as a string, '/home/user/filename'
# returns a dict: time -> list of profiles (a profile is a list of levels)
# returns a dict: time -> list of profiles (a profile is a list of levels)
...
@@ -380,26 +311,6 @@ def get_search_box(nav, lon, lat):
...
@@ -380,26 +311,6 @@ def get_search_box(nav, lon, lat):
return
c_rng
,
l_rng
return
c_rng
,
l_rng
# Framework
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
'
# -------------------------------
# Carr stereo
amv_lon_name
=
'
Lon
'
amv_lat_name
=
'
Lat
'
amv_press_name
=
'
pres
'
amv_h3d_name
=
'
H_3D
'
amv_alt_name
=
'
Altitude
'
# -------------------------------
sub_lon
=
-
137.0
# GOES-17
# sub_lon = -75.0 # GOES-16
# 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)
...
@@ -592,7 +503,7 @@ def create_amv_to_aeolus_match_file(aeolus_files_dir, amv_files_dir, outfile=Non
...
@@ -592,7 +503,7 @@ def create_amv_to_aeolus_match_file(aeolus_files_dir, amv_files_dir, outfile=Non
# match_file: pathname for the product file
# match_file: pathname for the product file
# 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)
# amv_var_names: list of amv parameters (see match_file) to subset
# amv_var_names: list of amv parameters (see match_file
ncdump
) to subset
# returns: Xarray.DataArray
# returns: Xarray.DataArray
# amvs[nprofs, max_num_amvs_per_prof, num_of_params], profs[nprofs, max_num_levs_per_prof, num_of_params],
# amvs[nprofs, max_num_amvs_per_prof, num_of_params], profs[nprofs, max_num_levs_per_prof, num_of_params],
# prof_locs[nprofs, (lon, lat)
# prof_locs[nprofs, (lon, lat)
...
...
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