Repository navigation
Add Pangeo CMIP6 ArchiveIndex accessor (closes #284) - #287
ahmedmohiduet wants to merge 2 commits into
Conversation
Adds packages/third_party/pangeo_site_archive with PangeoCMIP6, an ArchiveIndex that reads CMIP6 variables from the Pangeo ARCO cloud archive, plus offline unit tests, CI install/coverage entries and a docs section. Closes ACCESS-Community-Hub#284. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Unqqtp91DWVC8ro9Y724iN
|
Hi @stevehadd, A note about this PR in relation to ICCS Hacktoberfest 2026, which I'm taking part in. The event asks participants not to use AI tools for their pull requests. As declared in the description above, I used a generative AI assistant (Claude Sonnet 5.5) substantially to prepare this PR. I had not read the event's rule when I opened it, so I wrote to the organisers. Marion Weinzierl at ICCS replied that if you are happy to accept this contribution, then it is OK for this one case. So my question is: are you happy to accept this PR as a contribution for the event? I understand completely if you would rather not. Either way it remains a normal PyEarthTools contribution, and I'm glad to make any changes you'd like, including on the design questions in the description. Thank you, and sorry for the extra work. |
stevehadd
left a comment
There was a problem hiding this comment.
Thanks, @ahmedmohiduet that PR requests looks, code is clear, good tests. I have tested the accessor and loaded fine, and also run the unit tests, everything passed.
I only added one suggestion about the catalog, which you can ignore. I'll now pass you over to @tennlee for review and approval before merging.
| ) | ||
| self.record_initialisation() | ||
|
|
||
| def _load_catalog(self) -> pandas.DataFrame: |
There was a problem hiding this comment.
my only suggestion was about helping people find what is available in this dataset. I wondered if we could have a static function on the class which returns the catalog as a pandas dataframe, so the user can programmtically discover what data is available?
There was a problem hiding this comment.
got it. Will add static method PangeoCMIP6.catalog() returning catalogue as pandas.DataFrame, so users can browse source_id, experiment_id and variable_id values before constructing index.
There was a problem hiding this comment.
pushed commit adding PangeoCMIP6.catalog().
Returns the Pangeo CMIP6 catalogue as a pandas.DataFrame so users can discover available data. Includes a unit test.
Closes #284 (part of #276).
What this adds
A new third-party package,
packages/third_party/pangeo_site_archive(import namesite_archive_pangeo), containingPangeoCMIP6, anArchiveIndexfor the Pangeo CMIP6 cloud archive (ARCO Zarr on Google Cloud, anonymous access).Also changed:
requirements_cicd.txt(editable install of the new package),.github/workflows/python-app.yml(adds it to--cov), and a short section indocs/data.md.Design choices
pandas+xarrayinstead of intake-esm. The catalogue is a single CSV;pandas.read_csvwithusecolsis enough, keeps the dependency list topandas,xarray,zarr,gcsfs, and makes the tests offline (they use a small fixture CSV).catalog=), with noROOT_DIRECTORIES.register_archivedoes asetattronpyearthtools.data.archivefor each registered package, and both the NCI and AWS packages register their ownROOT_DIRECTORIESunder the same name, so importing both silently clobbers one. Passing the catalogue explicitly avoids that for this package.filesystem()returns one Zarr store URL per variable and ignores the time. The baseretrievealready doesdata.sel(time=...)afterload(), soload()can return the lazy store. Nothing is downloaded until the data is computed.versionis used when a variable has several; several grids raise an error asking forgrid_label, rather than silently choosing one.xarray.merge(..., join="exact", compat="minimal")after selecting[[variable]]from each store.join="exact"fails loudly if the grids differ.compat="no_conflicts"raised aMergeErroron the scalarheightcoordinate (2 m fortas, 10 m foruas), andoverridewould silently keep the wrong height.__init__does no network access (the catalogue is read lazily and once), becauseregister_archiveattaches.sample(), which constructs the class fromsample_kwargs.exists()is overridden, because the base implementation turns thegs://URLs intoPathobjects.data_intervalis left unset in this first PR. When it is set,ArchiveIndex.searchcalls.values()on a list and the blanketexcept Exception: passhides the failure.series()therefore needs an explicit interval.Known limitation
When variables disagree on a scalar coordinate (e.g.
heightfortas+uas), that coordinate is dropped from the merged dataset. It is kept when they agree (tasalone, ortas+pr). This is covered by a regression test.Testing
pytest --cov=site_archive_pangeo --cov-branch). No test touches the network;xarray.open_zarris monkeypatched.historical,r1i1p1f1,Amon) for["tas"],["tas","pr"],["tas","uas"]and["tas","uas","pr"]. All four load and returntime=1, latitude=64, longitude=128forPetdt("2000-01").pre-commit(end-of-file-fixer, trailing-whitespace, black, ruff) passes.Questions for reviewers
pangeo_site_archive, importsite_archive_pangeo, distributionPyEarthTools-archive-Pangeo, and archive namepangeo.third_party?noci-marked live test, or is the offline suite enough?I'm happy to make changes or add more tests wherever you think they're needed. Please let me know which cases or behaviours you'd like covered.
Checklist
docs/data.md)Generative AI declaration
ArchiveIndex,AdvancedTimeIndex,register_archive, the NCI and AWS packages) work, (b) draftpangeo_cmip6.py, the unit tests, thedocs/data.mdsection and this description, and (c) debug theheightmerge conflict.