Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
AMBS
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
Container registry
Model registry
Operate
Environments
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
esde
machine-learning
AMBS
Commits
74162cfb
Commit
74162cfb
authored
5 years ago
by
Michael Langguth
Browse files
Options
Downloads
Patches
Plain Diff
Some rename for Python's naming convention.
parent
e1c7dfc4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
video_prediction/datasets/era5_dataset_v2.py
+8
-7
8 additions, 7 deletions
video_prediction/datasets/era5_dataset_v2.py
with
8 additions
and
7 deletions
video_prediction/datasets/era5_dataset_v2.py
+
8
−
7
View file @
74162cfb
...
...
@@ -14,8 +14,9 @@ from video_prediction.datasets.base_dataset import VarLenFeatureVideoDataset
from
os
import
path
import
sys
sys
.
path
.
append
(
path
.
abspath
(
'
../../workflow_parallel_frame_prediction/
'
))
import
DataPreprocess.process_netCDF_v2
from
DataPreprocess.process_netCDF_v2
import
get_unique_vars
from
DataPreprocess.process_netCDF_v2
import
c
alc_data_stat
.
get_stat_vars
from
DataPreprocess.process_netCDF_v2
import
C
alc_data_stat
#from base_dataset import VarLenFeatureVideoDataset
from
collections
import
OrderedDict
from
tensorflow.contrib.training
import
HParams
...
...
@@ -161,7 +162,7 @@ def save_tf_record(output_fname, sequences):
example
=
tf
.
train
.
Example
(
features
=
features
)
writer
.
write
(
example
.
SerializeToString
())
class
n
orm_data
:
class
N
orm_data
:
"""
Class for normalizing data. The statistical data for normalization (minimum, maximum, average, standard deviation etc.) is expected to be available from a statistics-dictionary
created with the calc_data_stat-class (see
'
process_netCDF_v2.py
'
.
...
...
@@ -205,7 +206,7 @@ class norm_data:
for
varname
in
self
.
varnames
:
for
stat_name
in
self
.
known_norms
[
norm
]:
#setattr(self,varname+stat_name,stat_dict[varname][0][stat_name])
setattr
(
self
,
varname
+
stat_name
,
get_stat_vars
(
stat_dict
,
stat_name
,
varname
))
setattr
(
self
,
varname
+
stat_name
,
Calc_data_stat
.
get_stat_vars
(
stat_dict
,
stat_name
,
varname
))
self
.
status_ok
=
True
# set status for normalization -> ready
...
...
@@ -215,7 +216,7 @@ class norm_data:
"""
# some sanity checks
if
not
self
.
status_ok
:
raise
ValueError
(
"
n
orm_data-
object
needs to be initialized and checked first.
"
)
# status ready?
if
not
self
.
status_ok
:
raise
ValueError
(
"
N
orm_data-
instance
needs to be initialized and checked first.
"
)
# status ready?
if
not
norm
in
self
.
known_norms
.
keys
():
# valid normalization requested?
print
(
"
Please select one of the following known normalizations:
"
)
...
...
@@ -235,7 +236,7 @@ class norm_data:
"""
# some sanity checks
if
not
self
.
status_ok
:
raise
ValueError
(
"
n
orm_data-
object
needs to be initialized and checked first.
"
)
# status ready?
if
not
self
.
status_ok
:
raise
ValueError
(
"
N
orm_data-
instance
needs to be initialized and checked first.
"
)
# status ready?
if
not
norm
in
self
.
known_norms
.
keys
():
# valid normalization requested?
print
(
"
Please select one of the following known normalizations:
"
)
...
...
@@ -264,7 +265,7 @@ def read_frames_and_save_tf_records(output_dir,input_dir,partition_name,vars_in,
output_dir
=
os
.
path
.
join
(
output_dir
,
partition_name
)
os
.
makedirs
(
output_dir
,
exist_ok
=
True
)
norm_cls
=
n
orm_data
(
vars_in
)
# init normalization-instance
norm_cls
=
N
orm_data
(
vars_in
)
# init normalization-instance
nvars
=
len
(
vars_in
)
# open statistics file and feed it to norm-instance
...
...
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