Commit 7a8de66c authored by Ingrid Luijkx's avatar Ingrid Luijkx
Browse files

Faster method to look up obs_nums, especially useful for GLOBALVIEWplus ObsPack hourly time series

parent 97b8c37c
......@@ -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])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment