Commit e19c0d8d authored by Elise Potier's avatar Elise Potier
Browse files

Merge branch 'devel' of gitlab.in2p3.fr:satinv/cif into devel

Conflicts:
	pycif/plugins/datastreams/fields/netcdf_cams/read.py
parents a40acfa5 795b49d5
......@@ -606,6 +606,7 @@ def build_rst_from_plugins(app):
# Loop over modules in the sub-type
package_subindex = []
package_subtitles = []
for mod in pkgutil.walk_packages(import_subpackage.__path__,
prefix=import_subpackage.__name__ + "."):
if not mod.ispkg:
......@@ -644,9 +645,11 @@ def build_rst_from_plugins(app):
# Append name for plugin type index
package_subindex.append(loc_mod.__name__.split(".")[-1])
package_subtitles.append(getattr(loc_mod, "_fullname", loc_mod._name))
# Sort names
package_subindex.sort()
package_subindex = [
x for _,x in sorted(zip(package_subtitles, package_subindex))]
# Write the plugin type index
if subtype == "":
......
......@@ -19,10 +19,6 @@ mode:
name: gausscost
version: std
reload_from_previous: true
montecarlo:
nsample: 10
perturb_x: true
perturb_y: false
plugin:
name: 4dvar
version: std
......
......@@ -6,7 +6,7 @@ workdir: !join [*outdir, /inversion_long_bands_ensrf_]
datei: 2010-01-01
datef: 2010-01-05 00:00:00
mode:
nsample: 50
nsample: 10
plugin:
name: EnSRF
version: std
......
......@@ -219,11 +219,15 @@ NCERR(__LINE__)
NCERR(__LINE__)
idr=mm5date2numeric(datebuf)
idex = idate(ihourrun)
if(idr.ne.idex) then
print *,'*** ERROR: WRONG EXPECTED DATE IN BOUN_CONCS FILE'
print *,'IHOURRUN=',ihourrun,' EXPECTED= ' &
,idex,' BOUN_CONCS= ',idr
call exit1('Exiting')
if (ignore_chck_dates == 0) then
if(idr.ne.idex) then
print *,'*** ERROR: WRONG EXPECTED DATE IN BOUN_CONCS FILE'
print *,'IHOURRUN=',ihourrun,' EXPECTED= ' &
,idex,' BOUN_CONCS= ',idr
call exit1('Exiting')
endif
else
print *,'*** NO CHECK ON DATES in BOUN_CONCS'
endif
allocate(buf3(nspecboun, nhbound_domain, nverti))
stvec4 =(/1 , 1 , 1 , ihourrun+1 /)
......
......@@ -144,11 +144,15 @@ NCERR(__LINE__)
bounconc_ncid,bounconc_times_varid,datebuf,(/1,1/),(/dlen,1/))
NCERR(__LINE__)
idex = idate(0)
idr=mm5date2numeric(datebuf)
if(idr.ne.idex) then
print *,'*** ERROR: WRONG EXPECTED DATE IN BOUN_CONCS FILE'
print *,'IHOURRUN=0, EXPECTED= ',idex,' BOUN_CONCS= ',idr
call exit1('Exiting')
idr=mm5date2numeric(datebuf)
if (ignore_chck_dates == 0) then
if(idr.ne.idex) then
print *,'*** ERROR: WRONG EXPECTED DATE IN BOUN_CONCS FILE'
print *,'IHOURRUN=0, EXPECTED= ',idex,' BOUN_CONCS= ',idr
call exit1('Exiting')
endif
else
print *,'*** NO CHECK ON DATES in BOUN_CONCS'
endif
! Boundary concentration increment file is already open
......@@ -204,11 +208,15 @@ NCERR(__LINE__)
bounconcincr_ncid,bounconcincr_times_varid,datebuf,(/1,1/),(/dlen,1/))
NCERR(__LINE__)
idex = idate(0)
idr=mm5date2numeric(datebuf)
if(idr.ne.idex) then
print *,'*** ERROR: WRONG EXPECTED DATE IN BOUN_CONCS INCREMENT FILE'
print *,'IHOURRUN=0, EXPECTED= ',idex,' BOUN_CONCS= ',idr
call exit1('Exiting')
idr=mm5date2numeric(datebuf)
if (ignore_chck_dates == 0) then
if(idr.ne.idex) then
print *,'*** ERROR: WRONG EXPECTED DATE IN BOUN_CONCS INCREMENT FILE'
print *,'IHOURRUN=0, EXPECTED= ',idex,' BOUN_CONCS= ',idr
call exit1('Exiting')
endif
else
print *,'*** NO CHECK ON DATES in BOUN_CONCS'
endif
!*** Lateral Boundary Concentrations
......@@ -247,11 +255,15 @@ NCERR(__LINE__)
bounconc_ncid, bounconc_times_varid, datebuf,(/1,2/),(/dlen,1/))
NCERR(__LINE__)
idex = idate(1)
idr=mm5date2numeric(datebuf)
if(idr.ne.idex) then
print *,'*** ERROR: WRONG EXPECTED DATE IN BOUN_CONCS FILE'
print *,'IHOURRUN=1, EXPECTED= ',idex,' BOUN_CONCS= ',idr
call exit1('Exiting')
idr=mm5date2numeric(datebuf)
if (ignore_chck_dates == 0) then
if(idr.ne.idex) then
print *,'*** ERROR: WRONG EXPECTED DATE IN BOUN_CONCS FILE'
print *,'IHOURRUN=1, EXPECTED= ',idex,' BOUN_CONCS= ',idr
call exit1('Exiting')
endif
else
print *,'*** NO CHECK ON DATES in BOUN_CONCS'
endif
stvec4 =(/1 , 1 , 1, 2/)
cntvec4=(/nspecboun, nhbound_domain, nverti, 1/)
......
......@@ -51,20 +51,19 @@ def read(
opened_file = dd_file
ntimes = ds.dims["time"]
#freq = dd[0].days_in_month * 24 / ntimes
freq = (calendar.mdays[dd[0].month] + ( dd[0].month == 2 and calendar.isleap( dd[0].year))) * 24 / ntimes
print("to check with february")
print(dd[0].month)
print(calendar.mdays[dd[0].month] + ( dd[0].month == 2 and calendar.isleap( dd[0].year)))
freq = pd.DatetimeIndex([dd[0]]).days_in_month[0] * 24 / ntimes
date_index = int((dd[0] - ddi) / datetime.timedelta(hours=freq))
# bottom of the atmosphere = at the beginning of the table
lat = ds['latitude']
conc = ds[var2extract].values[date_index]
if lat[1] < lat[0] and conc.ndim==4:
if lat[1] < lat[0] and conc.ndim==4:
conc = conc[:, :, ::-1, :]
elif lat[1] < lat[0] and conc.ndim==3:
elif lat[1] < lat[0] and conc.ndim==3:
conc = conc[ :, ::-1, :]
xout.append(conc)
xmod = xr.DataArray(
......
......@@ -4,6 +4,7 @@ import os
import calendar
import numpy as np
def find_valid_file(ref_dir, file_format, dd):
# Get all files and dates matching the file and format
......
......@@ -135,7 +135,14 @@ input_arguments = {
"conv_scheme": {
"doc": "Convection scheme to use for the deep-convection",
"default": "TK",
"accepted": str
"accepted": {
"TK": "Tiedke parametrization; "
"corresponds to convection scheme #2 in LMDZ",
"KE": "Kerry-Emmanuel parametrization; "
"corresponds to convection scheme #3 in LMDZ",
"KT-Them": "Kerry-Emmanuel parametrization + thermics; "
"corresponds to convection scheme #30 in LMDZ",
}
},
"dump": {
"doc": "Dump trajq as netCDF",
......
......@@ -66,10 +66,12 @@ def ini_mapper(model, transform_type, general_mapper={}, backup_comps={},
inicond = {
("inicond", s): dict_ini for s in model.chemistry.acspecies.attributes
}
prescrcond = {
("prescrconcs", s): dict_surface
for s in model.chemistry.prescrconcs.attributes
}
prescrcond = {}
if hasattr(model.chemistry, "prescrconcs"):
prescrcond = {
("prescrconcs", s): dict_surface
for s in model.chemistry.prescrconcs.attributes
}
# End concentrations from previous period for all active species
# are needed for later periods
......
......@@ -49,11 +49,15 @@ def native2inputs_adj(
# Reading only output files related to given input_type
ref_names = {
"inicond": "init",
"flux": "flux",
"flux": "fluxes",
"prescrconcs": "scale",
"prodloss3d": "prodscale",
}
print(__file__)
import code
code.interact(local=dict(locals(), **globals()))
# Fetch end concentrations of adjoint for chain simulation
if input_type == "endconcs":
datastore = fetch_end(
......
......@@ -26,6 +26,7 @@ machine accuracy.
from .execute import execute
_name = "adj-tl_test"
_fullname = "Test of the adjoint"
requirements = {
"obsvect": {
......
......@@ -21,6 +21,7 @@ from .execute import execute
from ....utils import path
_name = "analytic"
_fullname = "Analytical inversions"
requirements = {
"obsvect": {
......
......@@ -11,6 +11,8 @@ from .execute import execute
from ....utils import path
_name = "EnSRF"
_fullname = "Ensemble Square-Root Filter"
requirements = {
"obsvect": {
......
......@@ -9,6 +9,8 @@ equivalent and/or save all the 4d concentration fields.
from .execute import execute
_name = "forward"
_fullname = "Forward run"
requirements = {
"controlvect": {
......
......@@ -9,6 +9,7 @@ it is mostly used to compute the minimum of the Bayesian Gaussian cost function.
from .execute import execute
_name = "4dvar"
_fullname = "4DVAR variational inversions"
requirements = {
"obsvect": {
......
......@@ -48,8 +48,11 @@ def execute(self, **kwargs):
Running a variational inversion with the following modules:
Minimizer: {}
Simulator: {}
Size of the control vector: {}
Size of the observation vector: {}
""".format(
minimizer.plugin.name, simulator.plugin.name
minimizer.plugin.name, simulator.plugin.name,
controlvect.dim, obsvect.dim
)
info(towrite)
......
......@@ -78,6 +78,7 @@ def init_control_transformations(
# Rescaling if any
if hasattr(param, "unit_conversion"):
unit_conv = getattr(param, "unit_conversion")
yml_dict = {
"plugin": {
"name": "unit_conversion",
......@@ -86,8 +87,8 @@ def init_control_transformations(
},
"component": [cmp],
"parameter": [prm],
**{attr: getattr(param, attr)
for attr in getattr(param, "attributes", []) if attr != "plugin"}
**{attr: getattr(unit_conv, attr)
for attr in getattr(unit_conv, "attributes", []) if attr != "plugin"}
}
new_transf, new_id = add_default(
all_transforms,
......
"""
This plugin deals with specific environment characteristics of the
cluster at the Très Grand Centre de calcul (France), more specifically the Rome/AMD
partition of the Centre de Calcul Recherche et Technologie.
"""
import subprocess
import os
_name = "TGCC-CCRT"
_version = "AMD"
_fullname = "Centre de Calcul Recherche et Technologie (AMD/rome)"
# It is necessary to have some measurements and some info about the meteo
# to initialize the observation vector
......
"""
This plugin deals with specific environment characteristics of the
Docker image designed specifically to run pycif.
Further information on this image can be found :doc:`here </docker/index>`.
"""
import subprocess
import os
......@@ -5,6 +13,7 @@ from .jobs import check_jobs, submit_job
_name = "docker"
_version = "cif"
_fullname = "Docker container for pycif"
# It is necessary to have some measurements and some info about the meteo
# to initialize the observation vector
......
"""
This plugin deals with specific environment characteristics of the
cluster at LSCE.
"""
import os
import subprocess
from .jobs import init_job, submit_job, check_jobs
_name = "LSCE"
_version = "obelix"
_fullname = "LSCE's cluster"
# It is necessary to have some measurements and some info about the meteo
# to initialize the observation vector
......
Markdown is supported
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