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
4e1ed229
Commit
4e1ed229
authored
4 years ago
by
rink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot..
parent
fb09475d
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
+92
-0
92 additions, 0 deletions
modules/aeolus/aeolus_amv.py
with
92 additions
and
0 deletions
modules/aeolus/aeolus_amv.py
+
92
−
0
View file @
4e1ed229
...
...
@@ -24,6 +24,96 @@ class MyGenericException(Exception):
self
.
message
=
message
class
AMVFiles
:
def
__init__
(
self
,
files_path
,
file_time_span
,
pattern
,
band
=
'
14
'
):
self
.
flist
=
glob
.
glob
(
files_path
+
pattern
)
self
.
band
=
band
self
.
ftimes
=
[]
for
pname
in
flist
:
# TODO: make better with regular expressions (someday)
dto
=
self
.
get_datetime
(
pname
)
dto_start
=
dto
dto_end
=
dto
+
datetime
.
timedelta
(
minutes
=
file_time_span
)
ftimes
.
append
((
dto_start
.
timestamp
(),
dto_end
.
timestamp
()))
def
get_datetime
(
self
):
pass
def
get_navigation
(
self
):
pass
def
get_file_containing_time
(
self
,
timestamp
):
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
def
get_parameters
(
self
):
pass
class
Framework
(
AMVFiles
):
def
__init__
(
self
,
files_path
,
file_time_span
,
band
=
'
14
'
):
super
().
__init__
(
self
,
files_path
,
file_time_span
,
'
*WINDS_AMV_EN-
'
+
band
+
'
*.nc
'
,
band
)
def
get_navigation
(
self
):
GEOSNavigation
(
sub_lon
=-
75.0
)
def
get_datetime
(
self
,
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
class
OPS
(
AMVFiles
):
def
__init__
(
self
,
files_path
,
file_time_span
,
band
=
'
14
'
):
super
().
__init__
(
self
,
files_path
,
file_time_span
,
'
OR_ABI-L2-DMWF*
'
+
'
C
'
+
band
+
'
*.nc
'
,
band
)
def
get_navigation
(
self
):
return
GEOSNavigation
(
sub_lon
=-
75.0
)
def
get_datetime
(
self
,
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
class
CarrStereo
(
AMVFiles
):
def
__init__
(
self
,
files_path
,
file_time_span
,
band
=
'
14
'
):
super
().
__init__
(
self
,
files_path
,
file_time_span
,
'
*WINDS_AMV_EN-
'
+
band
+
'
*.nc
'
,
band
)
def
get_navigation
(
self
):
return
GEOSNavigation
(
sub_lon
=-
137.0
)
def
get_datetime
(
self
,
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_parameters
(
self
):
params
=
[
'
Lat
'
,
'
Lon
'
,
'
Element
'
,
'
Line
'
,
'
V_3D
'
,
'
H_3D
'
,
'
pres
'
,
'
Fcst_Spd
'
,
'
Fcst_Dir
'
,
'
SatZen
'
,
'
InversionFlag
'
,
'
CloudPhase
'
,
'
CloudType
'
]
return
params
def
get_datetime
(
pathname
):
fname
=
os
.
path
.
split
(
pathname
)[
1
]
toks
=
fname
.
split
(
'
_
'
)
...
...
@@ -276,6 +366,8 @@ amv_press_name = 'MedianPress'
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
...
...
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