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
8e122c11
Commit
8e122c11
authored
3 weeks ago
by
Lukas Kugler
Browse files
Options
Downloads
Patches
Plain Diff
link instead copy (for speed)
parent
f991b446
Branches
dev-lkugler
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dartwrf/prep_IC_prior.py
+3
-6
3 additions, 6 deletions
dartwrf/prep_IC_prior.py
dartwrf/utils.py
+5
-1
5 additions, 1 deletion
dartwrf/utils.py
with
8 additions
and
7 deletions
dartwrf/prep_IC_prior.py
+
3
−
6
View file @
8e122c11
import
os
,
sys
,
glob
import
datetime
as
dt
from
dartwrf.utils
import
copy
,
Config
from
dartwrf.utils
import
copy
,
Config
,
symlink
"""
Sets initial condition data (wrfinput/wrfrst file) in the run_WRF directory for each ensemble member
...
...
@@ -21,15 +21,12 @@ def create_wrfrst_in_WRF_rundir(time: dt.datetime, prior_init_time: dt.datetime,
"""
for
iens
in
range
(
1
,
cfg
.
ensemble_size
+
1
):
dir_wrf_run
=
cfg
.
dir_wrf_run
.
replace
(
'
<exp>
'
,
cfg
.
name
).
replace
(
'
<ens>
'
,
str
(
iens
))
for
f
in
glob
.
glob
(
dir_wrf_run
+
'
/wrfrst_*
'
):
os
.
remove
(
f
)
prior_wrfrst
=
prior_path_exp
+
prior_init_time
.
strftime
(
'
/%Y-%m-%d_%H:%M/
'
)
\
+
str
(
iens
)
+
time
.
strftime
(
'
/wrfrst_d01_%Y-%m-%d_%H:%M:%S
'
)
wrfrst
=
dir_wrf_run
+
time
.
strftime
(
'
/wrfrst_d01_%Y-%m-%d_%H:%M:%S
'
)
print
(
'
copy
prior (wrfrst)
'
,
prior_wrfrst
,
'
to
'
,
wrfrst
)
copy
(
prior_wrfrst
,
wrfrst
)
print
(
'
linking
prior (wrfrst)
'
,
prior_wrfrst
,
'
to
'
,
wrfrst
)
symlink
(
prior_wrfrst
,
wrfrst
,
check_if_source_exists
=
True
)
def
create_updated_wrfinput_from_wrfout
(
time
:
dt
.
datetime
,
prior_init_time
:
dt
.
datetime
,
prior_path_exp
:
str
,
new_start_time
:
dt
.
datetime
)
->
None
:
...
...
This diff is collapsed.
Click to expand it.
dartwrf/utils.py
+
5
−
1
View file @
8e122c11
...
...
@@ -270,10 +270,14 @@ def copy_contents(src, dst):
os
.
system
(
'
cp -rf
'
+
src
+
'
/*
'
+
dst
+
'
/
'
)
def
symlink
(
src
,
dst
):
def
symlink
(
src
,
dst
,
check_if_source_exists
=
False
):
"""
Create a symbolic link from src to dst
Creates the folder if it does not exist
"""
if
check_if_source_exists
:
if
not
os
.
path
.
exists
(
src
):
raise
FileNotFoundError
(
f
"
Source file
{
src
}
does not exist
"
)
try
:
# this file may not exist
os
.
remove
(
dst
)
except
OSError
:
...
...
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