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
Package registry
Container registry
Model registry
Operate
Terraform modules
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
NearRealTimeCTDAS
CTDAS
Commits
a77fec9c
Commit
a77fec9c
authored
11 years ago
by
Ingrid Luijkx
Browse files
Options
Downloads
Patches
Plain Diff
Added option to start with restart file in the first cycle, instead of initco2 file.
parent
0a421b90
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
da/tm5/observationoperator.py
+18
-4
18 additions, 4 deletions
da/tm5/observationoperator.py
with
18 additions
and
4 deletions
da/tm5/observationoperator.py
+
18
−
4
View file @
a77fec9c
...
...
@@ -132,6 +132,16 @@ class TM5ObservationOperator(ObservationOperator):
newrcfilename
=
os
.
path
.
join
(
self
.
tm_settings
[
'
rundir
'
],
self
.
tm_settings
[
'
install.rc
'
])
#Use a TM5 restart file in the first cycle (instead of init file). Used now for the CO project.
if
self
.
dacycle
.
has_key
(
'
da.obsoperator.restartfileinfirstcycle
'
):
restartfilename
=
self
.
dacycle
[
'
da.obsoperator.restartfileinfirstcycle
'
]
sourcedir
=
self
.
dacycle
[
'
dir.exec
'
]
targetdir
=
self
.
tm_settings
[
self
.
savedirkey
]
create_dirs
(
targetdir
)
sourcefile
=
os
.
path
.
join
(
sourcedir
,
restartfilename
)
shutil
.
copy
(
sourcefile
,
sourcefile
.
replace
(
sourcedir
,
targetdir
))
logging
.
debug
(
'
Copied TM5 restart file to TM5 restart directory for first cycle: %s
'
%
sourcefile
)
# Replace the rc filename for TM5 with the newly created one in the new run directory
...
...
@@ -214,8 +224,12 @@ class TM5ObservationOperator(ObservationOperator):
new_items
[
self
.
istartkey
]
=
self
.
restartvalue
logging
.
debug
(
'
Resetting TM5 to perform restart
'
)
else
:
new_items
[
self
.
istartkey
]
=
self
.
coldstartvalue
# if not, start TM5 'cold'
logging
.
debug
(
'
Resetting TM5 to perform cold start
'
)
if
not
self
.
dacycle
.
has_key
(
'
da.obsoperator.restartfileinfirstcycle
'
):
new_items
[
self
.
istartkey
]
=
self
.
coldstartvalue
# if not, start TM5 'cold'
logging
.
debug
(
'
Resetting TM5 to perform cold start
'
)
else
:
new_items
[
self
.
istartkey
]
=
self
.
restartvalue
# If restart file is specified, start TM5 with initial restartfile
logging
.
debug
(
'
Resetting TM5 to start with restart file: %s
'
%
self
.
dacycle
[
'
da.obsoperator.restartfileinfirstcycle
'
])
if
self
.
dacycle
[
'
time.sample.window
'
]
!=
0
:
# If this is a restart from a previous time step within the filter lag, the TM5 model should do a restart
new_items
[
self
.
istartkey
]
=
self
.
restartvalue
...
...
@@ -361,8 +375,8 @@ class TM5ObservationOperator(ObservationOperator):
if
not
os
.
path
.
exists
(
obsfile
):
msg
=
"
The specified obs input file for the TM5 model to read from does not exist (%s), exiting...
"
%
obsfile
logging
.
error
(
msg
)
raise
IOError
,
msg
if
not
self
.
dacycle
.
has_key
(
'
forward.savestate.dir
'
):
raise
IOError
,
msg
for
n
in
range
(
int
(
self
.
dacycle
[
'
da.optimizer.nmembers
'
])):
paramfile
=
'
parameters.%03d.nc
'
%
n
...
...
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