Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VERIFY
CIF
Commits
c5c03866
Commit
c5c03866
authored
Jul 29, 2019
by
Espen Sollum
Browse files
Basic files added for flexpart
parent
c5094e69
Changes
11
Hide whitespace changes
Inline
Side-by-side
examples/config_dummy_forward.yml
View file @
c5c03866
...
...
@@ -28,7 +28,8 @@ verbose: 1
logfile
:
pyvar.logtest
# Execution directory
workdir
:
/home/chimereges/aberchet/CIF_dummy_test/
#workdir : /home/eso/repos/CIF/test/
workdir
:
/home/eso/tmp/CIFtest
# Initial date
# Use the following compatible format for the date:
...
...
@@ -58,7 +59,8 @@ mode:
name
:
forward
version
:
std
perturb_obsvect
:
True
obserror
:
0.01
# obserror: 0.01
obserror
:
0.25
#####################################################################
#####################################################################
...
...
@@ -73,7 +75,7 @@ model :
version
:
std
# H matrix
fic_pg
:
/home/
users/aberchet
/CIF/model_sources/dummy_gauss/Pasquill-Gifford.txt
fic_pg
:
/home/
eso/repos
/CIF/model_sources/dummy_gauss/Pasquill-Gifford.txt
#####################################################################
#####################################################################
...
...
@@ -90,8 +92,10 @@ measurements :
version
:
std
# File where to save data, if does not exist. Reads from there if exists
fic_monitor
:
/home/chimereges/aberchet/CIF_dummy_test/monitor_reference.nc
fic_monitor
:
/home/eso/tmp/CIFtest/monitor_reference.nc
# fic_monitor : /home/eso/tmp/CIFtest/monitor_reference.csv
dump_type
:
nc
# dump_type : csv
species
:
# List of tracers to include in the monitor file
# For each tracer observations, please specify:
...
...
@@ -127,8 +131,10 @@ obsvect:
plugin
:
name
:
standard
version
:
std
fic_obsvect
:
/home/chimereges/aberchet/CIF_dummy_test/monitor_reference.nc
fic_obsvect
:
/home/eso/tmp/CIFtest/monitor_reference.nc
# fic_obsvect : /home/eso/tmp/CIFtest/monitor_reference.csv
dump_type
:
nc
# dump_type: csv
#####################################################################
#####################################################################
...
...
@@ -169,13 +175,13 @@ controlvect:
errtype
:
max
err
:
1
period
:
'
1D'
dir
:
/home/
chimereges/aberchet/CIF_dummy_
test/controlvect/
dir
:
/home/
eso/tmp/CIF
test/controlvect/
fic
:
flx_real.txt
hcorrelations
:
landsea
:
False
dump_hcorr
:
True
dircorrel
:
/home/
chimereges/aberchet/CIF_dummy_
test/controlvect/
sigma
:
3
000
dircorrel
:
/home/
eso/tmp/CIF
test/controlvect/
sigma
:
1
000
tcorrelations
:
sigma_t
:
5
flx_text
:
'
CIF'
...
...
@@ -207,8 +213,7 @@ meteo :
plugin
:
name
:
dummy
version
:
csv
dirmeteo
:
/home/
users/aberchet
/CIF/data/dummy_gauss/
ficmeteo
:
meteo
2
.csv
resolution
:
'
1H'
dirmeteo
:
/home/
eso/repos
/CIF/data/dummy_gauss/
ficmeteo
:
meteo.csv
#####################################################################
#####################################################################
#####################################################################
\ No newline at end of file
examples/config_dummy_inversion.yml
View file @
c5c03866
...
...
@@ -22,13 +22,13 @@
# Verbose level
# 1 = Basic information
# 2 = Debugging
verbose
:
1
verbose
:
2
# Log file (to be saved in $wordkir)
logfile
:
pyCIF.logtest
# Execution directory
workdir
:
/home/
chimereges/aberchet/CIF_dummy_test_inv/
workdir
:
/home/
eso/tmp/CIFtest
# Initial date
# Use the following compatible format for the date:
...
...
@@ -76,7 +76,12 @@ model :
version
:
std
# H matrix
fic_pg
:
/home/users/aberchet/CIF/model_sources/dummy_gauss/Pasquill-Gifford.txt
fic_pg
:
/home/eso/repos/CIF/model_sources/dummy_gauss/Pasquill-Gifford.txt
#####################################################################
#####################################################################
# Save H for later use in inversions
save_H
:
True
#####################################################################
#####################################################################
...
...
@@ -90,7 +95,7 @@ obsvect:
plugin
:
name
:
standard
version
:
std
fic_obsvect
:
/home/
chimereges/aberchet//CIF_dummy_test/obsvect/monitor
.nc
fic_obsvect
:
/home/
eso/tmp/CIFtest/monitor_reference
.nc
dump_type
:
nc
#####################################################################
#####################################################################
...
...
@@ -162,12 +167,13 @@ controlvect:
errtype
:
avg
xb_value
:
1
err
:
1
period
:
'
2D'
flx_text
:
'
'
period
:
'
1D'
dir
:
/home/eso/tmp/CIFtest/controlvect/
fic
:
flx_real.txt
hcorrelations
:
landsea
:
False
dump_hcorr
:
True
dircorrel
:
/home/
chimereges/aberchet/CIF_dummy_test_inv
/
dircorrel
:
/home/
eso/tmp/CIFtest/controlvect
/
sigma
:
1000
tcorrelations
:
sigma_t
:
200
...
...
@@ -175,3 +181,32 @@ controlvect:
#####################################################################
#####################################################################
#####################################################################
# Domain definition
domain
:
plugin
:
name
:
dummy
version
:
std
xmin
:
0
xmax
:
25000
nlon
:
30
ymin
:
0
ymax
:
20000
nlat
:
15
#####################################################################
#####################################################################
#####################################################################
#####################################################################
# Meteo definition
meteo
:
plugin
:
name
:
dummy
version
:
csv
dirmeteo
:
/home/eso/repos/CIF/data/dummy_gauss/
ficmeteo
:
meteo.csv
#####################################################################
#####################################################################
examples/config_dummy_postproc.yml
View file @
c5c03866
...
...
@@ -22,13 +22,14 @@
# Verbose level
# 1 = Basic information
# 2 = Debugging
verbose
:
1
verbose
:
2
# Log file (to be saved in $wordkir)
logfile
:
pyvar.logtest
# Execution directory
workdir
:
/home/chimereges/aberchet/CIF_dummy_test/
#workdir : /home/eso/repos/CIF/test/
workdir
:
/home/eso/tmp/CIFtest
# Initial date
# Use the following compatible format for the date:
...
...
@@ -57,8 +58,8 @@ mode:
plugin
:
name
:
post-proc
version
:
std
controlvect_fic
:
/home/
chimereges/aberchet
/CIF_dummy_test/controlvect_final.pickle
#
controlvect_fic: /home/
chimereges/aberchet/CIF_dummy_
test/obsoperator/fwd_-001/controlvect.pickle
#
controlvect_fic: /home/
eso/tmp
/CIF_dummy_test/controlvect_final.pickle
controlvect_fic
:
/home/
eso/tmp/CIF
test/obsoperator/fwd_-001/controlvect.pickle
#####################################################################
#####################################################################
...
...
@@ -73,7 +74,7 @@ model :
version
:
std
# H matrix
fic_pg
:
/home/
users/aberchet
/CIF/model_sources/dummy_gauss/Pasquill-Gifford.txt
fic_pg
:
/home/
eso/repos
/CIF/model_sources/dummy_gauss/Pasquill-Gifford.txt
#####################################################################
#####################################################################
...
...
@@ -90,7 +91,9 @@ measurements :
version
:
std
# File where to save data, if does not exist. Reads from there if exists
fic_monitor
:
/home/chimereges/aberchet/CIF_dummy_test/monitor_reference.nc
fic_monitor
:
# /home/chimereges/aberchet/CIF_dummy_test/monitor_reference.nc
/home/eso/tmp/CIFtest/monitor_reference.nc
dump_type
:
nc
species
:
# List of tracers to include in the monitor file
...
...
@@ -134,7 +137,7 @@ obsvect:
plugin
:
name
:
standard
version
:
std
fic_obsvect
:
/home/
chimereges/aberchet/CIF_dummy_
test/monitor_reference.nc
fic_obsvect
:
/home/
eso/tmp/CIF
test/monitor_reference.nc
dump_type
:
nc
#####################################################################
#####################################################################
...
...
@@ -175,12 +178,12 @@ controlvect:
errtype
:
max
err
:
1
period
:
'
1D'
dir
:
/home/
chimereges/aberchet/CIF_dummy_
test/controlvect/
dir
:
/home/
eso/tmp/CIF
test/controlvect/
fic
:
flx_real.txt
hcorrelations
:
landsea
:
False
dump_hcorr
:
True
dircorrel
:
/home/
chimereges/aberchet/CIF_dummy_
test/controlvect/
dircorrel
:
/home/
eso/tmp/CIF
test/controlvect/
sigma
:
100
tcorrelations
:
sigma_t
:
5
...
...
@@ -214,7 +217,7 @@ meteo :
plugin
:
name
:
dummy
version
:
csv
dirmeteo
:
/home/
users/aberchet
/CIF/data/dummy_gauss/
dirmeteo
:
/home/
eso/repos
/CIF/data/dummy_gauss/
ficmeteo
:
meteo.csv
#####################################################################
#####################################################################
...
...
examples/config_lmdz_variational.yml
View file @
c5c03866
...
...
@@ -30,8 +30,7 @@ logfile: pyvar.logtest
# Execution directory
#workdir : /home/satellites13/msaunois/INVERSION/GCP_2018/run_00_18_inca_base_network/
#workdir : /home/satellites13/aberchet/msaunois/
workdir
:
/home/chimereges/aberchet/GCP_congrad_obs/
workdir
:
/home/eso/tmp/CIFtest/
# Initial date
# Use the following compatible format for the date:
...
...
@@ -70,31 +69,7 @@ mode:
plugin
:
name
:
4dvar
version
:
std
minimizer
:
plugin
:
name
:
congrad
version
:
std
simulator
:
plugin
:
name
:
gausscost
version
:
std
reload_from_previous
:
True
maxiter
:
20
epsg
:
0.02
df1
:
0.01
chi_min
:
chi_max
:
#mode:
# plugin:
# name: adj-tl_test
# version: std
# increments: 0.2
# incrmode: cst
# testspace: control
# reload_results: True
#####################################################################
#####################################################################
controlvect_fic
:
/home/eso/tmp/CIFtest/obsoperator/adj_0011/controlvect.pickle
#####################################################################
#####################################################################
...
...
@@ -401,23 +376,18 @@ meteo:
##################
# Parameters below are not yet included in PYVAR
#
#
## surface geopotential file
#ficgeopot : null
#
## first guess path of the file if wanted
#prevanal: null
## LMDz precomputed (1) or not (0)
#precalc : 0
## perturb predefined prior/concentrations
#perturbdir : null
## seed for random number generation
#seed : 3
## diagnostics (0=none; 1=1D(time); 2=2D(lev,time); 3=4D(lat,lon,lev,time) )
#diag : 0
#
#
#
#
#
# surface geopotential file
ficgeopot
:
null
# first guess path of the file if wanted
prevanal
:
null
# LMDz precomputed (1) or not (0)
precalc
:
0
# perturb predefined prior/concentrations
perturbdir
:
null
# seed for random number generation
seed
:
3
# diagnostics (0=none; 1=1D(time); 2=2D(lev,time); 3=4D(lat,lon,lev,time) )
diag
:
0
model_sources/DISPERSION_gch/makefile
View file @
c5c03866
...
...
@@ -23,11 +23,13 @@ L_BIBIO = -lbibio
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Option de compilation FORTRAN
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OPTIMTRU90
=
-cpp
-O3
-DCPP_PARA
-assume
byterecl
-r8
-DNC_DOUBLE
-assume
buffered_io
#-check all -traceback
INCLUDE
=
-I
$(LIBF)
/grid
-I
$(LIBF)
/bibio
-I
.
-I
$(LIBF)
/dyn3d
-I
/usr/local/include
-I
$(LIBF)
/phylmd
-I
${LOCAL_DIR}
/libo
-module
$(LIBO)
-I
$(LIBO)
#OPTIMTRU90 = -cpp -O3 -DCPP_PARA -assume byterecl -r8 -DNC_DOUBLE -assume buffered_io #-check all -traceback
OPTIMTRU90
=
-Wfatal-errors
-cpp
-O3
-DCPP_PARA
-fdefault-real-8
-DNC_DOUBLE
-fcray-pointer
#-check all -traceback
INCLUDE
=
-I
$(LIBF)
/grid
-I
$(LIBF)
/bibio
-I
.
-I
$(LIBF)
/dyn3d
-I
/usr/local/include
-I
$(LIBF)
/phylmd
-I
${LOCAL_DIR}
/libo
-J
$(LIBO)
-I
$(LIBO)
F90
=
mpif90
COMPTRU90
=
$(F90)
$(OPTIMTRU90)
$(INCLUDE)
-c
LINK
=
$(F90)
-cpp
-O
-DCPP_PARA
-DUSE_VT
-align
all
-assume
byterecl
-r8
-DNC_DOUBLE
-assume
buffered_io
-extend_source
-I
${LOCAL_DIR}
/libo
-module
$(LIBO)
-I
$(LIBO)
#LINK = $(F90) -cpp -O -DCPP_PARA -DUSE_VT -align all -assume byterecl -r8 -DNC_DOUBLE -assume buffered_io -extend_source -I${LOCAL_DIR}/libo -module $(LIBO) -I $(LIBO)
LINK
=
$(F90)
-cpp
-O
-DCPP_PARA
-DUSE_VT
-fdefault-real-8
-DNC_DOUBLE
-I
${LOCAL_DIR}
/libo
-J
$(LIBO)
-I
$(LIBO)
AR
=
ar
#OPTION_LINK = -L/usr/local/lib -lnetcdff -lnetcdf -I/usr/local/include
OPTION_LINK
=
-lnetcdff
-lnetcdf
...
...
pycif/config/__init__.py
View file @
c5c03866
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""config sub-module
This module handles the configuration of the pyCIF runs. It loads a Yaml
configuration file including all paramaters necessary to setting up pyCIF.
"""
import
yaml
import
os
import
pycif.utils.check
as
check
import
pycif.utils.dates
as
dates
def
load
(
def_file
):
"""Generates a dictionary including all pyCIF parameters
Args:
def_file (string) : Path to the definition file
Handles both absolute and relative paths
Returns:
config_dict (dictionary): Dictionary populated with all pyCIF parameters
"""
fic
=
os
.
path
.
abspath
(
def_file
)
try
:
with
open
(
fic
,
'r'
)
as
f
:
config_dict
=
yaml
.
load
(
f
)
config_dict
[
'def_file'
]
=
fic
# Converting dates to datetime if necessary
config_dict
[
'datei'
]
=
dates
.
date2datetime
(
config_dict
[
'datei'
])
config_dict
[
'datef'
]
=
dates
.
date2datetime
(
config_dict
[
'datef'
])
return
config_dict
except
IOError
as
e
:
print
"Couldn't find config file"
,
fic
print
"Please check directories"
raise
e
except
yaml
.
scanner
.
ScannerError
as
e
:
print
"Error in the syntax of config file"
,
fic
raise
e
def
config_verbose
(
config_dict
):
"""Prints out main input parameters for pyCIF
"""
verbose_txt
=
[
"pyCIF has been initialized with the following parameters:"
,
"Yaml configuration file: {}"
.
format
(
config_dict
[
'def_file'
]),
"Log file: {}"
.
format
(
config_dict
[
'logfile'
]),
"Start date: {}"
.
format
(
config_dict
[
'datei'
]),
"End date: {}"
.
format
(
config_dict
[
'datef'
]),
"Working directory: {}"
.
format
(
config_dict
[
'workdir'
]),
]
map
(
lambda
v
:
check
.
verbose
(
v
),
verbose_txt
)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""config sub-module
This module handles the configuration of the pyCIF runs. It loads a Yaml
configuration file including all paramaters necessary to setting up pyCIF.
"""
import
yaml
import
os
import
pycif.utils.check
as
check
import
pycif.utils.dates
as
dates
def
load
(
def_file
):
"""Generates a dictionary including all pyCIF parameters
Args:
def_file (string) : Path to the definition file
Handles both absolute and relative paths
Returns:
config_dict (dictionary): Dictionary populated with all pyCIF parameters
"""
fic
=
os
.
path
.
abspath
(
def_file
)
try
:
with
open
(
fic
,
'r'
)
as
f
:
config_dict
=
yaml
.
load
(
f
)
config_dict
[
'def_file'
]
=
fic
# Converting dates to datetime if necessary
config_dict
[
'datei'
]
=
dates
.
date2datetime
(
config_dict
[
'datei'
])
config_dict
[
'datef'
]
=
dates
.
date2datetime
(
config_dict
[
'datef'
])
return
config_dict
except
IOError
as
e
:
print
"Couldn't find config file"
,
fic
print
"Please check directories"
raise
e
except
yaml
.
scanner
.
ScannerError
as
e
:
print
"Error in the syntax of config file"
,
fic
raise
e
def
config_verbose
(
config_dict
):
"""Prints out main input parameters for pyCIF
"""
verbose_txt
=
[
"pyCIF has been initialized with the following parameters:"
,
"Yaml configuration file: {}"
.
format
(
config_dict
[
'def_file'
]),
"Log file: {}"
.
format
(
config_dict
[
'logfile'
]),
"Start date: {}"
.
format
(
config_dict
[
'datei'
]),
"End date: {}"
.
format
(
config_dict
[
'datef'
]),
"Working directory: {}"
.
format
(
config_dict
[
'workdir'
]),
]
map
(
lambda
v
:
check
.
verbose
(
v
),
verbose_txt
)
pycif/plugins/models/flexpart/__init__.py
0 → 100644
View file @
c5c03866
pycif/plugins/models/register.py
View file @
c5c03866
...
...
@@ -4,8 +4,10 @@
import
lmdz
import
chimere
import
dummy
import
flexpart
from
pycif.utils.classes.models
import
Model
Model
.
register_plugin
(
'LMDZ'
,
'std'
,
lmdz
)
Model
.
register_plugin
(
'CHIMERE'
,
'std'
,
chimere
)
Model
.
register_plugin
(
'FLEXPART'
,
'std'
,
flexpart
)
Model
.
register_plugin
(
'dummy'
,
'std'
,
dummy
)
pycif/utils/classes/baseclass.py
View file @
c5c03866
...
...
@@ -238,6 +238,15 @@ class Plugin(object):
importlib
.
import_module
(
subclass
[
0
],
'pycif.utils.classes'
),
subclass
[
1
])
@
classmethod
def
print_registered
(
cls
):
"""Print all registered plugins.
"""
print
cls
.
registered
@
classmethod
def
load_registered
(
cls
,
name
,
version
,
plg_type
,
plg_orig
=
None
):
"""Get a sub-class instance of a registered plugin.
...
...
pycif/utils/classes/setup.py
View file @
c5c03866
...
...
@@ -63,7 +63,7 @@ class Setup(Plugin):
try
:
with
open
(
fic
,
'r'
)
as
f
:
config_dict
=
yaml
.
load
(
f
)
config_dict
=
yaml
.
load
(
f
,
Loader
=
yaml
.
FullLoader
)
config_dict
[
'def_file'
]
=
fic
...
...
pycif/utils/datastores/dump.py
View file @
c5c03866
...
...
@@ -6,6 +6,7 @@ import pycif.utils.check as check
import
xarray
as
xr
import
os
import
numpy
as
np
import
pdb
def
dump_datastore
(
datastore
,
...
...
@@ -159,6 +160,11 @@ def read_datastore(fic_monitor,
df
=
ds
.
to_dataframe
()
#df.index = df.index.to_frame()['index']
setattr
(
df
,
'nc_attributes'
,
ds
.
attrs
)
# df.index = df.index.to_frame()['index']
# pdb.set_trace()
# setattr(df, 'nc_attributes', ds.attrs)
# df.loc[:,'nc_attributes'] = ds.attrs
elif
dump_type
==
'csv'
:
# Reading the file by chunks in case it is a very big file
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment