Commit ea85da06 authored by Florentie, Liesbeth's avatar Florentie, Liesbeth
Browse files

vorige update was nog niet optimaal...

parent 42366dac
......@@ -448,34 +448,34 @@ def invert(dacycle, statevector, optimizer):
""" Perform the inverse calculation """
logging.info(header + "starting invert" + footer)
dims = (int(dacycle['time.nlag']),
int(dacycle['da.optimizer.nmembers']),
int(dacycle.dasystem['nparameters']),
statevector.nobs)
if not dacycle.dasystem.has_key('opt.algorithm'):
logging.info("There was no minimum least squares algorithm specified in the DA System rc file (key : opt.algorithm)")
logging.info("...using serial algorithm as default...")
optimizer.set_algorithm('Serial')
elif dacycle.dasystem['opt.algorithm'] == 'serial':
logging.info("Using the serial minimum least squares algorithm to solve ENKF equations")
optimizer.set_algorithm('Serial')
elif dacycle.dasystem['opt.algorithm'] == 'bulk':
logging.info("Using the bulk minimum least squares algorithm to solve ENKF equations")
optimizer.set_algorithm('Bulk')
optimizer.setup(dims)
optimizer.state_to_matrix(statevector)
diagnostics_file = os.path.join(dacycle['dir.output'], 'optimizer.%s.nc' % dacycle['time.start'].strftime('%Y%m%d'))
optimizer.write_diagnostics(diagnostics_file, 'prior')
optimizer.set_localization(dacycle['da.system.localization'])
if statevector.nobs == 0:
logging.warning('List with observations to assimilate is empty, skipping invert step and continuing without statevector update...')
else:
dims = (int(dacycle['time.nlag']),
int(dacycle['da.optimizer.nmembers']),
int(dacycle.dasystem['nparameters']),
statevector.nobs)
if not dacycle.dasystem.has_key('opt.algorithm'):
logging.info("There was no minimum least squares algorithm specified in the DA System rc file (key : opt.algorithm)")
logging.info("...using serial algorithm as default...")
optimizer.set_algorithm('Serial')
elif dacycle.dasystem['opt.algorithm'] == 'serial':
logging.info("Using the serial minimum least squares algorithm to solve ENKF equations")
optimizer.set_algorithm('Serial')
elif dacycle.dasystem['opt.algorithm'] == 'bulk':
logging.info("Using the bulk minimum least squares algorithm to solve ENKF equations")
optimizer.set_algorithm('Bulk')
optimizer.setup(dims)
optimizer.state_to_matrix(statevector)
diagnostics_file = os.path.join(dacycle['dir.output'], 'optimizer.%s.nc' % dacycle['time.start'].strftime('%Y%m%d'))
optimizer.write_diagnostics(diagnostics_file, 'prior')
optimizer.set_localization(dacycle['da.system.localization'])
else:
if optimizer.algorithm == 'Serial':
optimizer.serial_minimum_least_squares()
else:
......
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