Skip to content

Commit

Permalink
Use remote index and matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
sandorkertesz committed Nov 29, 2023
1 parent d77dee3 commit 1e38b9b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
18 changes: 10 additions & 8 deletions earthkit/regrid/utils/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ def disk_usage(path):
def default_serialiser(o):
if isinstance(o, (datetime.date, datetime.datetime)):
return o.isoformat()
if isinstance(o, (pd.Timestamp)):
return o.isoformat()
if isinstance(o, (pd.DatetimeIndex)):
return [_.isoformat() for _ in o]
return json.JSONEncoder.default(o)


Expand Down Expand Up @@ -380,13 +376,18 @@ def _delete_entry(self, entry):
if entry["size"] is None:
entry["size"] = 0

path, size, owner, args = (
path, size = (
entry["path"],
entry["size"],
entry["owner"],
entry["args"],
)

# path, size, owner, args = (
# entry["path"],
# entry["size"],
# entry["owner"],
# entry["args"],
# )

# LOG.warning(
# "Deleting entry %s",
# json.dumps(
Expand Down Expand Up @@ -538,7 +539,8 @@ def _repr_html_(self):
str
HTML status of the cache.
"""
html = [css("table")]
# html = [css("table")]
html = []
with self.new_connection() as db:
for n in db.execute("SELECT * FROM cache"):
n = dict(n)
Expand Down
1 change: 0 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ testpaths = tests
markers =
download: a test downloading GRIB data and/or matrices from the ECMWF download server
tmp_cache: a test using a freshly created temporary cache

2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def pytest_runtest_setup(item):

marks_in_items = list([m.name for m in item.iter_markers()])

from earthkit.regrid.utils.caching import CACHE, SETTINGS
from earthkit.regrid.db import DB
from earthkit.regrid.utils.caching import CACHE, SETTINGS

DB.clear_index()

Expand Down
2 changes: 1 addition & 1 deletion tests/data/local/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@
"global": 1
}
}
}
}
3 changes: 1 addition & 2 deletions tools/make-matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ input_dir="grib"
[[ ! -d $output_dir ]] && mkdir $output_dir

# get mir version
version=$(~/build/mir/release/bin/mir --version x x 2>/dev/null | grep mir | cut -d ' ' -f 2)
version=$(~/build/mir/release/bin/mir --version x x 2>/dev/null | grep mir | cut -d ' ' -f 2)

input_grib=$input_dir/${input}.grib
output_json=$output_dir/${output}-${version}.json
Expand Down Expand Up @@ -64,4 +64,3 @@ fi
python3 -c "from earthkit.regrid.utils.matrix import make_matrix; make_matrix('$output_json','$output_dir',global_input=True,global_output=True,version='$version')"

#rm -f $output_json

0 comments on commit 1e38b9b

Please sign in to comment.