Commit 3553f01b authored by Jean Matthieu Haussaire's avatar Jean Matthieu Haussaire
Browse files

Allow for the computation of cini_pos

parent 25dfc48e
...@@ -72,7 +72,8 @@ def read_conc(self, model, dir_initconc, file_initconc, **kwargs): ...@@ -72,7 +72,8 @@ def read_conc(self, model, dir_initconc, file_initconc, **kwargs):
xmod_hor = xmod[:, :, :].interp(coords={'lon' : model.domain.lonc_glob, xmod_hor = xmod[:, :, :].interp(coords={'lon' : model.domain.lonc_glob,
'lat' : model.domain.latc_glob}, 'lat' : model.domain.latc_glob},
method='linear', method='linear',
kwargs={'fill_value' : None}) kwargs={'fill_value' : "extrapolate"})
# Interpolate to model grid (vertically) # Interpolate to model grid (vertically)
# Use nearest neighbor below or above height of available data # Use nearest neighbor below or above height of available data
...@@ -82,7 +83,7 @@ def read_conc(self, model, dir_initconc, file_initconc, **kwargs): ...@@ -82,7 +83,7 @@ def read_conc(self, model, dir_initconc, file_initconc, **kwargs):
xmod_ver = xmod_hor.interp(coords={'height' : height_temp}, xmod_ver = xmod_hor.interp(coords={'height' : height_temp},
method='linear', method='linear',
kwargs={'fill_value' : None}) kwargs={'fill_value' : "extrapolate"})
xmod_ver['height'] = np.array(model.domain.heights) xmod_ver['height'] = np.array(model.domain.heights)
......
...@@ -39,7 +39,6 @@ def init_background(obsvect, **kwargs): ...@@ -39,7 +39,6 @@ def init_background(obsvect, **kwargs):
conc_ini = background.read_conc(model, background.dir_initconc, conc_ini = background.read_conc(model, background.dir_initconc,
background.file_initconc, **kwargs) background.file_initconc, **kwargs)
n_x = model.domain.nlon_glob n_x = model.domain.nlon_glob
n_y = model.domain.nlat_glob n_y = model.domain.nlat_glob
n_z = len(model.domain.heights) n_z = len(model.domain.heights)
...@@ -49,23 +48,29 @@ def init_background(obsvect, **kwargs): ...@@ -49,23 +48,29 @@ def init_background(obsvect, **kwargs):
background.updated_controlvect = False background.updated_controlvect = False
# ncini: number of initial mixing ratio variables to optimize # ncini: number of initial mixing ratio variables to optimize
background.ncini = len(background.cini_lat) if background.optimize_cini:
background.ncini = len(background.cini_lat)
# Set time dimension for optimizing initial mixing ratio scalars
background.ntcini = max(1, int((datef - datei).days + 1) //
int(background.cini_res))
# Time stamp for initial mixing ratio scalars
# background.cinitime = np.array([datei + timedelta(days=x) for x in range(background.ntcini)])
background.cinitime = np.array([datei + timedelta(days=x*int(background.cini_res)) for x in range(background.ntcini)])
else:
background.ncini = 1
background.ntcini = 1
background.cinitime = np.array([datei])
background.cini_names = ["obs_cini_{}".format(i) for i in range(background.ncini)] background.cini_names = ["obs_cini_{}".format(i) for i in range(background.ncini)]
# 'cini' is dimension number of observations x zones to optimize # 'cini' is dimension number of observations x zones to optimize
# Stored in monitor as obs_cini_1, obs_cini_2 etc. # Stored in monitor as obs_cini_1, obs_cini_2 etc.
# Currently we are strictly using longitudinal bands, that are sorted # Currently we are strictly using longitudinal bands, that are sorted
# South to North in the cini array # South to North in the cini array
cini = np.zeros((len(obsvect.datastore), background.ncini), order='C') cini = np.zeros((len(obsvect.datastore), background.ncini), order='C')
# Set time dimension for optimizing initial mixing ratio scalars
background.ntcini = max(1, int((datef - datei).days + 1) //
int(background.cini_res))
# Time stamp for initial mixing ratio scalars
# background.cinitime = np.array([datei + timedelta(days=x) for x in range(background.ntcini)])
background.cinitime = np.array([datei + timedelta(days=x*int(background.cini_res)) for x in range(background.ntcini)])
# Read FLEXPART header (to access trajdays) # Read FLEXPART header (to access trajdays)
fp_header = None fp_header = None
......
Supports Markdown
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