Skip to content

Commit

Permalink
Some type stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiannucci committed Oct 21, 2024
1 parent 01d261c commit 52e53f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion virtualizarr/tests/test_writers/test_icechunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def test_set_single_virtual_ref_with_encoding(

root_group = group(store=icechunk_filestore)
air_array = root_group["air"]
assert isinstance(air_array, Array)

# check array metadata
assert air_array.shape == (2920, 25, 53)
Expand All @@ -159,7 +160,7 @@ def test_set_single_virtual_ref_with_encoding(
# xarray performs this when cf_decoding is True, but we are not loading
# with xarray here so we scale it manually.
scale_factor = air_array.attrs["scale_factor"]
scaled_air_array = air_array[:] * scale_factor
scaled_air_array = air_array[:] * scale_factor # type: ignore

# check chunk references
# TODO we can't explicitly check that the path/offset/length is correct because icechunk doesn't yet expose any get_virtual_refs method
Expand Down
6 changes: 3 additions & 3 deletions virtualizarr/writers/icechunk.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, cast

import numpy as np
from xarray import Dataset
Expand Down Expand Up @@ -101,7 +101,7 @@ def write_virtual_variable_to_icechunk(
var: Variable,
) -> None:
"""Write a single virtual variable into an icechunk store"""
ma = var.data
ma = cast(ManifestArray, var.data)
zarray = ma.zarray

# creates array if it doesn't already exist
Expand Down Expand Up @@ -154,7 +154,7 @@ def write_manifest_virtual_refs(
"multi_index",
"c_index", # TODO is "c_index" correct? what's the convention for zarr chunk keys?
],
op_flags=[["readonly"]] * 3,
op_flags=[["readonly"]] * 3, # type: ignore
)
for path, offset, length in it:
index = it.multi_index
Expand Down

0 comments on commit 52e53f9

Please sign in to comment.