Skip to content

Commit 83fb9f7

Browse files
committed
use esgpull checker
1 parent 67ae4e5 commit 83fb9f7

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies = [
2222
]
2323

2424
[project.entry-points."xarray.backends"]
25-
esgf = "xarray_esgf.engine_esgf:EsgfBackendEntrypoint"
25+
esgf = "xarray_esgf.engine:EsgfBackendEntrypoint"
2626

2727
[project.urls]
2828
Homepage = "https://bopen.github.io/xarray-esgf/"

xarray_esgf/client.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import asyncio
22
import dataclasses
3-
import hashlib
43
from collections import defaultdict
54
from collections.abc import Callable, Iterable
65
from functools import cached_property
@@ -9,6 +8,7 @@
98

109
import xarray as xr
1110
from esgpull import Esgpull, File, Query
11+
from esgpull.fs import FileCheck
1212
from xarray import DataArray, Dataset
1313

1414
DATASET_ID_KEYS = Literal[
@@ -68,20 +68,13 @@ def files(self) -> list[File]:
6868
)
6969

7070
def get_local_path(self, file: File) -> Path:
71-
return self._client.fs.paths.data / file.local_path / file.filename
71+
return self._client.fs[file].drs
7272

7373
@property
7474
def missing_files(self) -> list[File]:
75-
missing_files = []
76-
for file in self.files:
77-
path = self.get_local_path(file)
78-
if path.exists():
79-
with path.open("rb") as f:
80-
digest = hashlib.file_digest(f, file.checksum_type)
81-
if digest.hexdigest() == file.checksum:
82-
continue
83-
missing_files.append(file)
84-
return missing_files
75+
return [
76+
file for file in self.files if self._client.fs.check(file) != FileCheck.Ok
77+
]
8578

8679
@cached_property
8780
def local_paths(self) -> dict[str, list[Path]]:

0 commit comments

Comments
 (0)