Skip to content

Improved testing of ChunkCachedArray - #2920

Merged
VeckoTheGecko merged 2 commits into
Parcels-code:mainfrom
VeckoTheGecko:push-szrxsklmolol
Sep 30, 2026
Merged

VeckoTheGecko merged 2 commits into
Parcels-code:mainfrom
VeckoTheGecko:push-szrxsklmolol

Conversation

@VeckoTheGecko

Copy link
Copy Markdown
Contributor

Description

Adds hypothesis strategies for ChunkCachedArray and vectorized indexers. This clearly maps out the current indexing support of ChunkCachedArray so that we can see how to proceed.

I hope to fix the limited indexing support in a future PR

Checklist

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
    • Describe how you used it (e.g., by pasting your prompt): Guided hypothesis test suite generation using Claude code. Starting prompt was "I want you to create some hypothesis strategies related to indexing ChunkCachedArray. First, create a strategy that is able to generate these arrays (you can use a strategy for generating numpy arrays, use that to make Dask arrays, and use that to generate the ChunkCachedArray objects. Also create a strategy to generate objects for vectorized indexing (i.e., slices, arrays of integers) - anything that can be used as an indexer in vectorized indexing. Finally, I want you to test ChunkCachedArray against these different vectorized indexers."

Equal-length 1D integer arrays (the case used within Parcels) pass. Empty
index arrays, broadcasting, N-D index arrays and slices are not supported
and are marked as xfail.
@VeckoTheGecko VeckoTheGecko changed the title Improve testing of ChunkCachedArray Improved testing of ChunkCachedArray Sep 30, 2026
from hypothesis import strategies as st
from xarray.core.indexing import NumpyIndexingAdapter, VectorizedIndexer

import parcels._strategies.chunk_cached_array as ccast

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since cca is short for ChunkCachedArray and st is short for strategies, ccast is short for ChunkCachedArray strategies

@erikvansebille erikvansebille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - nice implementation of hypothesis testing!

@VeckoTheGecko
VeckoTheGecko merged commit 3193af7 into Parcels-code:main Sep 30, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants