Commit 6a4352d9 authored by Espen Sollum's avatar Espen Sollum
Browse files

2nd rebase attempt

parent 90a8d549
......@@ -4,7 +4,7 @@ from types import MethodType
from pycif.utils import path
from pycif.utils.check import verbose
from read import read
from write import write
from read import read_fluxes
from write import write_fluxes
requirements = {'domain': {'name': 'LMDZ', 'version': 'std', 'empty': False}}
......@@ -6,7 +6,7 @@ import datetime
import numpy as np
def read(self, name, tracdir, tracfic, dates,
def read_fluxes(self, name, tracdir, tracfic, dates,
interpol_flx=False, **kwargs):
"""Get fluxes from pre-computed fluxes and load them into a pycif
variables
......@@ -82,8 +82,8 @@ def read(self, name, tracdir, tracfic, dates,
trcr_flx[i0] * w1 + trcr_flx[i1] * w0)
trcr_flx = trcr_flx_interp
xmod = xr.DataArray(np.array(trcr_flx)[:, np.newaxis, ...],
xmod = xr.DataArray(trcr_flx,
coords={'time': dates},
dims=('time', 'lev', 'lat', 'lon'))
dims=('time', 'lat', 'lon'))
return xmod
def write():
def write_fluxes():
raise Exception("I don't know yet how to write LMDZ sflx files")
from fetch_meteo import fetch_meteo
from read_meteo import read_meteo
from create_meteo import create_meteo
requirements = {'domain': {'name': 'dummy', 'version': 'std', 'empty': False}}
......
......@@ -5,7 +5,6 @@ import os
import pandas as pd
import pycif.utils.check as check
from pycif.utils import path
from pycif.utils.check import verbose
from pycif.utils.netcdf import readnc
......@@ -42,10 +41,4 @@ def fetch_meteo(meteo,
# Linking to file
target = '{}/meteo/meteo.csv'.format(workdir)
source = '{}/{}'.format(meteo.dirmeteo, meteo.ficmeteo)
try:
path.link(source, target)
except IOError:
verbose('{} does not exist. Creating random meteo time series from given arguments'.format(source))
meteo.create_meteo()
......@@ -60,7 +60,7 @@ def ini_data(plugin, **kwargs):
# Required inputs for running a CHIMERE simulation
plugin.required_inputs = ['exe', 'nml', 'fluxes',
'meteo', 'inicond', 'latcond', 'topcond']
'meteo', 'inicond', 'boundcond']
# Default values:
# period: '1D'
......
......@@ -20,10 +20,7 @@ requirements = {'domain': {'name': 'LMDZ', 'version': 'std', 'empty': False},
'emis_species': {'name': 'LMDZ', 'version': 'sflx',
'empty': True, 'type': 'fluxes'},
'meteo': {'name': 'LMDZ', 'version': 'mass-fluxes',
'empty': False},
'inicond': {'name': 'LMDZ', 'version': 'ic',
'empty': True, 'any': False, 'type': 'fields',
'newplg': True}}
'empty': False}}
def ini_data(plugin, **kwargs):
......
......@@ -58,7 +58,7 @@ def make_input(self, mod_input, di, df, mode, runsubdir, workdir,
# Remove restart TL
if mode != 'tl':
shutil.rmtree('{}/*start_tl.bin'.format(runsubdir),
shutil.rmtree('{}/restart_tl.bin'.format(runsubdir),
ignore_errors=True)
# TODO: at the moment, no satellite observation
......
......@@ -74,7 +74,7 @@ def execute(self, **kwargs):
**kwargs)
# Computing < H.dx, H.dx >
scaleprod1 = obsvect.datastore['sim_tl'].pow(2.).sum()
scaleprod1 = (obsvect.datastore['sim_tl'] ** 2).sum()
# Putting increments in the observation vector
obsvect.datastore['obs_incr'] = obsvect.datastore['sim_tl']
......@@ -91,8 +91,8 @@ def execute(self, **kwargs):
# Computing < dx, H*(H.dx) >
if testspace == 'control':
scaleprod2 = ((controlvect.xb - controlvect.x)
* controlvect.dx).sum()
scaleprod2 = (controlvect.dx
* (controlvect.xb - controlvect.x)).sum()
elif testspace == 'chi':
scaleprod2 = \
......@@ -102,13 +102,10 @@ def execute(self, **kwargs):
else:
scaleprod2 = np.nan
import code
code.interact(local=dict(locals(), **globals()))
# Final verbose
verbose('Machine accuracy: {}'.format(accuracy))
verbose('< H.dx, H.dx > = {:.17E}'.format(scaleprod1))
verbose('< dx, H*(H.dx) > = {:.17E}'.format(scaleprod2))
verbose('The difference is {:.1E} times the machine accuracy'
verbose('The difference is {:.1E} time the machine accuracy'
.format(np.abs(scaleprod2 / scaleprod1 - 1) / accuracy))
\ No newline at end of file
......@@ -149,9 +149,9 @@ def obsoper(self, inputs, mode,
# was already properly run, thus passing to next sub-periods
# Compute the sub-simulation anyway if some previous periods
# were missing (as stored in self.missingperiod)
do_simu = (created \
do_simu = created \
or not getattr(self, 'autorestart', False) \
or self.missingperiod) and not read_only
or self.missingperiod
self.missingperiod = do_simu
# Some verbose
......
import glob
from .init_y0 import init_y0
from .init_rinvprod import init_rinvprod
from .native2obsvect import native2obsvect
from .obsvect2native import obsvect2native
from .rinvprod import rinvprod
from pycif.plugins.obsvects.standard.utils.check_monitor import check_monitor
from pycif.utils import path
from types import MethodType
import os
import numpy as np
# It is necessary to have some measurements and some info about the meteo
# to initialize the observation vector
......
......@@ -52,9 +52,6 @@ class Setup(Plugin):
verbose('pycif has correctly been initialized '
'but no execution mode was specified')
else:
verbose('pycif has correctly been initialized '
'but no execution mode was specified')
@classmethod
def from_yaml(cls, def_fic):
......
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