From 70fc4c7e0a5c54ab1241adee5d707f9230aa2005 Mon Sep 17 00:00:00 2001 From: Nils Lehmann Date: Wed, 19 Feb 2025 17:50:58 +0100 Subject: [PATCH] rm --- tests/data/bigearthnet/v2/data.py | 25 ------------------------- torchgeo/datasets/bigearthnet.py | 10 +--------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/tests/data/bigearthnet/v2/data.py b/tests/data/bigearthnet/v2/data.py index 54f74c80562..ee3664fc9f9 100644 --- a/tests/data/bigearthnet/v2/data.py +++ b/tests/data/bigearthnet/v2/data.py @@ -6,7 +6,6 @@ import hashlib import os import shutil -import tarfile from pathlib import Path import numpy as np @@ -191,30 +190,6 @@ def create_metadata() -> None: df.to_parquet(os.path.join(ROOT_DIR, 'metadata.parquet')) -def compress_directory(dirname: str) -> None: - """Compress directory using tar+zstd""" - tar_path = os.path.join(ROOT_DIR, f'{dirname}.tar') - with tarfile.open(tar_path, 'w') as tar: - tar.add(os.path.join(ROOT_DIR, dirname), arcname=dirname) - - with open(tar_path, 'rb') as f_in: - data = f_in.read() - cctx = zstd.ZstdCompressor() - compressed = cctx.compress(data) - with open(f'{tar_path}.zst', 'wb') as f_out: - f_out.write(compressed) - - os.remove(tar_path) - - # print md5sum with hashlib - hash_md5 = hashlib.md5() - with open(f'{tar_path}.zst', 'rb') as f: - for chunk in iter(lambda: f.read(4096), b''): - hash_md5.update(chunk) - - print(f'{tar_path}.zst: {hash_md5.hexdigest()}') - - def main() -> None: create_directory_structure() diff --git a/torchgeo/datasets/bigearthnet.py b/torchgeo/datasets/bigearthnet.py index 8da33ed7b85..683a3e36c23 100644 --- a/torchgeo/datasets/bigearthnet.py +++ b/torchgeo/datasets/bigearthnet.py @@ -23,13 +23,7 @@ from .errors import DatasetNotFoundError from .geo import NonGeoDataset -from .utils import ( - Path, - download_url, - extract_archive, - lazy_import, - sort_sentinel2_bands, -) +from .utils import Path, download_url, extract_archive, sort_sentinel2_bands class BigEarthNet(NonGeoDataset): @@ -914,8 +908,6 @@ def _extract(self) -> None: for key, meta in self.metadata_locs.items(): if key == 'metadata': continue - assert not os.path.isdir(os.listdir(self.root)[2]) - assert not os.path.isdir(os.path.join(self.root, 'BigEarthNet-S1.tar.gzaa')) parts = [os.path.join(self.root, f) for f in meta['files'].keys()] concat_path = os.path.join(self.root, self.dir_file_names[key] + '.tar.gz') with open(concat_path, 'wb') as outfile: