Skip to content
Snippets Groups Projects
Commit cf23e968 authored by Antoine Berchet's avatar Antoine Berchet
Browse files

Fixing miscaleneous PEP8 issues

parent d617da24
No related branches found
No related tags found
1 merge request!10Lsce
Showing
with 47 additions and 38 deletions
from __future__ import absolute_import
from .plugins import *
from .plugins import chemistries, domains, fields, fluxes, measurements, \
meteos, minimizers, models, modes, obsoperators, obsparsers, obsvects, \
platforms, simulators, statevect, transforms
from os.path import dirname, basename, isdir
......
......@@ -11,4 +11,3 @@ import glob
modules = glob.glob(dirname(__file__) + "/*")
__all__ = [basename(f) for f in modules if isdir(f) and not f.endswith(".py")]
......@@ -73,5 +73,6 @@ def read_chemicalscheme(chemistry, **kwargs):
with open(dirchem_ref + "FAMILIES." + chemistry.schemeid, "r") as fsp:
ln = fsp.readlines()
chemistry.nfamilies = len(ln)
chemistry.nprspecies = 4 ##### en dur pour le moment
# TODO: generalize number of prescribed species
chemistry.nprspecies = 4
......@@ -11,4 +11,3 @@ import glob
modules = glob.glob(dirname(__file__) + "/*")
__all__ = [basename(f) for f in modules if isdir(f) and not f.endswith(".py")]
from pycif.utils.check import info
def create_domain(domain, **kwargs):
"""Creates a grid if needed
......
from pycif.utils.check import info
def create_domain(domain, **kwargs):
"""Creates a grid if needed
......
......@@ -11,4 +11,3 @@ import glob
modules = glob.glob(dirname(__file__) + "/*")
__all__ = [basename(f) for f in modules if isdir(f) and not f.endswith(".py")]
......@@ -11,4 +11,3 @@ import glob
modules = glob.glob(dirname(__file__) + "/*")
__all__ = [basename(f) for f in modules if isdir(f) and not f.endswith(".py")]
......@@ -6,4 +6,3 @@ import glob
modules = glob.glob(dirname(__file__) + "/*")
__all__ = [basename(f) for f in modules if isdir(f) and not f.endswith(".py")]
......@@ -6,4 +6,3 @@ import glob
modules = glob.glob(dirname(__file__) + "/*")
__all__ = [basename(f) for f in modules if isdir(f) and not f.endswith(".py")]
......@@ -21,7 +21,6 @@ def read(
filetypes=["defstoke", "fluxstoke", "fluxstokev", "phystoke"],
**kwargs
):
"""Reads meteorology and links to the working directory
Args:
......
......@@ -6,4 +6,3 @@ import glob
modules = glob.glob(dirname(__file__) + "/*")
__all__ = [basename(f) for f in modules if isdir(f) and not f.endswith(".py")]
......@@ -8,7 +8,6 @@ from pycif.utils.check import info
def minimize(self, finit, gradinit, chi0, **kwargs):
# x, f, g, auxil, io, niter, nsim, iz, df1, m=5, dxmin=1.e-20,
# epsg=1.e-20, impres=1, mode=0, **kwargs
"""Entry point for CONGRAD algorithm.
Args:
......
......@@ -7,7 +7,6 @@ from pycif.utils.check import info
def minimize(self, finit, gradinit, chi0, **kwargs):
# x, f, g, auxil, io, niter, nsim, iz, df1, m=5, dxmin=1.e-20,
# epsg=1.e-20, impres=1, mode=0, **kwargs
"""Entry point for M1QN3 algorithm.
Args:
......
......@@ -78,6 +78,7 @@ def m1qn3(self, f, g, chi, **kwargs):
eps1 = 1.0
ps = np.dot(g, g)
dk = ps
gnorm = ps
gnorm = np.sqrt(gnorm)
if nverbose >= 1:
......
......@@ -11,4 +11,3 @@ import glob
modules = glob.glob(dirname(__file__) + "/*")
__all__ = [basename(f) for f in modules if isdir(f) and not f.endswith(".py")]
......@@ -2,8 +2,8 @@ from __future__ import absolute_import
import os
import shutil
from .inputs.fluxes import *
from .inputs.meteo import *
from .inputs.fluxes import make_fluxes
from .inputs.meteo import make_meteo
from pycif.utils import path
from pycif.utils.check import info
from pycif.utils.classes.setup import Setup
......
......@@ -3,6 +3,7 @@ import os
import shutil
from .params import make_rundef, make_totinput
from .meteo import make_meteo
from pycif.utils import path
from pycif.utils.check import info
......@@ -32,25 +33,7 @@ def make_input(
datei = min(di, df)
if mod_input == "meteo":
dir_meteo = data.datastore[("meteo", "")]["dirorig"]
# Links meteorological mass fluxes
for ftype in ["defstoke", "fluxstoke", "fluxstokev", "phystoke"]:
meteo_file = "{}.an{}.m{:02d}.nc".format(
ftype, datei.year, datei.month
)
source = "{}/{}".format(dir_meteo, meteo_file)
target = "{}/{}.nc".format(runsubdir, ftype)
if ftype == "defstoke" and not os.path.isfile(source):
meteo_file = "{}.nc".format(ftype)
source = "{}/{}".format(dir_meteo, meteo_file)
path.link(source, target)
# Links vertical coordinates from previous simulations
source = self.file_vcoord
target = "{}/vcoord.nc".format(runsubdir)
path.link(source, target)
make_meteo(self, data, di, df, runsubdir, mode)
elif mod_input == "def":
# run.def
......
......@@ -44,7 +44,7 @@ def make_chemfields(self, data_in, input_type, ddi, ddf, runsubdir, mode):
path.link(origin, target)
# Skip if that species is not in the control vector
if not "spec" in data:
if "spec" not in data:
continue
# If tangent-linear mode, include tl increments
......@@ -57,7 +57,7 @@ def make_chemfields(self, data_in, input_type, ddi, ddf, runsubdir, mode):
prod_file = "{}/mod_{}_{}.bin".format(runsubdir, bin_name, spec)
with FortranFile(prod_file, "w") as f:
# Looping over all values and writing to binary
prod = prod.values
incr = incr.values
prod = data["spec"].values
incr = data["incr"].values
for d0, d1 in zip(np.ravel(prod), np.ravel(incr)):
f.write_record(np.array([d0, d1], dtype=float))
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from pycif.utils import path
def make_meteo(self, data, ddi, ddf, runsubdir, mode):
datei = min(ddi, ddf)
dir_meteo = data.datastore[("meteo", "")]["dirorig"]
# Links meteorological mass fluxes
for ftype in ["defstoke", "fluxstoke", "fluxstokev", "phystoke"]:
meteo_file = "{}.an{}.m{:02d}.nc".format(
ftype, datei.year, datei.month
)
source = "{}/{}".format(dir_meteo, meteo_file)
target = "{}/{}.nc".format(runsubdir, ftype)
if ftype == "defstoke" and not os.path.isfile(source):
meteo_file = "{}.nc".format(ftype)
source = "{}/{}".format(dir_meteo, meteo_file)
path.link(source, target)
# Links vertical coordinates from previous simulations
source = self.file_vcoord
target = "{}/vcoord.nc".format(runsubdir)
path.link(source, target)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment