Skip to content

Commit 2dc4043

Browse files
committed
add sample id to install
1 parent 24a4094 commit 2dc4043

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

doc/environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ dependencies:
66
- pip
77
- pip:
88
- -r ../requirements.txt
9+
- git+https://github.com/AntSimi/py-eddy-tracker-sample-id.git
910
- sphinx-gallery
1011
- sphinx_rtd_theme
1112
- sphinx>=3.1

src/py_eddy_tracker/data/__init__.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
20160515 adt None None longitude latitude . \
99
--cut 800 --fil 1
1010
"""
11+
1112
import io
1213
import lzma
1314
from os import path
@@ -26,14 +27,21 @@ def get_remote_demo_sample(path):
2627
if path.endswith(".nc"):
2728
return io.BytesIO(content)
2829
else:
29-
if path.endswith(".nc"):
30+
try:
31+
import py_eddy_tracker_sample_id
32+
py_eddy_tracker_sample_id.get_remote_demo_sample()
33+
if path.endswith(".nc"):
34+
return py_eddy_tracker_sample_id.get_remote_demo_sample(path)
35+
content = open(py_eddy_tracker_sample_id.get_remote_demo_sample(f"{path}.tar.xz"), "rb").read()
36+
except:
37+
if path.endswith(".nc"):
38+
content = requests.get(
39+
f"https://github.com/AntSimi/py-eddy-tracker-sample-id/raw/master/{path}"
40+
).content
41+
return io.BytesIO(content)
3042
content = requests.get(
31-
f"https://github.com/AntSimi/py-eddy-tracker-sample-id/raw/master/{path}"
43+
f"https://github.com/AntSimi/py-eddy-tracker-sample-id/raw/master/{path}.tar.xz"
3244
).content
33-
return io.BytesIO(content)
34-
content = requests.get(
35-
f"https://github.com/AntSimi/py-eddy-tracker-sample-id/raw/master/{path}.tar.xz"
36-
).content
3745

3846
# Tar module could manage lzma tar, but it will apply uncompress for each extractfile
3947
tar = tarfile.open(mode="r", fileobj=io.BytesIO(lzma.decompress(content)))

0 commit comments

Comments
 (0)