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
5e7a0802
Commit
5e7a0802
authored
2 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snaphot...
parent
d9563b0a
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/amv/caliop_clavrx_amv.py
+27
-3
27 additions, 3 deletions
modules/amv/caliop_clavrx_amv.py
with
27 additions
and
3 deletions
modules/amv/caliop_clavrx_amv.py
+
27
−
3
View file @
5e7a0802
...
@@ -7,6 +7,7 @@ from netCDF4 import Dataset
...
@@ -7,6 +7,7 @@ from netCDF4 import Dataset
from
aeolus.datasource
import
get_datasource
,
CLAVRx_CALIPSO
,
get_parameters_caliop_clavrx
from
aeolus.datasource
import
get_datasource
,
CLAVRx_CALIPSO
,
get_parameters_caliop_clavrx
from
util.util
import
haversine_np
from
util.util
import
haversine_np
from
amv.intercompare
import
*
from
amv.intercompare
import
*
from
util.util
import
pressure_to_altitude
amv_file_duration
=
60
# minutes
amv_file_duration
=
60
# minutes
half_width
=
30
# search box centered on CALIOP profile (FGF coordinates)
half_width
=
30
# search box centered on CALIOP profile (FGF coordinates)
...
@@ -40,7 +41,7 @@ def get_search_box(cc, ll):
...
@@ -40,7 +41,7 @@ def get_search_box(cc, ll):
return
c_rng
,
l_rng
return
c_rng
,
l_rng
def
match_calipso_clavrx_to_amvs
(
calipso_clavrx_ds
,
calipso_clavrx_file
,
amv_files
,
calipso_clavrx_params
):
def
match_calipso_clavrx_to_amvs
(
calipso_clavrx_ds
,
calipso_clavrx_file
,
amv_files
,
calipso_clavrx_params
,
gfs_ds
):
nav
=
amv_files
.
get_navigation
()
nav
=
amv_files
.
get_navigation
()
amv_params
=
amv_files
.
get_parameters
()
amv_params
=
amv_files
.
get_parameters
()
all_params
=
[
amv_files
.
lon_name
,
amv_files
.
lat_name
,
amv_files
.
elem_name
,
amv_files
.
line_name
]
+
amv_params
all_params
=
[
amv_files
.
lon_name
,
amv_files
.
lat_name
,
amv_files
.
elem_name
,
amv_files
.
line_name
]
+
amv_params
...
@@ -55,6 +56,14 @@ def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_fil
...
@@ -55,6 +56,14 @@ def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_fil
if
f_idx
is
None
:
if
f_idx
is
None
:
return
None
return
None
gfs_fname
,
_
,
_
=
gfs_ds
.
get_file
(
nom_time
)
if
gfs_fname
is
None
:
return
None
gfs_xr
=
xr
.
open_dataset
(
gfs_fname
)
gfs_press
=
gfs_xr
[
'
pressure levels
'
]
gfs_press
=
gfs_press
.
values
gfs_press
=
gfs_press
[::
-
1
]
match_dict
[
nom_time
]
=
[]
match_dict
[
nom_time
]
=
[]
amvs_nd
=
get_amv_nd
(
amv_fname
,
delimiter
=
'
,
'
)
amvs_nd
=
get_amv_nd
(
amv_fname
,
delimiter
=
'
,
'
)
...
@@ -116,6 +125,19 @@ def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_fil
...
@@ -116,6 +125,19 @@ def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_fil
match_dict
[
nom_time
].
append
((
cc
,
ll
,
lon
,
lat
,
f_idx
,
data_da
,
amvs_da
,
dist_to_amvs
))
match_dict
[
nom_time
].
append
((
cc
,
ll
,
lon
,
lat
,
f_idx
,
data_da
,
amvs_da
,
dist_to_amvs
))
lons
=
amv_lons
[
in_box
]
lats
=
amv_lats
[
in_box
]
lons
=
lons
[
s_idxs
]
lats
=
lats
[
s_idxs
]
temp_prof
=
get_vert_profile_s
(
gfs_ds
,
[
'
temperature
'
],
lons
,
lats
,
method
=
'
nearest
'
)
temp_prof
=
temp_prof
.
values
temp_prof_s
=
temp_prof
[
0
,
:,
:]
temp_prof_s
=
temp_prof_s
[:,
::
-
1
]
for
k
in
range
(
num_amvs
):
alt
=
pressure_to_altitude
(
param_s
[
4
,
k
],
None
,
gfs_press
,
temp_prof_s
[
k
,
:])
print
(
alt
)
return
match_dict
return
match_dict
...
@@ -282,7 +304,7 @@ def create_file(match_dct, output_path, target_filepath, caliop_clavrx_params, a
...
@@ -282,7 +304,7 @@ def create_file(match_dct, output_path, target_filepath, caliop_clavrx_params, a
rootgrp
.
close
()
rootgrp
.
close
()
def
run_caliop_clavrx_amv_match
(
output_path
,
path_to_caliop_clavrx
,
path_to_amvs
,
amv_source
=
'
OPS
'
,
band
=
'
14
'
):
def
run_caliop_clavrx_amv_match
(
output_path
,
path_to_caliop_clavrx
,
path_to_amvs
,
path_to_gfs
,
amv_source
=
'
OPS
'
,
band
=
'
14
'
):
caliop_clavrx_params
=
get_parameters_caliop_clavrx
(
filename
=
caliop_clvrx_exmpl_file
)
caliop_clavrx_params
=
get_parameters_caliop_clavrx
(
filename
=
caliop_clvrx_exmpl_file
)
caliop_clavrx_ds
=
CLAVRx_CALIPSO
(
path_to_caliop_clavrx
)
caliop_clavrx_ds
=
CLAVRx_CALIPSO
(
path_to_caliop_clavrx
)
...
@@ -291,8 +313,10 @@ def run_caliop_clavrx_amv_match(output_path, path_to_caliop_clavrx, path_to_amvs
...
@@ -291,8 +313,10 @@ def run_caliop_clavrx_amv_match(output_path, path_to_caliop_clavrx, path_to_amvs
amv_params
=
amv_ds
.
get_parameters
()
amv_params
=
amv_ds
.
get_parameters
()
amv_filenames
=
amv_ds
.
flist
amv_filenames
=
amv_ds
.
flist
gfs_ds
=
get_datasource
(
path_to_gfs
,
'
GFS
'
)
for
file
in
caliop_clavrx_ds
.
flist
:
for
file
in
caliop_clavrx_ds
.
flist
:
match_dict
=
match_calipso_clavrx_to_amvs
(
caliop_clavrx_ds
,
file
,
amv_ds
,
caliop_clavrx_params
)
match_dict
=
match_calipso_clavrx_to_amvs
(
caliop_clavrx_ds
,
file
,
amv_ds
,
caliop_clavrx_params
,
gfs_ds
)
if
match_dict
is
None
:
if
match_dict
is
None
:
continue
continue
...
...
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