Skip to content

WIP: Support complex64 _FillValue#870

Closed
maxrjones wants to merge 1 commit intozarr-developers:mainfrom
maxrjones:c-dtype
Closed

WIP: Support complex64 _FillValue#870
maxrjones wants to merge 1 commit intozarr-developers:mainfrom
maxrjones:c-dtype

Conversation

@maxrjones
Copy link
Member

I'll open a PR upstream in Xarray to add support there, but wanted to share this PR for anyone who wants to try out virtualizing the first NISAR files before that lands:

#!/usr/bin/env -S uv run
# /// script
# requires-python = ">=3.11"
# dependencies = [
#     "earthaccess",
#     "virtualizarr[hdf] @ git+https://github.com/maxrjones/VirtualiZarr@c-dtype",
#     "obspec-utils @ git+https://github.com/virtual-zarr/obspec-utils@main",
#     "aiohttp",
# ]
# ///
"""MVCE: Virtualize a NISAR HDF5 file."""

from urllib.parse import urlparse
import earthaccess
import virtualizarr as vz
from obspec_utils.registry import ObjectStoreRegistry
from obspec_utils.stores import AiohttpStore

# URL of the NISAR granule
url = "https://nisar.asf.earthdatacloud.nasa.gov/NISAR/NISAR_L2_GCOV_BETA_V1/NISAR_L2_PR_GCOV_003_005_D_077_4005_DHDH_A_20251017T132451_20251017T132526_X05007_N_F_J_001/NISAR_L2_PR_GCOV_003_005_D_077_4005_DHDH_A_20251017T132451_20251017T132526_X05007_N_F_J_001.h5"

# Authenticate and create store
earthaccess.login()
parsed = urlparse(url)
base_url = f"{parsed.scheme}://{parsed.netloc}"
token = earthaccess.get_edl_token()["access_token"]

store = AiohttpStore(base_url, headers={"Authorization": f"Bearer {token}"})
registry = ObjectStoreRegistry({base_url: store})

# Virtualize the file
parser = vz.parsers.HDFParser()
manifest_store = parser(url, registry=registry)

# Count arrays recursively
def count_arrays(group):
    n = len(group.arrays)
    for g in group.groups.values():
        n += count_arrays(g)
    return n

print(f"Total arrays: {count_arrays(manifest_store._group)}")
  • Closes #xxxx
  • Tests added
  • Tests passing
  • Full type hint coverage
  • Changes are documented in docs/releases.rst
  • New functions/methods are listed in api.rst
  • New functionality has documentation

@maxrjones maxrjones marked this pull request as draft February 5, 2026 01:41
@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.12%. Comparing base (973d835) to head (ce57d5b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #870      +/-   ##
==========================================
+ Coverage   89.11%   89.12%   +0.01%     
==========================================
  Files          34       34              
  Lines        1956     1959       +3     
==========================================
+ Hits         1743     1746       +3     
  Misses        213      213              
Files with missing lines Coverage Δ
virtualizarr/parsers/utils.py 92.85% <100.00%> (+20.12%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maxrjones
Copy link
Member Author

Superceded by pydata/xarray#11151

@maxrjones maxrjones closed this Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant