Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CTDAS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tsurata, Aki
CTDAS
Commits
82685ae7
Commit
82685ae7
authored
12 years ago
by
Peters, Wouter
Browse files
Options
Downloads
Patches
Plain Diff
merged r1186 and r1218 into new version that works under current trunk
parent
9ad0f3f9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
da/ct/obspack_geocarbon.py
+13
-12
13 additions, 12 deletions
da/ct/obspack_geocarbon.py
with
13 additions
and
12 deletions
da/ct/obspack_geocarbon.py
+
13
−
12
View file @
82685ae7
...
...
@@ -24,13 +24,13 @@ from da.baseclasses.obs import Observation
class
ObsPackObservations
(
Observation
):
"""
an object that holds data + methods and attributes needed to manipulate mixing ratio values
"""
def
Initialize
(
self
,
start
,
end
,
params
):
def
Initialize
(
self
):
self
.
startdate
=
start
self
.
enddate
=
end
self
.
startdate
=
self
.
DaCycle
[
'
time.sample.
start
'
]
self
.
enddate
=
self
.
DaCycle
[
'
time.sample.
end
'
]
op_id
=
params
[
'
obspack.input.id
'
]
op_dir
=
params
[
'
obspack.input.dir
'
]
op_id
=
self
.
DaCycle
.
DaSystem
[
'
obspack.input.id
'
]
op_dir
=
self
.
DaCycle
.
DaSystem
[
'
obspack.input.dir
'
]
if
not
os
.
path
.
exists
(
op_dir
):
msg
=
'
Could not find the required ObsPack distribution (%s)
'
%
op_dir
...
...
@@ -67,7 +67,7 @@ class ObsPackObservations(Observation):
items
=
line
.
split
()
#ncfile, lab , start_date, stop_date, data_comparison = items[0:5]
ncfile
,
lab
,
start_date
,
stop_date
,
data_comparison
=
line
[:
105
].
split
()
ncfile
,
lab
,
start_date
,
stop_date
,
data_comparison
=
line
[:
105
].
split
()
ncfilelist
+=
[
ncfile
]
...
...
@@ -133,6 +133,7 @@ class ObsPackObservations(Observation):
for
idx
,
val
in
zip
(
ids
,
simulated
):
if
idx
in
obs_ids
:
index
=
obs_ids
.
index
(
idx
)
self
.
datalist
[
index
].
simulated
=
val
# in mol/mol
else
:
missing_samples
.
append
(
idx
)
...
...
@@ -143,14 +144,14 @@ class ObsPackObservations(Observation):
logging
.
debug
(
"
Added %d simulated values to the Data list
"
%
(
len
(
ids
)
-
len
(
missing_samples
)))
def
write_sample_info
(
self
,
dirinput
,
timestamp
):
def
write_sample_info
(
self
):
"""
Write the information needed by the observation operator to a file. Return the filename that was written for later use
"""
import
da.tools.io4
as
io
obsinputfile
=
os
.
path
.
join
(
dirinput
,
'
observations_%s.nc
'
%
time
stamp
)
obsinputfile
=
os
.
path
.
join
(
self
.
DaCycle
[
'
dir
.
input
'
]
,
'
observations_%s.nc
'
%
self
.
DaCycle
[
'
time.sample.
stamp
'
]
)
f
=
io
.
CT_CDF
(
obsinputfile
,
method
=
'
create
'
)
logging
.
debug
(
'
Creating new observations file for ObservationOperator (%s)
'
%
obsinputfile
)
...
...
@@ -252,7 +253,7 @@ class ObsPackObservations(Observation):
return
obsinputfile
def
add_model_data_mismatch
(
self
,
filename
):
def
add_model_data_mismatch
(
self
):
"""
Get the model-data mismatch values for this cycle.
...
...
@@ -264,7 +265,7 @@ class ObsPackObservations(Observation):
"""
import
da.tools.rc
as
rc
filename
=
self
.
DaCycle
.
DaSystem
[
'
obs.sites.rc
'
]
if
not
os
.
path
.
exists
(
filename
):
msg
=
'
Could not find the required sites.rc input file (%s)
'
%
filename
...
...
@@ -359,14 +360,14 @@ class ObsPackObservations(Observation):
logging
.
debug
(
"
Added Model Data Mismatch to all samples
"
)
def
write_obs_to_file
(
self
,
outdir
,
timestamp
,
filenam
=
"
oldstyle
"
):
def
write_obs_to_file
(
self
,
filenam
=
"
oldstyle
"
):
"""
Write selected information contained in the Observation object to a file.
"""
import
da.tools.io4
as
io
outfile
=
os
.
path
.
join
(
outdir
,
'
sampleinfo_%s__%s.nc
'
%
(
time
stamp
,
filenam
))
outfile
=
os
.
path
.
join
(
self
.
DaCycle
[
'
dir.output
'
]
,
'
sampleinfo_%s__%s.nc
'
%
(
self
.
DaCycle
[
'
time.sample.
stamp
'
]
,
filenam
))
f
=
io
.
CT_CDF
(
outfile
,
method
=
'
create
'
)
logging
.
debug
(
'
Creating new Sample output file for postprocessing (%s)
'
%
outfile
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment