Skip to content

Commit 0cc2d1e

Browse files
Add script for data upload
1 parent 3588f61 commit 0cc2d1e

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

scripts/ome_challenge/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
credentials.json
2+
export_minio.sh

scripts/ome_challenge/convert_data.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ def convert_to_ome_zarr_v3(name):
5151

5252

5353
def main():
54-
name = "Platynereis-H2B-TL"
55-
# convert_to_ome_zarr_v2(name)
54+
# name = "Platynereis-H2B-TL"
55+
# name = "Zebrafish-XSPIM-multiview"
56+
name = "Zebrafish-H2B-short-timelapse"
57+
convert_to_ome_zarr_v2(name)
5658
convert_to_ome_zarr_v3(name)
5759

5860

scripts/ome_challenge/download_data.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77
IDS = {
88
"Platynereis-H2B-TL": "1jGwaJ62w80GYo5I_Jcb3O_g7y4RKEhjI",
9-
"Zebrafish-XSPIM-multiview": "https://drive.google.com/drive/folders/175hZRrUNWM2UzY0wzXPFjuFZ5QKUN-tm?usp=drive_link" # noqa
9+
"Zebrafish-XSPIM-multiview": "175hZRrUNWM2UzY0wzXPFjuFZ5QKUN-tm", # noqa
10+
"Zebrafish-H2B-short-timelapse": "18fGJwQ0i5pBHQO8FHUuFcxqWeD7uwiBM", # noqa
11+
# This doesn't work.
12+
# "Zebrafish-H2B-short-4views": "1iyMMCZO1rmamVGNVThJWElJKSKXROscF"
1013
}
1114

1215
# ROOT = "/mnt/lustre-grete/usr/u12086/data/flamingo"
@@ -17,6 +20,7 @@ def download_folder(drive, name):
1720
os.makedirs(ROOT, exist_ok=True)
1821

1922
destination_folder = os.path.join(ROOT, name)
23+
os.makedirs(destination_folder, exist_ok=True)
2024
folder_id = IDS[name]
2125

2226
folder_query = f"'{folder_id}' in parents and trashed=false"
@@ -48,7 +52,9 @@ def main():
4852
drive = get_drive()
4953

5054
# download_from_gdrive(name="Zebrafish-XSPIM-multiview")
51-
download_folder(drive, name="Platynereis-H2B-TL")
55+
# download_folder(drive, name="Platynereis-H2B-TL")
56+
# download_folder(drive, name="Zebrafish-H2B-short-timelapse")
57+
download_folder(drive, name="Zebrafish-H2B-short-4views")
5258

5359

5460
if __name__ == "__main__":
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import os
2+
from subprocess import run
3+
4+
ROOT = "/mnt/lustre-emmy-hdd/usr/u12086/data/flamingo"
5+
6+
7+
def upload_data(name):
8+
data_root = os.path.join(ROOT, "ngff-v3", name)
9+
assert os.path.exists(data_root), data_root
10+
11+
bucket_name = "n4bi-goe"
12+
13+
# Create the bucket.
14+
cmd = [
15+
"mc-client", "mb", f"challenge/{bucket_name}/{name}/"
16+
]
17+
run(cmd)
18+
19+
# Run the copy.
20+
cmd = [
21+
"mc-client", "cp", "--recursive",
22+
f"{data_root}/", f"challenge/{bucket_name}/{name}/"
23+
]
24+
run(cmd)
25+
26+
27+
def main():
28+
name = "Platynereis-H2B-TL.ome.zarr"
29+
upload_data(name)
30+
31+
32+
if __name__ == "__main__":
33+
main()

0 commit comments

Comments
 (0)