Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VERIFY
CIF
Commits
16da8766
Commit
16da8766
authored
Jul 07, 2020
by
Espen Sollum
Browse files
Adding a quick fix for str accidentally converted to type byte, until I find out why this happens
parent
f468bc79
Changes
2
Hide whitespace changes
Inline
Side-by-side
pycif/plugins/obsoperators/fp/obsoper.py
View file @
16da8766
...
...
@@ -80,15 +80,25 @@ def obsoper(self, inputs, mode,
subdir
=
subsimu_dates
[
0
].
strftime
(
"%Y%m"
)
fp_header_glob
=
model
.
utils
.
flexpart_header
.
Flexpartheader
()
fp_header_glob
.
read_header
(
os
.
path
.
join
(
model
.
run_dir_glob
,
obsvect
.
datastore
.
head
(
1
)[
'station'
][
0
].
decode
().
upper
(),
subdir
,
'header'
))
try
:
fp_header_glob
.
read_header
(
os
.
path
.
join
(
model
.
run_dir_glob
,
obsvect
.
datastore
.
head
(
1
)[
'station'
][
0
].
decode
().
upper
(),
subdir
,
'header'
))
except
AttributeError
as
e
:
fp_header_glob
.
read_header
(
os
.
path
.
join
(
model
.
run_dir_glob
,
obsvect
.
datastore
.
head
(
1
)[
'station'
][
0
].
upper
(),
subdir
,
'header'
))
if
model
.
plugin
.
nested
:
fp_header_nest
=
model
.
utils
.
flexpart_header
.
Flexpartheader
()
fp_header_nest
.
read_header
(
os
.
path
.
join
(
model
.
run_dir_nest
,
obsvect
.
datastore
.
head
(
1
)[
'station'
][
0
].
decode
().
upper
(),
subdir
,
'header_nest'
))
try
:
fp_header_nest
=
model
.
utils
.
flexpart_header
.
Flexpartheader
()
fp_header_nest
.
read_header
(
os
.
path
.
join
(
model
.
run_dir_nest
,
obsvect
.
datastore
.
head
(
1
)[
'station'
][
0
].
decode
().
upper
(),
subdir
,
'header_nest'
))
except
AttributeError
as
e
:
fp_header_nest
.
read_header
(
os
.
path
.
join
(
model
.
run_dir_nest
,
obsvect
.
datastore
.
head
(
1
)[
'station'
][
0
].
upper
(),
subdir
,
'header_nest'
))
# Trajectory life time
trajdays
=
fp_header_glob
.
trajdays
...
...
@@ -148,11 +158,17 @@ def obsoper(self, inputs, mode,
obs_check
[
obs_i
]
=
obs_i
station
=
row
.
station
runsubdir_nest
=
os
.
path
.
join
(
model
.
run_dir_nest
,
station
.
decode
().
upper
(),
subdir
)
runsubdir_glob
=
os
.
path
.
join
(
model
.
run_dir_glob
,
station
.
decode
().
upper
(),
subdir
)
try
:
runsubdir_nest
=
os
.
path
.
join
(
model
.
run_dir_nest
,
station
.
decode
().
upper
(),
subdir
)
runsubdir_glob
=
os
.
path
.
join
(
model
.
run_dir_glob
,
station
.
decode
().
upper
(),
subdir
)
except
AttributeError
as
e
:
runsubdir_nest
=
os
.
path
.
join
(
model
.
run_dir_nest
,
station
.
upper
(),
subdir
)
runsubdir_glob
=
os
.
path
.
join
(
model
.
run_dir_glob
,
station
.
upper
(),
subdir
)
file_date
=
row
.
Index
.
strftime
(
'%Y%m%d%H%M%S'
)
...
...
pycif/plugins/obsvects/standard/init_background.py
View file @
16da8766
...
...
@@ -74,8 +74,10 @@ def init_background(obsvect, **kwargs):
# Subdirectory for FLEXPART grid_initial files
subdir
=
row
.
Index
.
strftime
(
"%Y%m"
)
# station = row.station
station
=
row
.
station
.
decode
()
station
=
row
.
station
# Sometimes datastores read from netcdf convert type str to type bytes
if
isinstance
(
station
,
bytes
):
station
=
station
.
decode
()
runsubdir_glob
=
os
.
path
.
join
(
model
.
run_dir_glob
,
station
.
upper
(),
subdir
)
file_date
=
row
.
Index
.
strftime
(
'%Y%m%d%H%M%S'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment