Commit 8be1015f authored by brunner's avatar brunner
Browse files

No commit message

No commit message
parent 945546cf
......@@ -23,22 +23,21 @@ File created on 28 Jul 2010.
import os
import sys
import logging
import datetime as dtm
#from string import strip
from numpy import array, logical_and, sqrt, empty, squeeze, array2string, split, append
from da.baseclasses.obs import Observations
import da.tools.io4 as io
import da.tools.rc as rc
sys.path.append(os.getcwd())
sys.path.append('../../')
identifier = 'CarbonTracker CO2 mole fractions'
version = '0.0'
from da.baseclasses.obs import Observations
import da.tools.io4 as io
import da.tools.rc as rc
################### Begin Class ObsPackObservations ###################
class ObsPackObservations(Observations):
class Obs(Observations):
""" an object that holds data + methods and attributes needed to manipulate mole fraction values """
def setup(self, dacycle):
......
......@@ -2,25 +2,22 @@
# model.py
import logging
identifier = 'RandomizerObservationOperator'
version = '1.0'
import os
import sys
import subprocess
import da.tools.io4 as io
import numpy as np
from netCDF4 import Dataset
from datetime import datetime, timedelta
from dateutil import rrule
from cdo import *
identifier = 'ObservationOperator'
version = '10'
################### Begin Class ObservationOperator ###################
class ObservationOperator(object):
"""
Testing
=======
This is a class that defines an ObervationOperator. This object is used to control the sampling of
a statevector in the ensemble Kalman filter framework. The methods of this class specify which (external) code
is called to perform the sampling, and which files should be read for input and are written for output.
The baseclasses consist mainly of empty methods that require an application specific application. The baseclass will take observed values, and perturb them with a random number chosen from the model-data mismatch distribution. This means no real operator will be at work, but random normally distributed residuals will come out of y-H(x) and thus the inverse model can proceed. This is mainly for testing the code...
"""
def __init__(self, dacycle=None):
""" The instance of an ObservationOperator is application dependent """
self.ID = identifier
self.version = version
self.restart_filelist = []
......@@ -50,8 +47,6 @@ class ObservationOperator(object):
def prepare_run(self):
""" Prepare the running of the actual forecast model, for example compile code """
import os
# Define the name of the file that will contain the modeled output of each observation
self.simulated_file = os.path.join(self.outputdir, 'samples_simulated.%s.nc' % self.dacycle['time.sample.stamp'])
......@@ -59,18 +54,6 @@ class ObservationOperator(object):
def run(self):
import da.tools.io4 as io
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import os
from netCDF4 import Dataset
import sys
from datetime import datetime, timedelta
import subprocess
# from cdo import *
from dateutil import rrule
from datetime import datetime, timedelta
f = io.CT_CDF(self.simulated_file, method='create')
logging.debug('Creating new simulated observation file in ObservationOperator (%s)' % self.simulated_file)
......@@ -113,7 +96,6 @@ class ObservationOperator(object):
shape = (self.forecast_nmembers,mdm.size)
model_data=np.empty(shape=shape) # 3x7
# sys.exit()
# self.obspack_dir = dacycle.dasystem['obspack.input.dir']
......@@ -182,8 +164,6 @@ class ObservationOperator(object):
# sys.exit()
# Report success and exit
logging.info('ObservationOperator finished successfully, output file written (%s)' % self.simulated_file)
def run_forecast_model(self):
......@@ -191,12 +171,6 @@ class ObservationOperator(object):
self.run()
def extract_model_data(ens):
import os
import sys
from datetime import datetime, timedelta
import subprocess
from . import site_height
#from cdo import *
cdo = Cdo()
files2cat=[]
......
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