Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add sample id to install
  • Loading branch information
AntSimi committed Nov 20, 2024
commit 2dc4043ff09c0d8420fc6d20d72ef9d25dc26d10
1 change: 1 addition & 0 deletions doc/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies:
- pip
- pip:
- -r ../requirements.txt
- git+https://github.com/AntSimi/py-eddy-tracker-sample-id.git
- sphinx-gallery
- sphinx_rtd_theme
- sphinx>=3.1
Expand Down
20 changes: 14 additions & 6 deletions src/py_eddy_tracker/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
20160515 adt None None longitude latitude . \
--cut 800 --fil 1
"""

import io
import lzma
from os import path
Expand All @@ -26,14 +27,21 @@ def get_remote_demo_sample(path):
if path.endswith(".nc"):
return io.BytesIO(content)
else:
if path.endswith(".nc"):
try:
import py_eddy_tracker_sample_id
py_eddy_tracker_sample_id.get_remote_demo_sample()
if path.endswith(".nc"):
return py_eddy_tracker_sample_id.get_remote_demo_sample(path)
content = open(py_eddy_tracker_sample_id.get_remote_demo_sample(f"{path}.tar.xz"), "rb").read()
except:
if path.endswith(".nc"):
content = requests.get(
f"https://github.com/AntSimi/py-eddy-tracker-sample-id/raw/master/{path}"
).content
return io.BytesIO(content)
content = requests.get(
f"https://github.com/AntSimi/py-eddy-tracker-sample-id/raw/master/{path}"
f"https://github.com/AntSimi/py-eddy-tracker-sample-id/raw/master/{path}.tar.xz"
).content
return io.BytesIO(content)
content = requests.get(
f"https://github.com/AntSimi/py-eddy-tracker-sample-id/raw/master/{path}.tar.xz"
).content

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