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
NearRealTimeCTDAS
CTDAS
Commits
09e7dfe1
Commit
09e7dfe1
authored
Mar 28, 2013
by
Peters, Wouter
Browse files
rolled back some changes to interface of calls
parent
78370143
Changes
1
Hide whitespace changes
Inline
Side-by-side
da/ct/obs.py
View file @
09e7dfe1
...
...
@@ -26,15 +26,15 @@ from da.baseclasses.obs import Observation
class
CtObservations
(
Observation
):
""" an object that holds data + methods and attributes needed to manipulate mixing ratio values """
def
Initialize
(
self
,
start
,
end
,
params
):
self
.
startdate
=
start
self
.
enddate
=
end
def
Initialize
(
self
):
self
.
startdate
=
self
.
DaCycle
[
'time.sample.
start
'
]
self
.
enddate
=
self
.
DaCycle
[
'time.sample.
end
'
]
sfname
=
params
[
'obs.input.fname'
]
sfname
=
self
.
DaCycle
.
DaSystem
[
'obs.input.fname'
]
if
sfname
.
endswith
(
'.nc'
):
filename
=
os
.
path
.
join
(
params
[
'obs.input.dir'
],
sfname
)
filename
=
os
.
path
.
join
(
self
.
DaCycle
.
DaSystem
[
'obs.input.dir'
],
sfname
)
else
:
filename
=
os
.
path
.
join
(
params
[
'obs.input.dir'
],
sfname
+
'.'
+
self
.
startdate
.
strftime
(
'%Y%m%d'
)
+
'.nc'
)
filename
=
os
.
path
.
join
(
self
.
DaCycle
.
DaSystem
[
'obs.input.dir'
],
sfname
+
'.'
+
self
.
startdate
.
strftime
(
'%Y%m%d'
)
+
'.nc'
)
if
not
os
.
path
.
exists
(
filename
):
msg
=
'Could not find the required observation input file (%s) '
%
filename
...
...
@@ -136,14 +136,14 @@ class CtObservations(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
)
...
...
@@ -241,7 +241,7 @@ class CtObservations(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.
...
...
@@ -253,7 +253,7 @@ class CtObservations(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
...
...
@@ -314,14 +314,14 @@ class CtObservations(Observation):
self
.
SiteInfo
=
SiteInfo
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
)
...
...
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