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
6867c760
Commit
6867c760
authored
2 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
350b99ac
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/util/util.py
+13
-0
13 additions, 0 deletions
modules/util/util.py
with
13 additions
and
0 deletions
modules/util/util.py
+
13
−
0
View file @
6867c760
...
@@ -12,6 +12,7 @@ import pickle
...
@@ -12,6 +12,7 @@ import pickle
from
netCDF4
import
Dataset
from
netCDF4
import
Dataset
from
util.setup
import
ancillary_path
from
util.setup
import
ancillary_path
from
scipy.interpolate
import
RectBivariateSpline
,
interp2d
from
scipy.interpolate
import
RectBivariateSpline
,
interp2d
from
scipy.ndimage
import
gaussian_filter
LatLonTuple
=
namedtuple
(
'
LatLonTuple
'
,
[
'
lat
'
,
'
lon
'
])
LatLonTuple
=
namedtuple
(
'
LatLonTuple
'
,
[
'
lat
'
,
'
lon
'
])
...
@@ -1426,6 +1427,18 @@ def resample_2d_linear_one(x, y, z, x_new, y_new):
...
@@ -1426,6 +1427,18 @@ def resample_2d_linear_one(x, y, z, x_new, y_new):
return
f
(
x_new
,
y_new
)
return
f
(
x_new
,
y_new
)
# Gaussian filter suitable for model training Data Pipeline
# z: input array. Must have dimensions: [BATCH_SIZE, Y, X]
# sigma: Standard deviation for Gaussian kernel
# returns stacked 2d arrays of same input dimension
def
smooth_2d
(
z
,
sigma
=
1.0
):
z_smoothed
=
[]
for
j
in
range
(
z
.
shape
[
0
]):
z_j
=
z
[
j
,
:,
:]
z_smoothed
.
append
(
gaussian_filter
(
z_j
,
sigma
=
sigma
))
return
np
.
stack
(
z_smoothed
)
def
get_training_parameters
(
day_night
=
'
DAY
'
,
l1b_andor_l2
=
'
both
'
,
satellite
=
'
GOES16
'
,
use_dnb
=
False
):
def
get_training_parameters
(
day_night
=
'
DAY
'
,
l1b_andor_l2
=
'
both
'
,
satellite
=
'
GOES16
'
,
use_dnb
=
False
):
if
day_night
==
'
DAY
'
:
if
day_night
==
'
DAY
'
:
train_params_l2
=
[
'
cld_height_acha
'
,
'
cld_geo_thick
'
,
'
cld_temp_acha
'
,
'
cld_press_acha
'
,
'
supercooled_cloud_fraction
'
,
train_params_l2
=
[
'
cld_height_acha
'
,
'
cld_geo_thick
'
,
'
cld_temp_acha
'
,
'
cld_press_acha
'
,
'
supercooled_cloud_fraction
'
,
...
...
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