Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csppfetch
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
cspp_geo
csppfetch
Commits
7c849c83
Commit
7c849c83
authored
3 years ago
by
Alan De Smet
Browse files
Options
Downloads
Patches
Plain Diff
Allow multiple symlink destinations
aitf relies on the behavior
parent
3dd3225a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
example/aitf-data-for-run
+18
-17
18 additions, 17 deletions
example/aitf-data-for-run
with
18 additions
and
17 deletions
example/aitf-data-for-run
+
18
−
17
View file @
7c849c83
...
...
@@ -53,11 +53,11 @@ def parse_args():
metavar
=
'
DATE
'
,
help
=
'
scan time ancillary data is needed for
'
)
ap
.
add_argument
(
'
destination
'
,
type
=
arg_directory
,
ap
.
add_argument
(
'
destination
'
,
type
=
arg_directory
,
nargs
=
'
+
'
,
metavar
=
'
FINAL_PATH
'
,
help
=
'
write required files here
, possibly as symbolic links
'
)
help
=
'
write
symbolic links to
required files here
(actual files may be placed in the first destination provided)
'
)
add_cache_dir_arg
(
ap
)
add_cache_dir_arg
(
ap
,
'
--cache
'
)
ap
.
add_argument
(
'
--cache-only
'
,
action
=
'
store_true
'
,
help
=
'
do not download; only use files already in cache
'
)
...
...
@@ -89,10 +89,10 @@ def main():
aitf
.
conlog
.
setup_logging
()
args
=
parse_args
()
cache_dir
=
args
.
dir
cache_dir
=
args
.
cache
if
not
os
.
access
(
cache_dir
,
os
.
W_OK
):
logging
.
warning
(
f
'
I do not appear to be able to have write access to
"
{
cache_dir
}
"
. Downloading directly into
{
args
.
destination
}
'
)
args
.
dir
=
args
.
destination
logging
.
warning
(
f
'
I do not appear to be able to have write access to
"
{
cache_dir
}
"
. Downloading directly into
{
args
.
destination
[
0
]
}
'
)
args
.
cache
=
args
.
destination
[
0
]
do_download
=
not
args
.
cache_only
...
...
@@ -100,29 +100,30 @@ def main():
logging
.
progress
(
"
Acquiring SST
"
)
sststats
=
aitf
.
ancil
.
SST
.
DownloadStatistics
()
sst_files
=
aitf
.
ancil
.
SST
.
download_for_time
(
args
.
scan_time
,
args
.
dir
,
do_download
=
do_download
,
download_stats
=
sststats
)
sst_files
=
aitf
.
ancil
.
SST
.
download_for_time
(
args
.
scan_time
,
args
.
cache
,
do_download
=
do_download
,
download_stats
=
sststats
)
log_download_report
(
"
SST Download Summary
"
,
sststats
)
# using SST instead of GFS to show that
# DownloadStatistics are interchangable.
logging
.
progress
(
"
Acquiring GFS
"
)
gfsstats
=
aitf
.
ancil
.
SST
.
DownloadStatistics
()
gfs_files
=
aitf
.
ancil
.
GFS
.
download_for_time
(
args
.
scan_time
,
args
.
dir
,
do_download
=
do_download
,
download_stats
=
sststats
)
gfs_files
=
aitf
.
ancil
.
GFS
.
download_for_time
(
args
.
scan_time
,
args
.
cache
,
do_download
=
do_download
,
download_stats
=
sststats
)
log_download_report
(
"
GFS Download Summary
"
,
gfsstats
)
log_download_report
(
"
Total Download Summary
"
,
sststats
+
gfsstats
)
logging
.
progress
(
"
Symbolically linking into place
"
)
all_files
=
list
(
sst_files
)
+
list
(
gfs_files
)
for
file
in
all_files
:
f
=
os
.
path
.
relpath
(
file
,
args
.
dir
)
src
=
os
.
path
.
join
(
args
.
dir
,
f
)
dst
=
hack_oisst_preliminary_filename
(
os
.
path
.
join
(
args
.
destination
,
f
))
dst_dir
=
os
.
path
.
dirname
(
dst
)
os
.
makedirs
(
dst_dir
,
exist_ok
=
True
)
logging
.
info
(
src
+
'
->
'
+
dst
)
if
src
!=
dst
:
os
.
symlink
(
src
,
dst
)
for
destination
in
args
.
destination
:
for
file
in
all_files
:
f
=
os
.
path
.
relpath
(
file
,
args
.
cache
)
src
=
os
.
path
.
join
(
args
.
cache
,
f
)
dst
=
hack_oisst_preliminary_filename
(
os
.
path
.
join
(
destination
,
f
))
dst_dir
=
os
.
path
.
dirname
(
dst
)
os
.
makedirs
(
dst_dir
,
exist_ok
=
True
)
logging
.
info
(
src
+
'
->
'
+
dst
)
if
src
!=
dst
:
# src==dst if we set args.cache to args.destination[0]
os
.
symlink
(
src
,
dst
)
except
csppfetch
.
DownloadsFailedException
as
e
:
logging
.
fatal
(
str
(
e
))
...
...
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