Commit b4db9173 authored by brunner's avatar brunner
Browse files

No commit message

No commit message
parent 51e9facd
......@@ -27,7 +27,7 @@ sys.path.append(os.getcwd())
import logging
import numpy as np
from da.cosmo.base_statevector import StateVector, EnsembleMember
from da.cosmo.statevector import StateVector, EnsembleMember
import da.tools.io4 as io
......
......@@ -124,8 +124,8 @@ class ObservationOperator(object):
logging.info('Multiplying emissions with parameters for lag %d, date %s' % (lag, dt.strftime('%Y%m%d%H')))
for ens in range(0,self.forecast_nmembers):
ens = str(ens).zfill(3)
cdo.setunit("'kg m-2 s-1' -expr,GPP_"+ens+"_F=CO2_GPP_F*parametermap -merge "+os.path.join(dacycle['da.bio.input'], 'gpp_%s.nc' % dt.strftime('%Y%m%d%H')), input = os.path.join(dacycle['restartmap.dir'],"parameters_lag"+str(lag)+"."+ens+".nc"), output = os.path.join(dacycle['da.bio.input'], 'ensemble', "gpp_"+ens+"_%s.nc" % dt.strftime('%Y%m%d%H')))
cdo.setunit("'kg m-2 s-1' -expr,RESP_"+ens+"_F=CO2_RESP_F*parametermap -merge "+os.path.join(dacycle['da.bio.input'], 'ra_%s.nc' % dt.strftime('%Y%m%d%H')), input = os.path.join(dacycle['restartmap.dir'],"parameters_lag"+str(lag)+"."+ens+".nc"), output = os.path.join(dacycle['da.bio.input'], 'ensemble', "ra_"+ens+"_%s.nc" % dt.strftime('%Y%m%d%H')))
cdo.setunit("'kg m-2 s-1' -expr,GPP_"+ens+"_F=CO2_GPP_F*parametermap -merge "+os.path.join(dacycle['da.bio.input'], 'gpp_%s.nc' % dt.strftime('%Y%m%d%H')), input = os.path.join(dacycle['restartmap.dir'],"parameters_gpp_lag"+str(lag)+"."+ens+".nc"), output = os.path.join(dacycle['da.bio.input'], 'ensemble', "gpp_"+ens+"_%s.nc" % dt.strftime('%Y%m%d%H')))
cdo.setunit("'kg m-2 s-1' -expr,RESP_"+ens+"_F=CO2_RESP_F*parametermap -merge "+os.path.join(dacycle['da.bio.input'], 'ra_%s.nc' % dt.strftime('%Y%m%d%H')), input = os.path.join(dacycle['restartmap.dir'],"parameters_resp_lag"+str(lag)+"."+ens+".nc"), output = os.path.join(dacycle['da.bio.input'], 'ensemble', "ra_"+ens+"_%s.nc" % dt.strftime('%Y%m%d%H')))
cdo.merge(input = os.path.join(dacycle['da.bio.input'], 'ensemble', "gpp_???_%s.nc" % dt.strftime('%Y%m%d%H')), output = os.path.join(dacycle['da.bio.input'], 'ensemble', "gpp_%s.nc" % dt.strftime('%Y%m%d%H')))
cdo.merge(input = os.path.join(dacycle['da.bio.input'], 'ensemble', "ra_???_%s.nc" % dt.strftime('%Y%m%d%H')), output = os.path.join(dacycle['da.bio.input'], 'ensemble', "ra_%s.nc" % dt.strftime('%Y%m%d%H')))
......@@ -158,7 +158,6 @@ class ObservationOperator(object):
for j,data in enumerate(zip(ids,obs,mdm)):
f.variables['obs_num'][j] = data[0]
f.variables['flask'][j,:] = model_data[:,j]
# print model_data[:,j]
f.close()
#### WARNING ACHTUNG PAZNJA POZOR VNEMANIE data[2] is model data mismatch (=1000) by default in tools/io4.py!!! pavle
......
......@@ -347,6 +347,7 @@ class ObsPackObservations(Observations):
for obs in self.datalist: # first loop over all available data points to set flags correctly
# obs.mdm = 0.05 # default is very high model-data-mismatch, until explicitly set by script
obs.mdm = 2.5 # default is very high model-data-mismatch, until explicitly set by script
obs.flag = 0
identifier = obs.code
......
......@@ -269,6 +269,7 @@ def prepare_state(dacycle, statevector):
nlag = int(dacycle['time.nlag'])
for l in range(0,nlag): # pavle added from here
statevector.write_members_to_file(l, dacycle['restartmap.dir'])
statevector.write_members_for_cosmo(l, dacycle['restartmap.dir'])
def sample_state(dacycle, samples, statevector, obsoperator):
""" Sample the filter state for the inversion """
......@@ -319,6 +320,7 @@ def sample_step(dacycle, samples, statevector, obsoperator, lag, advance=False):
# type of info needed in your transport model
statevector.write_members_to_file(lag, dacycle['dir.input'])
statevector.write_members_for_cosmo(lag, dacycle['dir.input'])
samples.setup(dacycle)
samples.add_observations()
......
......@@ -33,7 +33,7 @@ from da.cosmo.covariances import CO2StateVector
#from da.cosmo.statevector import StateVector
from da.cosmo.obspack_globalviewplus2 import ObsPackObservations
#from da.cosmo.obs import Obs
from da.carbondioxide.optimizer import CO2Optimizer
from da.cosmo.optimizer import CO2Optimizer
from da.cosmo.observationoperator import ObservationOperator
#from da.analysis.expand_fluxes import save_weekly_avg_1x1_data, save_weekly_avg_state_data, save_weekly_avg_tc_data, save_weekly_avg_ext_tc_data
#from da.analysis.expand_molefractions import write_mole_fractions
......@@ -43,8 +43,8 @@ from da.cosmo.observationoperator import ObservationOperator
# Parse and validate the command line options, start logging
#################################################################################################
#start_logger()
start_logger(level=logging.DEBUG)
start_logger()
#start_logger(level=logging.DEBUG)
opts, args = parse_options()
opts, args = validate_opts_args(opts, args)
......
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