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
4210fa08
Commit
4210fa08
authored
2 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
20dfaa05
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/amv/caliop_clavrx_amv.py
+9
-7
9 additions, 7 deletions
modules/amv/caliop_clavrx_amv.py
with
9 additions
and
7 deletions
modules/amv/caliop_clavrx_amv.py
+
9
−
7
View file @
4210fa08
...
...
@@ -124,14 +124,14 @@ def match_calipso_clavrx_to_amvs(nom_time, calipso_clavrx_nc4, amv_files, calips
lons
=
param_nd
[
0
,
:]
lats
=
param_nd
[
1
,
:]
temp_prof
=
get_vert_profile_s
(
gfs_xr
,
[
'
temperature
'
],
lons
,
lats
,
method
=
'
near
est
'
)
temp_prof
=
get_vert_profile_s
(
gfs_xr
,
[
'
temperature
'
],
lons
,
lats
,
method
=
'
li
near
'
)
temp_prof
=
temp_prof
.
values
temp_prof_s
=
temp_prof
[
0
,
:,
:]
alt_s
=
[]
for
k
in
range
(
num_amvs
):
alt
=
pressure_to_altitude
(
param_nd
[
4
,
k
],
None
,
gfs_press
,
temp_prof_s
[
k
,
:])
alt_s
.
append
(
alt
.
magnitude
)
alt_s
.
append
(
alt
)
alt_s
=
np
.
array
(
alt_s
)
match_dict
[
nom_time
].
append
((
cc
,
ll
,
lon
,
lat
,
f_idx
,
data_da
,
amvs_da
,
dist_to_amvs
,
alt_s
))
...
...
@@ -236,6 +236,8 @@ def create_file(match_dct, output_path, target_filepath, caliop_clavrx_params, a
amv_fidx
=
rootgrp
.
createVariable
(
'
amv_file_index
'
,
'
i4
'
,
[
'
num_caliop_profs
'
])
dst_to_amvs
=
rootgrp
.
createVariable
(
'
distance_to_amvs
'
,
'
f4
'
,
[
'
num_caliop_profs
'
,
'
max_num_amvs
'
])
amv_geom_hgt
=
rootgrp
.
createVariable
(
'
amv_geom_hgt
'
,
'
f4
'
,
[
'
num_caliop_profs
'
,
'
max_num_amvs
'
])
amv_geom_hgt
.
units
=
'
meter
'
amv_geom_hgt
.
long_name
=
'
AMV pressure converted to height from GFS temperature vs pressure
'
nc4_vars
=
[]
var_s
=
rg_exmpl
.
variables
...
...
@@ -357,7 +359,7 @@ new_header = ' TARG LAT LON BOX SRCH SPD DIR PW LL
num_fmts
=
[
'
%6i
'
,
'
%7.2f
'
,
'
%8.2f
'
,
'
%4i
'
,
'
%4i
'
,
'
%7.2f
'
,
'
%7.2f
'
,
'
%8.2f
'
,
'
%4i
'
,
'
%7.2f
'
,
'
%7.2f
'
,
'
%8.2f
'
,
'
%7.2f
'
,
'
%4i
'
,
'
%7.2f
'
,
'
%4i
'
,
'
%4i
'
,
'
%6i
'
,
'
%6i
'
,
'
%9.2f
'
]
def
get_temp_prof_s
(
gfs_ds
,
nom_time
,
amv_
lons
,
amv_
lats
):
def
get_temp_prof_s
(
gfs_ds
,
nom_time
,
lons
,
lats
):
gfs_fname
,
_
,
_
=
gfs_ds
.
get_file
(
nom_time
,
window
=
180.0
)
if
gfs_fname
is
None
:
return
None
...
...
@@ -365,21 +367,21 @@ def get_temp_prof_s(gfs_ds, nom_time, amv_lons, amv_lats):
gfs_press
=
gfs_xr
[
'
pressure levels
'
]
gfs_press
=
gfs_press
.
values
temp_prof
=
get_vert_profile_s
(
gfs_xr
,
[
'
temperature
'
],
amv_
lons
,
amv_
lats
,
method
=
'
linear
'
)
temp_prof
=
get_vert_profile_s
(
gfs_xr
,
[
'
temperature
'
],
lons
,
lats
,
method
=
'
linear
'
)
temp_prof
=
temp_prof
.
values
temp_prof_s
=
temp_prof
[
0
,
:,
:]
return
temp_prof_s
,
gfs_press
def
get_temp_prof_s_intrp
(
nom_time
,
amv_
lons
,
amv_
lats
):
def
get_temp_prof_s_intrp
(
nom_time
,
lons
,
lats
):
gfs_fname_left
,
nom_time_left
,
gfs_fname_rght
,
nom_time_rght
=
get_bounding_gfs_files
(
nom_time
)
gfs_xr_left
=
xr
.
open_dataset
(
gfs_fname_left
)
gfs_xr_rght
=
xr
.
open_dataset
(
gfs_fname_rght
)
gfs_press
=
gfs_xr_left
[
'
pressure levels
'
].
values
temp_prof
=
get_time_interpolated_vert_profile
([
gfs_xr_left
,
gfs_xr_rght
],
[
nom_time_left
,
nom_time_rght
],
'
temperature
'
,
nom_time
,
amv_
lons
,
amv_
lats
)
pt_s
=
get_time_interpolated_point_s
([
gfs_xr_left
,
gfs_xr_rght
],
[
nom_time_left
,
nom_time_rght
],
[
'
surface pressure
'
,
'
surface temperature
'
,
'
surface height
'
],
nom_time
,
amv_
lons
,
amv_
lats
)
temp_prof
=
get_time_interpolated_vert_profile
([
gfs_xr_left
,
gfs_xr_rght
],
[
nom_time_left
,
nom_time_rght
],
'
temperature
'
,
nom_time
,
lons
,
lats
)
pt_s
=
get_time_interpolated_point_s
([
gfs_xr_left
,
gfs_xr_rght
],
[
nom_time_left
,
nom_time_rght
],
[
'
surface pressure
'
,
'
surface temperature
'
,
'
surface height
'
],
nom_time
,
lons
,
lats
)
return
temp_prof
,
gfs_press
,
pt_s
[
0
,],
pt_s
[
1
,],
pt_s
[
2
,]
...
...
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