From f40b4c89656778b880466b05f29c646dce78fdce Mon Sep 17 00:00:00 2001 From: Ingrid Luijkx <ingrid.luijkx@wur.nl> Date: Tue, 13 Jul 2021 09:04:57 +0200 Subject: [PATCH] Fixed 2 small errors, connected to the preprocess observations pipeline and the ocean optimization key (follow up from previous update). --- da/pipelines/pipeline_cteco2.py | 6 +++--- da/statevectors/statevectorNHgridded_cteco2.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/da/pipelines/pipeline_cteco2.py b/da/pipelines/pipeline_cteco2.py index c38d6d73..e41c752d 100755 --- a/da/pipelines/pipeline_cteco2.py +++ b/da/pipelines/pipeline_cteco2.py @@ -378,12 +378,12 @@ def sample_step(dacycle, samples, statevector, obsoperator, lag, advance=False): # Read observations + perform observation selection obspickle_filename = os.path.join(dacycle['dir.restart'], sample.get_samples_type()+'samples_%s.pickle' % dacycle['time.sample.stamp']) if os.path.isfile(obspickle_filename): - if dacycle['da.preprocessobs'] == True: continue + if 'da.preprocessobs' in dacycle.dasystem and dacycle['da.preprocessobs'] == True: continue sample = pickle.load(open(obspickle_filename, 'rb')) logging.info("Loaded the samples object from file: %s"%obspickle_filename) else: sample.add_observations() - if dacycle['da.preprocessobs'] == True: + if 'da.preprocessobs' in dacycle.dasystem and dacycle['da.preprocessobs'] == True: pickle.dump(sample, open(obspickle_filename, 'wb'), -1) logging.info("Saved the samples object to file: %s"%obspickle_filename) continue @@ -401,7 +401,7 @@ def sample_step(dacycle, samples, statevector, obsoperator, lag, advance=False): del sample - if dacycle['da.preprocessobs'] == True: return + if 'da.preprocessobs' in dacycle.dasystem and dacycle['da.preprocessobs'] == True: return # Run the observation operator obsoperator.run_forecast_model(samples) diff --git a/da/statevectors/statevectorNHgridded_cteco2.py b/da/statevectors/statevectorNHgridded_cteco2.py index 07becde2..6303b90d 100755 --- a/da/statevectors/statevectorNHgridded_cteco2.py +++ b/da/statevectors/statevectorNHgridded_cteco2.py @@ -90,10 +90,10 @@ class CO2GriddedStateVector(StateVector): if 'pco2' in file or 'cov_ocean' in file: parnr = list(range(9805,9835)) if 'ocn.optimize' in dacycle.dasystem and dacycle.dasystem['ocn.optimize'] == False: - cov = np.identity(30)*1E-20 | cov = np.identity(30)*1E-20 + cov = np.identity(30)*1E-20 logging.debug('Prior ocean covariance matrix = Identity matrix') else: - cov = f.get_variable('CORMAT') + cov = f.get_variable('CORMAT') elif 'tropic' in file: cov = f.get_variable('covariance') parnr = f.get_variable('parameternumber') -- GitLab