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
5727ebc9
Commit
5727ebc9
authored
14 years ago
by
Peters, Wouter
Browse files
Options
Downloads
Patches
Plain Diff
minor changes to make it work using the settings taken from the da.rc file
parent
fb54246f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tm5_tools.py
+48
-45
48 additions, 45 deletions
tm5_tools.py
tools_da.py
+2
-2
2 additions, 2 deletions
tools_da.py
with
50 additions
and
47 deletions
tm5_tools.py
+
48
−
45
View file @
5727ebc9
...
...
@@ -243,6 +243,40 @@ class TM5():
os
.
chdir
(
cwd
)
def
SaveData
(
self
):
"""
Write the TM5 recovery data for the next cycle
"""
sourcedir
=
os
.
path
.
join
(
self
.
tm_settings
[
'
outputdir
'
])
targetdir
=
os
.
path
.
join
(
self
.
tm_settings
[
'
savedir
'
])
filter
=
[
'
save_%s
'
%
self
.
tm_settings
[
'
time.final
'
].
strftime
(
'
%Y%m%d
'
)]
msg
=
"
Performing a full backup of TM5 save data
"
;
logging
.
debug
(
msg
)
msg
=
"
from directory: %s
"
%
sourcedir
;
logging
.
debug
(
msg
)
msg
=
"
to directory: %s
"
%
targetdir
;
logging
.
debug
(
msg
)
msg
=
"
with filter: %s
"
%
filter
;
logging
.
debug
(
msg
)
for
file
in
os
.
listdir
(
sourcedir
):
file
=
os
.
path
.
join
(
sourcedir
,
file
)
if
os
.
path
.
isdir
(
file
):
# skip dirs
skip
=
True
elif
filter
==
[]:
# copy all
skip
=
False
else
:
# check filter
skip
=
True
# default skip
for
f
in
filter
:
if
f
in
file
:
skip
=
False
# unless in filter
break
if
skip
:
msg
=
"
[skip] .... %s
"
%
file
;
logging
.
debug
(
msg
)
continue
msg
=
"
[copy] .... %s
"
%
file
;
logging
.
debug
(
msg
)
dummy
=
shutil
.
copy
(
file
,
file
.
replace
(
sourcedir
,
targetdir
)
)
################### End Class TM5 ###################
...
...
@@ -303,40 +337,6 @@ def PrepareExe(rc_da_shell):
return
Tm5Model
def
WriteSaveData
(
rc_da_shell
):
"""
Write the TM5 recovery data for the next DA cycle
"""
sourcedir
=
os
.
path
.
join
(
rc_da_shell
[
'
dir.output
'
])
targetdir
=
os
.
path
.
join
(
rc_da_shell
[
'
dir.save
'
])
filter
=
[
'
save_%s
'
%
rc_da_shell
[
'
enddate
'
].
strftime
(
'
%Y%m%d
'
)]
msg
=
"
Performing a full backup of TM5 save data
"
;
logging
.
debug
(
msg
)
msg
=
"
from directory: %s
"
%
sourcedir
;
logging
.
debug
(
msg
)
msg
=
"
to directory: %s
"
%
targetdir
;
logging
.
debug
(
msg
)
msg
=
"
with filter: %s
"
%
filter
;
logging
.
debug
(
msg
)
for
file
in
os
.
listdir
(
sourcedir
):
file
=
os
.
path
.
join
(
sourcedir
,
file
)
if
os
.
path
.
isdir
(
file
):
# skip dirs
skip
=
True
elif
filter
==
[]:
# copy all
skip
=
False
else
:
# check filter
skip
=
True
# default skip
for
f
in
filter
:
if
f
in
file
:
skip
=
False
# unless in filter
break
if
skip
:
msg
=
"
[skip] .... %s
"
%
file
;
logging
.
debug
(
msg
)
continue
msg
=
"
[copy] .... %s
"
%
file
;
logging
.
debug
(
msg
)
dummy
=
shutil
.
copy
(
file
,
file
.
replace
(
sourcedir
,
targetdir
)
)
if
__name__
==
"
__main__
"
:
...
...
@@ -344,21 +344,24 @@ if __name__ == "__main__":
import
sys
import
logging
#tm=TM5('/Users/peters/Modeling/TM5/tutorial.rc')
#tm.WriteRc()
#tm.WriteRunRc()
#tm.Run()
tm
=
TM5
(
'
/Users/peters/Modeling/TM5/ct_new.rc
'
)
tm
.
WriteRc
()
tm
.
WriteRunRc
()
tm
.
Run
()
tm
.
SaveData
()
sys
.
exit
(
0
)
#
sys.exit(0
)
#
dasrc=rc.read('da.rc'
)
dasrc
=
rc
.
read
(
'
da.rc
'
)
#dasrc['dir.save']=os.path.join(dasrc['dir.da_run'],'save')
#dasrc['dir.output']=os.path.join(dasrc['dir.da_run'],'output')
#dasrc['dir.exec']=os.path.join(dasrc['dir.da_run'],'exec')
dasrc
[
'
dir.save
'
]
=
os
.
path
.
join
(
dasrc
[
'
dir.da_run
'
],
'
save
'
)
dasrc
[
'
dir.output
'
]
=
os
.
path
.
join
(
dasrc
[
'
dir.da_run
'
],
'
output
'
)
dasrc
[
'
dir.exec
'
]
=
os
.
path
.
join
(
dasrc
[
'
dir.da_run
'
],
'
exec
'
)
#tm = PrepareExe(dasrc
)
#tm.Run()
#tm.SaveData(
)
tm
=
PrepareExe
(
dasrc
)
tm
.
Run
()
...
...
This diff is collapsed.
Click to expand it.
tools_da.py
+
2
−
2
View file @
5727ebc9
...
...
@@ -323,11 +323,11 @@ def RunForecastModel(rc_da_shell):
# Prepare everything needed to run the forward model
rc_fcmodel
=
model
.
PrepareExe
(
rc_da_shell
)
executable
=
model
.
PrepareExe
(
rc_da_shell
)
# Run the forward model
status
=
model
.
StartExe
(
rc_da_shell
,
rc_fcmodel
)
executable
.
Run
(
)
########################################### RETURN CONTROL TO DA SHELL #########################################
...
...
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