Skip to content

Fix SeparateICZarrWriterAdapter mislabeling time calendar as julian#1325

Open
brianhenn wants to merge 1 commit into
mainfrom
fix/zarr-time-calendar-label
Open

Fix SeparateICZarrWriterAdapter mislabeling time calendar as julian#1325
brianhenn wants to merge 1 commit into
mainfrom
fix/zarr-time-calendar-label

Conversation

@brianhenn

Copy link
Copy Markdown
Contributor

The zarr data writer used with separate_ensemble_members: true (SeparateICZarrWriterAdapter) encoded the time coordinate values using the source calendar but constructed the ZarrWriter without a time_calendar argument, so the coordinate was always tagged with the default "julian" calendar. For non-julian data (e.g. the noleap CM4 piControl dataset) this silently mislabeled every timestamp, so any reader that honors the CF calendar attribute misinterprets the dates (a >1-year offset for piControl data starting near year 1). This PR passes the source calendar through to the writer so the label matches the already-correct encoded values.

Changes:

  • fme.ace.inference.data_writer.zarr.SeparateICZarrWriterAdapter._initialize_writers: pass time_calendar=first_batch_time.dt.calendar when constructing each ZarrWriter.

  • fme.ace.inference.data_writer.test_zarr.test_separate_ic_writer_preserves_time_calendar: new regression test, parametrized over julian/proleptic_gregorian/noleap, asserting the stored time calendar attribute matches the source and decoded times round-trip. Fails on noleap/proleptic_gregorian before the fix.

  • Tests added

  • If dependencies changed, "deps only" image rebuilt and "latest_deps_only_image.txt" file updated

Resolves #1324

The separate-ensemble-members zarr writer encoded the time coordinate
values using the source calendar but constructed the ZarrWriter without
a time_calendar argument, so the coordinate was always tagged with the
default 'julian' calendar. For non-julian data (e.g. noleap) this
silently mislabeled every timestamp, causing readers that honor the CF
calendar attribute to misinterpret the dates.

Pass time_calendar=first_batch_time.dt.calendar so the label matches the
already-correct encoded values, and add a regression test parametrized
over julian/proleptic_gregorian/noleap.
@brianhenn brianhenn force-pushed the fix/zarr-time-calendar-label branch from 5241996 to b505173 Compare June 26, 2026 22:46
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.

SeparateICZarrWriterAdapter mislabels the time coordinate calendar as "julian" for non-julian (e.g. noleap) data

1 participant