Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
mkdocs-material-extensions \
mkdocs-jupyter \
"mistune<3.1" \
&& pip install mkdocs-print-site-plugin \
&& git config user.name 'github-actions[bot]' \
&& git config user.email 'github-actions[bot]@users.noreply.github.com'

Expand Down
7 changes: 6 additions & 1 deletion docs/docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ create an environment called "flacarray". First create the env with all
dependencies and activate it (FIXME, add a requirements file for dev):

conda create -n flacarray \
c_compiler numpy libflac cython meson-python
c_compiler numpy libflac cython meson-python pkgconfig

conda activate flacarray

Expand All @@ -51,6 +51,11 @@ Now you can go into your local git checkout of the flacarray source and do:

To build and install the package.

To also work on docs, install additional packages:

conda install mkdocs mkdocstrings mkdocs-jupyter
pip install mkdocs-print-site-plugin

### Other Ways of Building

!!! note "To-Do"
Expand Down
39 changes: 25 additions & 14 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,31 @@ theme:
- navigation.path

plugins:
- search
- mkdocstrings:
handlers:
python:
options:
docstring_style: google
show_root_heading: true
heading_level: 3
parameter_headings: false
show_object_full_path: false
show_symbol_type_heading: true
show_symbol_type_toc: true
- mkdocs-jupyter:
execute: false
- search
- mkdocstrings:
handlers:
python:
options:
docstring_style: google
show_root_heading: true
heading_level: 3
parameter_headings: false
show_object_full_path: false
show_symbol_type_heading: true
show_symbol_type_toc: true
- mkdocs-jupyter:
execute: false
- print-site:
add_to_navigation: true
add_print_site_banner: false
print_page_title: 'View as Single Page'
add_full_urls: false
add_table_of_contents: true
toc_title: "Table of Contents"
toc_depth: 2
enumerate_headings: false
enumerate_figures: true
add_cover_page: false

nav:
- Introduction: index.md
Expand Down
164 changes: 82 additions & 82 deletions src/flacarray/tests/zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,85 +224,85 @@ def test_array_write_read(self):
flcarr_f64 = FlacArray.from_array(inputf64, mpi_comm=self.comm, use_threads=True)
check_f64 = None

# tmpdir = None
# tmppath = None
# if rank == 0:
# tmpdir = tempfile.TemporaryDirectory()
# tmppath = tmpdir.name
# if self.comm is not None:
# tmppath = self.comm.bcast(tmppath, root=0)

# i32_file = os.path.join(tmppath, "data_i32.zarr")
# with ZarrGroup(i32_file, mode="w", comm=self.comm) as zf:
# flcarr_i32.write_zarr(zf)
# if self.comm is not None:
# self.comm.barrier()
# with ZarrGroup(i32_file, mode="r", comm=self.comm) as zf:
# check_i32 = FlacArray.read_zarr(zf, mpi_comm=self.comm)

# i64_file = os.path.join(tmppath, "data_i64.zarr")
# with ZarrGroup(i64_file, mode="w", comm=self.comm) as zf:
# flcarr_i64.write_zarr(zf)
# if self.comm is not None:
# self.comm.barrier()
# with ZarrGroup(i64_file, mode="r", comm=self.comm) as zf:
# check_i64 = FlacArray.read_zarr(zf, mpi_comm=self.comm)

# f32_file = os.path.join(tmppath, "data_f32.zarr")
# with ZarrGroup(f32_file, mode="w", comm=self.comm) as zf:
# flcarr_f32.write_zarr(zf)
# if self.comm is not None:
# self.comm.barrier()
# with ZarrGroup(f32_file, mode="r", comm=self.comm) as zf:
# check_f32 = FlacArray.read_zarr(zf, mpi_comm=self.comm)

# f64_file = os.path.join(tmppath, "data_f64.zarr")
# with ZarrGroup(f64_file, mode="w", comm=self.comm) as zf:
# flcarr_f64.write_zarr(zf)
# if self.comm is not None:
# self.comm.barrier()
# with ZarrGroup(f64_file, mode="r", comm=self.comm) as zf:
# check_f64 = FlacArray.read_zarr(zf, mpi_comm=self.comm)

# if self.comm is not None:
# self.comm.barrier()
# del tmppath
# del tmpdir

# if check_i32 != flcarr_i32:
# print(f"check_i32 = {check_i32}", flush=True)
# print(f"flcarr_i32 = {flcarr_i32}", flush=True)
# print("FAIL on i32 roundtrip to zarr", flush=True)
# self.assertTrue(False)
# else:
# output_i32 = check_i32.to_array()
# if not np.array_equal(output_i32, input32):
# print("FAIL on i32 zarr decompressed array check", flush=True)
# self.assertTrue(False)

# if check_i64 != flcarr_i64:
# print("FAIL on i64 roundtrip to zarr", flush=True)
# self.assertTrue(False)
# else:
# output_i64 = check_i64.to_array()
# if not np.array_equal(output_i64, input64):
# print("FAIL on i64 zarr decompressed array check", flush=True)
# self.assertTrue(False)

# if check_f32 != flcarr_f32:
# print("FAIL on f32 roundtrip to zarr", flush=True)
# self.assertTrue(False)
# else:
# output_f32 = check_f32.to_array()
# if not np.allclose(output_f32, inputf32, rtol=1.0e-5, atol=1.0e-5):
# print("FAIL on f32 zarr decompressed array check", flush=True)
# self.assertTrue(False)

# if check_f64 != flcarr_f64:
# print("FAIL on f64 roundtrip to zarr", flush=True)
# self.assertTrue(False)
# else:
# output_f64 = check_f64.to_array()
# if not np.allclose(output_f64, inputf64, rtol=1.0e-5, atol=1.0e-5):
# print("FAIL on f64 zarr decompressed array check", flush=True)
# self.assertTrue(False)
tmpdir = None
tmppath = None
if rank == 0:
tmpdir = tempfile.TemporaryDirectory()
tmppath = tmpdir.name
if self.comm is not None:
tmppath = self.comm.bcast(tmppath, root=0)

i32_file = os.path.join(tmppath, "data_i32.zarr")
with ZarrGroup(i32_file, mode="w", comm=self.comm) as zf:
flcarr_i32.write_zarr(zf)
if self.comm is not None:
self.comm.barrier()
with ZarrGroup(i32_file, mode="r", comm=self.comm) as zf:
check_i32 = FlacArray.read_zarr(zf, mpi_comm=self.comm)

i64_file = os.path.join(tmppath, "data_i64.zarr")
with ZarrGroup(i64_file, mode="w", comm=self.comm) as zf:
flcarr_i64.write_zarr(zf)
if self.comm is not None:
self.comm.barrier()
with ZarrGroup(i64_file, mode="r", comm=self.comm) as zf:
check_i64 = FlacArray.read_zarr(zf, mpi_comm=self.comm)

f32_file = os.path.join(tmppath, "data_f32.zarr")
with ZarrGroup(f32_file, mode="w", comm=self.comm) as zf:
flcarr_f32.write_zarr(zf)
if self.comm is not None:
self.comm.barrier()
with ZarrGroup(f32_file, mode="r", comm=self.comm) as zf:
check_f32 = FlacArray.read_zarr(zf, mpi_comm=self.comm)

f64_file = os.path.join(tmppath, "data_f64.zarr")
with ZarrGroup(f64_file, mode="w", comm=self.comm) as zf:
flcarr_f64.write_zarr(zf)
if self.comm is not None:
self.comm.barrier()
with ZarrGroup(f64_file, mode="r", comm=self.comm) as zf:
check_f64 = FlacArray.read_zarr(zf, mpi_comm=self.comm)

if self.comm is not None:
self.comm.barrier()
del tmppath
del tmpdir

if check_i32 != flcarr_i32:
print(f"check_i32 = {check_i32}", flush=True)
print(f"flcarr_i32 = {flcarr_i32}", flush=True)
print("FAIL on i32 roundtrip to zarr", flush=True)
self.assertTrue(False)
else:
output_i32 = check_i32.to_array()
if not np.array_equal(output_i32, input32):
print("FAIL on i32 zarr decompressed array check", flush=True)
self.assertTrue(False)

if check_i64 != flcarr_i64:
print("FAIL on i64 roundtrip to zarr", flush=True)
self.assertTrue(False)
else:
output_i64 = check_i64.to_array()
if not np.array_equal(output_i64, input64):
print("FAIL on i64 zarr decompressed array check", flush=True)
self.assertTrue(False)

if check_f32 != flcarr_f32:
print("FAIL on f32 roundtrip to zarr", flush=True)
self.assertTrue(False)
else:
output_f32 = check_f32.to_array()
if not np.allclose(output_f32, inputf32, rtol=1.0e-5, atol=1.0e-5):
print("FAIL on f32 zarr decompressed array check", flush=True)
self.assertTrue(False)

if check_f64 != flcarr_f64:
print("FAIL on f64 roundtrip to zarr", flush=True)
self.assertTrue(False)
else:
output_f64 = check_f64.to_array()
if not np.allclose(output_f64, inputf64, rtol=1.0e-5, atol=1.0e-5):
print("FAIL on f64 zarr decompressed array check", flush=True)
self.assertTrue(False)