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
Smith, Naomi
CTDAS
Commits
7a8de66c
Commit
7a8de66c
authored
Mar 15, 2016
by
Ingrid Luijkx
Browse files
Faster method to look up obs_nums, especially useful for GLOBALVIEWplus ObsPack hourly time series
parent
97b8c37c
Changes
1
Hide whitespace changes
Inline
Side-by-side
da/analysis/expand_molefractions.py
View file @
7a8de66c
...
...
@@ -41,10 +41,9 @@ def write_mole_fractions(dacycle):
"""
dirname
=
create_dirs
(
os
.
path
.
join
(
dacycle
[
'dir.analysis'
],
'data_molefractions'
))
#
# Some help variables
#
dectime0
=
date2num
(
datetime
(
2000
,
1
,
1
))
#
# Some help variables
#
dt
=
dacycle
[
'cyclelength'
]
startdate
=
dacycle
[
'time.start'
]
enddate
=
dacycle
[
'time.end'
]
...
...
@@ -78,7 +77,6 @@ def write_mole_fractions(dacycle):
for
ff
in
infiles1
:
infiles
.
append
(
ff
.
replace
(
d2
,
d1
))
#infiles = [join(s.compressed(),'') for s in infilename]
ncf_in
.
close
()
...
...
@@ -112,7 +110,6 @@ def write_mole_fractions(dacycle):
filesitecode
=
ncf_fc_in
.
get_variable
(
'sitecode'
)
fc_sitecodes
=
netCDF4
.
chartostring
(
filesitecode
).
tolist
()
#fc_sitecodes = [join(s.compressed(),'') for s in filesitecode]
ncf_fc_in
.
close
()
...
...
@@ -278,11 +275,8 @@ def write_mole_fractions(dacycle):
for
num
in
selected_obs_nums
:
model_index
=
obs_num
.
tolist
().
index
(
num
)
file_index
=
file_obs_nums
.
tolist
().
index
(
num
)
#var = ncf_out.variables['modeldatamismatch'] # Take from optimizer.yyyymmdd.nc file instead
#var[file_index] = mdm[model_index]
model_index
=
np
.
where
(
obs_num
==
num
)[
0
][
0
]
file_index
=
np
.
where
(
file_obs_nums
==
num
)[
0
][
0
]
var
=
ncf_out
.
variables
[
'modelsamplesmean'
]
var
[
file_index
]
=
simulated
[
model_index
,
0
]
...
...
@@ -301,8 +295,8 @@ def write_mole_fractions(dacycle):
for
num
in
selected_fc_obs_nums
:
model_index
=
fc_obs_num
.
tolist
().
index
(
num
)
file_index
=
file_obs_nums
.
tolist
().
index
(
num
)
model_index
=
np
.
where
(
fc_obs_num
==
num
)[
0
][
0
]
file_index
=
np
.
where
(
file_obs_nums
==
num
)[
0
][
0
]
var
=
ncf_out
.
variables
[
'modeldatamismatch'
]
var
[
file_index
]
=
np
.
sqrt
(
fc_r
[
model_index
])
...
...
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