Commit f102be75 authored by Willi Rath's avatar Willi Rath

Merge branch '40-add-yomaha07' into 'develop'

Resolve "Add YOMAHA07 data"

See merge request !45
parents e2d9cd55 47ac1cdc
......@@ -209,11 +209,34 @@ class WgetRecursive(Renderer):
String containing a comma-separated list of patterns to be accepted.
(Example: Set to `"*.nc,*.nc.gz"` to only download `.nc` and `.nc.gz`
files.)
exclude_directories : str (optional)
String containing a comma-separated list of directories to be excluded.
(Example: Set to `"/some-path,/some-other-path"` to not download
anything from `<fqdn>/some-path/` and `<fqdn>/some-other-path/`.)
"""
template = ("wget -nv -r -c -np -nH --cut-dirs={cut_dirs} "
"--accept \"{accept_files}\" -P \"{prefix}\" \"{url}\"\n")
template = ("wget -nv -r -c -np -nH --cut-dirs={cut_dirs}"
"{accept_files_string}{exclude_directories_string} "
"-P \"{prefix}\" \"{url}\"\n")
def __init__(self, yaml_dict=None, *args, **kwargs):
"""Construct `accept_files_string` and `exclude_directories_string`."""
if "accept_files" not in yaml_dict:
yaml_dct["accept_files_string"] = ""
else:
yaml_dict["accept_files_string"] = (
" --accept \"{}\"".format(yaml_dict["accept_files"])
)
if "exclude_directories" not in yaml_dict:
yaml_dict["exclude_directories_string"] = ""
else:
yaml_dict["exclude_directories_string"] = (
" -X \"{}\"".format(yaml_dict["exclude_directories"])
)
super(WgetRecursive, self).__init__(yaml_dict=yaml_dict, *args,
**kwargs)
class WgetRecursiveCred(Renderer):
......
repo_name: YOMAHA07
people: Willi Rath (<wrath@geomar.de>)
http_path_remote: https://git.geomar.de/data/YOMAHA07
git_path_remote: git@git.geomar.de:data/YOMAHA07.git
repo_description: |
YoMaHa'07: Velocity data assessed from trajectories of Argo floats at parking
level and at the sea surface
<http://apdrc.soest.hawaii.edu/projects/yomaha/>
prefixes: data doc
data:
- url: "http://apdrc.soest.hawaii.edu/projects/Argo/data/trjctry/"
cut_dirs: 4
prefix: data
exclude_directories: "/projects/Argo/data/trjctry/Old/"
method: !!python/name:data_repo_renderer.WgetRecursive
doc:
- url: "http://apdrc.soest.hawaii.edu/projects/yomaha/"
file_name: apdrc.soest.hawaii.edu_projects_yomaha.html
prefix: doc
method: !!python/name:data_repo_renderer.CurlSingleFile
- url: "http://apdrc.soest.hawaii.edu/projects/yomaha/yomaha07/YoMaHa070612.pdf"
file_name: YoMaHa070612.pdf
prefix: doc
method: !!python/name:data_repo_renderer.CurlSingleFile
- url: "http://apdrc.soest.hawaii.edu/projects/Argo/data/trjctry/Read_me"
file_name: apdrc.soest.hawaii.edu_projects_Argo_data_trjctry_Read_me
prefix: doc
method: !!python/name:data_repo_renderer.CurlSingleFile
......@@ -16,7 +16,17 @@ def test_curl_single_file_rendering():
assert renderer.__str__ == target_string
def test_wget_recursive_rendering():
def test_wget_recursive_rendering_with_excluded_dirs():
yaml_dict = {"prefix": "pref", "cut_dirs": 77, "url": "http://url",
"accept_files": "*.*", "exclude_directories": "/asdf,/zxcv/a"}
target_string = ("wget -nv -r -c -np -nH --cut-dirs=77 "
"--accept \"*.*\" -X \"/asdf,/zxcv/a\" -P \"pref\" "
"\"http://url\"\n")
renderer = data_repo_renderer.WgetRecursive(yaml_dict=yaml_dict)
assert renderer.__str__ == target_string
def test_wget_recursive_rendering_without_excluded_dirs():
yaml_dict = {"prefix": "pref", "cut_dirs": 77, "url": "http://url",
"accept_files": "*.*"}
target_string = ("wget -nv -r -c -np -nH --cut-dirs=77 "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment