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
15724004
Commit
15724004
authored
3 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
50967ca6
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
+11
-5
11 additions, 5 deletions
modules/amv/caliop_clavrx_amv.py
with
11 additions
and
5 deletions
modules/amv/caliop_clavrx_amv.py
+
11
−
5
View file @
15724004
import
os
import
numpy
as
np
import
numpy
as
np
import
xarray
as
xr
import
xarray
as
xr
from
netCDF4
import
Dataset
from
netCDF4
import
Dataset
...
@@ -106,10 +107,9 @@ def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_fil
...
@@ -106,10 +107,9 @@ def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_fil
return
match_dict
return
match_dict
def
create_file
(
match_dct
,
filename
,
caliop_clavrx_params
,
amv_params
,
amv_filenames
):
def
create_file
(
match_dct
,
output_path
,
target_filepath
,
caliop_clavrx_params
,
amv_params
,
amv_filenames
):
num_aprofs
=
0
num_aprofs
=
0
max_num_amvs
=
0
max_num_amvs
=
0
alons
=
[]
alons
=
[]
alats
=
[]
alats
=
[]
atimes
=
[]
atimes
=
[]
...
@@ -118,6 +118,12 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params, amv_filen
...
@@ -118,6 +118,12 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params, amv_filen
fidxs
=
[]
fidxs
=
[]
amvs_cnt
=
[]
amvs_cnt
=
[]
filename
=
os
.
path
.
split
(
target_filepath
)[
1
]
w_o_ext
,
ext
=
os
.
path
.
splitext
(
filename
)
filename
=
w_o_ext
+
'
.amvs
'
+
ext
output_filepath
=
output_path
+
filename
amv_file_s
=
np
.
array
(
amv_filenames
,
dtype
=
'
object
'
)
amv_file_s
=
np
.
array
(
amv_filenames
,
dtype
=
'
object
'
)
# scan to get max num levels, amvs
# scan to get max num levels, amvs
...
@@ -154,7 +160,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params, amv_filen
...
@@ -154,7 +160,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params, amv_filen
caliop_clavrx_exmpl
=
Dataset
(
'
/data/Personal/rink/clavrx_calipso/g16_s20201050200_06kmCLay.matchup.calipso.h5
'
,
'
r
'
)
caliop_clavrx_exmpl
=
Dataset
(
'
/data/Personal/rink/clavrx_calipso/g16_s20201050200_06kmCLay.matchup.calipso.h5
'
,
'
r
'
)
# the top level group for the output file
# the top level group for the output file
rootgrp
=
Dataset
(
filename
,
'
w
'
,
format
=
'
NETCDF4
'
)
rootgrp
=
Dataset
(
output_filepath
,
'
w
'
,
format
=
'
NETCDF4
'
)
dim_amvs
=
rootgrp
.
createDimension
(
'
max_num_amvs
'
,
size
=
max_num_amvs
)
dim_amvs
=
rootgrp
.
createDimension
(
'
max_num_amvs
'
,
size
=
max_num_amvs
)
dim_num_aeolus_prof
=
rootgrp
.
createDimension
(
'
num_caliop_profs
'
,
size
=
num_aprofs
)
dim_num_aeolus_prof
=
rootgrp
.
createDimension
(
'
num_caliop_profs
'
,
size
=
num_aprofs
)
...
@@ -262,7 +268,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params, amv_filen
...
@@ -262,7 +268,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params, amv_filen
rootgrp
.
close
()
rootgrp
.
close
()
def
run_caliop_clavrx_amv_match
(
output_
file
,
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
,
amv_source
=
'
OPS
'
,
band
=
'
14
'
):
caliop_clavrx_params
=
get_parameters_caliop_clavrx
()
caliop_clavrx_params
=
get_parameters_caliop_clavrx
()
caliop_clavrx_ds
=
CLAVRx_CALIPSO
(
path_to_caliop_clavrx
)
caliop_clavrx_ds
=
CLAVRx_CALIPSO
(
path_to_caliop_clavrx
)
...
@@ -274,5 +280,5 @@ def run_caliop_clavrx_amv_match(output_file, path_to_caliop_clavrx, path_to_amvs
...
@@ -274,5 +280,5 @@ def run_caliop_clavrx_amv_match(output_file, path_to_caliop_clavrx, path_to_amvs
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
,
amv_source
=
amv_source
,
band
=
band
)
match_dict
=
match_calipso_clavrx_to_amvs
(
caliop_clavrx_ds
,
file
,
amv_ds
,
amv_source
=
amv_source
,
band
=
band
)
create_file
(
match_dict
,
output_file
,
caliop_clavrx_params
,
amv_params
,
amv_filenames
)
create_file
(
match_dict
,
output_
path
,
file
,
caliop_clavrx_params
,
amv_params
,
amv_filenames
)
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