Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DART-WRF
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
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DataAssimilation
DART-WRF
Commits
1690f8d5
Commit
1690f8d5
authored
2 years ago
by
lkugler
Browse files
Options
Downloads
Patches
Plain Diff
update to new workflows
parent
26de0679
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
free_forecast.py
+50
-56
50 additions, 56 deletions
free_forecast.py
with
50 additions
and
56 deletions
free_forecast.py
+
50
−
56
View file @
1690f8d5
...
@@ -5,53 +5,71 @@ running the forecast model without assimilation
...
@@ -5,53 +5,71 @@ running the forecast model without assimilation
import
os
,
sys
,
shutil
import
os
,
sys
,
shutil
import
datetime
as
dt
import
datetime
as
dt
import
pandas
as
pd
import
pandas
as
pd
from
slurmpy
import
Slurm
from
dartwrf.workflows
import
WorkFlows
from
config.cfg
import
exp
from
config.clusters
import
cluster
from
dartwrf.utils
import
script_to_str
,
symlink
from
cycled_exp
import
*
w
=
WorkFlows
(
exp_config
=
'
cfg.py
'
,
server_config
=
'
srvx1.py
'
)
################################
print
(
'
starting
'
)
cluster
.
setup
()
id
=
None
id
=
None
if
False
:
#
True: # is
_nature
if
False
:
#
generate
_nature
begin
=
dt
.
datetime
(
2008
,
7
,
30
,
7
)
begin
=
dt
.
datetime
(
2008
,
7
,
30
,
7
)
id
=
prepare_WRFrundir
(
begin
)
# create initial conditions
id
=
w
.
prepare_WRFrundir
(
begin
)
# create initial conditions
id
=
run_ideal
(
depends_on
=
id
)
id
=
w
.
run_ideal
(
depends_on
=
id
)
#id = wrfinput_insert_wbubble(perturb=False, depends_on=id)
#id = wrfinput_insert_wbubble(perturb=False, depends_on=id)
end
=
dt
.
datetime
(
2008
,
7
,
30
,
12
)
end
=
dt
.
datetime
(
2008
,
7
,
30
,
12
)
id
=
run_ENS
(
begin
=
begin
,
end
=
end
,
id
=
w
.
run_ENS
(
begin
=
begin
,
end
=
end
,
input_is_restart
=
False
,
input_is_restart
=
False
,
output_restart_interval
=
(
end
-
begin
).
total_seconds
()
/
60
,
output_restart_interval
=
(
end
-
begin
).
total_seconds
()
/
60
,
depends_on
=
id
)
depends_on
=
id
)
# id = create_satimages(begin, depends_on=id)
# id = create_satimages(begin, depends_on=id)
if
False
:
# if free run (all inits)
if
False
:
# to continue a nature after spinup
start
=
dt
.
datetime
(
2008
,
7
,
30
,
7
)
end
=
dt
.
datetime
(
2008
,
7
,
30
,
18
)
id
=
w
.
prepare_WRFrundir
(
start
)
# create initial conditions
id
=
w
.
run_ideal
(
depends_on
=
id
)
prior_path_exp
=
'
/gpfs/data/fs71386/lkugler/sim_archive/exp_v1.19_P5_nat2
'
# cluster.archivedir
prior_init_time
=
dt
.
datetime
(
2008
,
7
,
30
,
7
)
prior_valid_time
=
dt
.
datetime
(
2008
,
7
,
30
,
12
)
id
=
prepare_IC_from_prior
(
prior_path_exp
,
prior_init_time
,
prior_valid_time
,
new_start_time
=
start
,
# <---------- to start again after spinup
depends_on
=
id
)
id
=
w
.
run_ENS
(
begin
=
start
,
end
=
end
,
input_is_restart
=
False
,
output_restart_interval
=
(
end
-
start
).
total_seconds
()
/
60
,
#output_restart_interval=9999,
depends_on
=
id
)
id
=
create_satimages
(
start
,
depends_on
=
id
)
verify
(
depends_on
=
id
)
if
True
:
# do a free run (all inits)
begin
=
dt
.
datetime
(
2008
,
7
,
30
,
7
)
begin
=
dt
.
datetime
(
2008
,
7
,
30
,
7
)
id
=
prepare_WRFrundir
(
begin
)
# create initial conditions
id
=
w
.
prepare_WRFrundir
(
begin
)
# create initial conditions
id
=
run_ideal
(
depends_on
=
id
)
id
=
w
.
run_ideal
(
depends_on
=
id
)
#id = wrfinput_insert_wbubble(perturb=True, depends_on=id)
#id = wrfinput_insert_wbubble(perturb=True, depends_on=id)
restarts
=
pd
.
date_range
(
start
=
dt
.
datetime
(
2008
,
7
,
30
,
10
),
#
restarts = pd.date_range(start=dt.datetime(2008, 7, 30, 10),
end
=
dt
.
datetime
(
2008
,
7
,
30
,
12
),
#
end=dt.datetime(2008, 7, 30, 12),
freq
=
dt
.
timedelta
(
minutes
=
60
))
#
freq=dt.timedelta(minutes=60))
#
restarts = [dt.datetime(2008, 7, 30, 12, 30)]
restarts
=
[
dt
.
datetime
(
2008
,
7
,
30
,
12
,
30
)]
input_is_restart
=
False
input_is_restart
=
False
time
=
begin
time
=
begin
last_init
=
dt
.
datetime
(
2008
,
7
,
30
,
9
)
# dummy value
last_init
=
dt
.
datetime
(
2008
,
7
,
30
,
9
)
# dummy value
for
i
,
next_restart
in
enumerate
(
restarts
):
for
i
,
next_restart
in
enumerate
(
restarts
):
print
(
'
run_WRF from
'
,
time
,
'
to
'
,
next_restart
)
print
(
'
run_WRF from
'
,
time
,
'
to
'
,
next_restart
)
id
=
run_ENS
(
begin
=
time
,
end
=
next_restart
,
id
=
w
.
run_ENS
(
begin
=
time
,
end
=
next_restart
,
input_is_restart
=
input_is_restart
,
input_is_restart
=
input_is_restart
,
output_restart_interval
=
(
next_restart
-
time
).
total_seconds
()
/
60
,
output_restart_interval
=
(
next_restart
-
time
).
total_seconds
()
/
60
,
#output_restart_interval=720,
#output_restart_interval=720,
...
@@ -70,7 +88,7 @@ if False: # if free run (all inits)
...
@@ -70,7 +88,7 @@ if False: # if free run (all inits)
# free run, no restart files anymore
# free run, no restart files anymore
end
=
dt
.
datetime
(
2008
,
7
,
30
,
18
)
end
=
dt
.
datetime
(
2008
,
7
,
30
,
18
)
print
(
'
run WRF from
'
,
time
,
'
until
'
,
end
)
print
(
'
run WRF from
'
,
time
,
'
until
'
,
end
)
id
=
run_ENS
(
begin
=
time
,
end
=
end
,
id
=
w
.
run_ENS
(
begin
=
time
,
end
=
end
,
input_is_restart
=
input_is_restart
,
input_is_restart
=
input_is_restart
,
#output_restart_interval=(next_restart-time).total_seconds()/60,
#output_restart_interval=(next_restart-time).total_seconds()/60,
output_restart_interval
=
9999
,
output_restart_interval
=
9999
,
...
@@ -80,11 +98,11 @@ if False: # if free run (all inits)
...
@@ -80,11 +98,11 @@ if False: # if free run (all inits)
id
=
create_satimages
(
time
,
depends_on
=
id
)
id
=
create_satimages
(
time
,
depends_on
=
id
)
verify
(
depends_on
=
id
)
verify
(
depends_on
=
id
)
if
False
:
# continu
ation of
free run
if
False
:
#
to
continu
e a
free run
start
=
dt
.
datetime
(
2008
,
7
,
30
,
7
)
start
=
dt
.
datetime
(
2008
,
7
,
30
,
7
)
end
=
dt
.
datetime
(
2008
,
7
,
30
,
10
)
end
=
dt
.
datetime
(
2008
,
7
,
30
,
10
)
id
=
prepare_WRFrundir
(
start
)
# create initial conditions
id
=
w
.
prepare_WRFrundir
(
start
)
# create initial conditions
prior_path_exp
=
'
/gpfs/data/fs71386/lkugler/sim_archive/exp_v1.19_P5_noDA
'
# cluster.archivedir
prior_path_exp
=
'
/gpfs/data/fs71386/lkugler/sim_archive/exp_v1.19_P5_noDA
'
# cluster.archivedir
prior_init_time
=
dt
.
datetime
(
2008
,
7
,
30
,
11
)
prior_init_time
=
dt
.
datetime
(
2008
,
7
,
30
,
11
)
...
@@ -92,7 +110,7 @@ if False: # continuation of free run
...
@@ -92,7 +110,7 @@ if False: # continuation of free run
id
=
prepare_IC_from_prior
(
prior_path_exp
,
prior_init_time
,
prior_valid_time
,
depends_on
=
id
)
id
=
prepare_IC_from_prior
(
prior_path_exp
,
prior_init_time
,
prior_valid_time
,
depends_on
=
id
)
id
=
run_ENS
(
begin
=
start
,
end
=
end
,
id
=
w
.
run_ENS
(
begin
=
start
,
end
=
end
,
input_is_restart
=
True
,
input_is_restart
=
True
,
output_restart_interval
=
(
end
-
start
).
total_seconds
()
/
60
,
output_restart_interval
=
(
end
-
start
).
total_seconds
()
/
60
,
#output_restart_interval=9999,
#output_restart_interval=9999,
...
@@ -101,25 +119,25 @@ if False: # continuation of free run
...
@@ -101,25 +119,25 @@ if False: # continuation of free run
id
=
create_satimages
(
start
,
depends_on
=
id
)
id
=
create_satimages
(
start
,
depends_on
=
id
)
verify
(
depends_on
=
id
)
verify
(
depends_on
=
id
)
if
Tru
e
:
# continu
ation of
free run after spinup
if
Fals
e
:
#
to
continu
e a
free run after spinup
start
=
dt
.
datetime
(
2008
,
7
,
30
,
13
,
30
)
start
=
dt
.
datetime
(
2008
,
7
,
30
,
13
,
30
)
end
=
dt
.
datetime
(
2008
,
7
,
30
,
14
)
end
=
dt
.
datetime
(
2008
,
7
,
30
,
14
)
id
=
prepare_WRFrundir
(
start
)
# create initial conditions
id
=
w
.
prepare_WRFrundir
(
start
)
# create initial conditions
# id = run_ideal(depends_on=id)
# id =
w.
run_ideal(depends_on=id)
prior_path_exp
=
'
/jetfs/home/lkugler/data/sim_archive/exp_v1.19_P2_noDA
'
# cluster.archivedir
prior_path_exp
=
'
/jetfs/home/lkugler/data/sim_archive/exp_v1.19_P2_noDA
'
# cluster.archivedir
prior_init_time
=
dt
.
datetime
(
2008
,
7
,
30
,
13
)
prior_init_time
=
dt
.
datetime
(
2008
,
7
,
30
,
13
)
prior_valid_time
=
dt
.
datetime
(
2008
,
7
,
30
,
13
,
30
)
prior_valid_time
=
dt
.
datetime
(
2008
,
7
,
30
,
13
,
30
)
id
=
prepare_IC_from_prior
(
prior_path_exp
,
prior_init_time
,
prior_valid_time
,
id
=
w
.
prepare_IC_from_prior
(
prior_path_exp
,
prior_init_time
,
prior_valid_time
,
# new_start_time=start, # <---------- to overwrite start time
# new_start_time=start, # <---------- to overwrite start time
depends_on
=
id
)
depends_on
=
id
)
#frequency_restart = (end-start).total_seconds()/60
#frequency_restart = (end-start).total_seconds()/60
frequency_restart
=
dt
.
timedelta
(
minutes
=
30
).
total_seconds
()
/
60
frequency_restart
=
dt
.
timedelta
(
minutes
=
30
).
total_seconds
()
/
60
id
=
run_ENS
(
begin
=
start
,
end
=
end
,
id
=
w
.
run_ENS
(
begin
=
start
,
end
=
end
,
input_is_restart
=
True
,
input_is_restart
=
True
,
output_restart_interval
=
frequency_restart
,
output_restart_interval
=
frequency_restart
,
#output_restart_interval=9999,
#output_restart_interval=9999,
...
@@ -137,7 +155,7 @@ if True: # continuation of free run after spinup
...
@@ -137,7 +155,7 @@ if True: # continuation of free run after spinup
# start = end
# start = end
# end = dt.datetime(2008, 7, 30, 18)
# end = dt.datetime(2008, 7, 30, 18)
# print('run WRF from', start, 'until', end)
# print('run WRF from', start, 'until', end)
# id = run_ENS(begin=start, end=end,
# id =
w.
run_ENS(begin=start, end=end,
# input_is_restart=True,
# input_is_restart=True,
# #output_restart_interval=(next_restart-time).total_seconds()/60,
# #output_restart_interval=(next_restart-time).total_seconds()/60,
# output_restart_interval=9999,
# output_restart_interval=9999,
...
@@ -145,27 +163,3 @@ if True: # continuation of free run after spinup
...
@@ -145,27 +163,3 @@ if True: # continuation of free run after spinup
# id = create_satimages(start, depends_on=id)
# id = create_satimages(start, depends_on=id)
# verify(depends_on=id)
# verify(depends_on=id)
if
False
:
# continuation of nature after spinup
start
=
dt
.
datetime
(
2008
,
7
,
30
,
7
)
end
=
dt
.
datetime
(
2008
,
7
,
30
,
18
)
id
=
prepare_WRFrundir
(
start
)
# create initial conditions
id
=
run_ideal
(
depends_on
=
id
)
prior_path_exp
=
'
/gpfs/data/fs71386/lkugler/sim_archive/exp_v1.19_P5_nat2
'
# cluster.archivedir
prior_init_time
=
dt
.
datetime
(
2008
,
7
,
30
,
7
)
prior_valid_time
=
dt
.
datetime
(
2008
,
7
,
30
,
12
)
id
=
prepare_IC_from_prior
(
prior_path_exp
,
prior_init_time
,
prior_valid_time
,
new_start_time
=
start
,
# <---------- to start again after spinup
depends_on
=
id
)
id
=
run_ENS
(
begin
=
start
,
end
=
end
,
input_is_restart
=
False
,
output_restart_interval
=
(
end
-
start
).
total_seconds
()
/
60
,
#output_restart_interval=9999,
depends_on
=
id
)
id
=
create_satimages
(
start
,
depends_on
=
id
)
verify
(
depends_on
=
id
)
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