Skip to content
Snippets Groups Projects
Commit 55c5dfcf authored by karolina's avatar karolina
Browse files

in sv.write_to_file modified the prior/optimized identifier in function call...

in sv.write_to_file modified the prior/optimized identifier in function call to be prior/opt text instead of True/False
parent cf5e0063
No related branches found
No related tags found
No related merge requests found
......@@ -303,7 +303,7 @@ class StateVector(object):
logging.info('The state vector has been propagated by one cycle')
def write_to_file(self, filename, optimized):
def write_to_file(self, filename, qual):
"""
:param filename: the full filename for the output NetCDF file
:rtype: None
......@@ -321,14 +321,14 @@ class StateVector(object):
#import da.tools.io4 as io
#import da.tools.io as io
if not optimized:
if qual == 'prior':
f = io.CT_CDF(filename, method='create')
logging.debug('Creating new StateVector output file (%s)' % filename)
qual = 'prior'
#qual = 'prior'
else:
f = io.CT_CDF(filename, method='write')
logging.debug('Opening existing StateVector output file (%s)' % filename)
qual = 'opt'
#qual = 'opt'
dimparams = f.add_params_dim(self.nparams)
dimmembers = f.add_members_dim(self.nmembers)
......
......@@ -61,7 +61,7 @@ def forward_pipeline(DaCycle, PlatForm, DaSystem, Samples, StateVector, ObsOpera
# Write as prior fluxes to output dir
savefilename = os.path.join(DaCycle['dir.output'], 'savestate.nc') #LU to jest state vector po zoptymalizowaniu.
StateVector.write_to_file(savefilename, False)
StateVector.write_to_file(savefilename, 'prior')
# Now read optimized fluxes to propagate
......@@ -130,7 +130,7 @@ def prepare_state(DaCycle, StateVector):
# Finally, also write the StateVector to a file so that we can always access the a-priori information
saved_current_sv = os.path.join(DaCycle['dir.output'], 'savestate.nc')
StateVector.write_to_file(saved_current_sv, False) # write prior info because StateVector.Isoptimized == False for now
StateVector.write_to_file(saved_current_sv, 'prior') # write prior info because StateVector.Isoptimized == False for now
def sample_state(DaCycle, Samples, StateVector, ObservationOperator):
""" Sample the filter state for the inversion """
......@@ -298,7 +298,7 @@ def save_and_submit(DaCycle, StateVector):
filename = os.path.join(DaCycle['dir.output'], 'savestate.nc') #LU to jest state vector po zoptymalizowaniu.
StateVector.write_to_file(filename, True)
StateVector.write_to_file(filename, 'opt')
DaCycle.RestartFileList.append(filename) # write optimized info because StateVector.Isoptimized == False for now
DaCycle.finalize()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment