Skip to content

MUR SST Kerchunk Recipe#259

Draft
sbquinlan wants to merge 38 commits intopangeo-forge:masterfrom
developmentseed:mursst-kerchunk
Draft

MUR SST Kerchunk Recipe#259
sbquinlan wants to merge 38 commits intopangeo-forge:masterfrom
developmentseed:mursst-kerchunk

Conversation

@sbquinlan
Copy link
Copy Markdown
Member

@sbquinlan
Copy link
Copy Markdown
Member Author

Comment on lines +215 to +226
# target_root is injected only into certain transforms in pangeo-forge-recipes
# this is a hacky way to pull it out of the WriteCombinedReference transform
hacky_way_to_pull = WriteCombinedReference(
store_name='mursst',
concat_dims=pattern.concat_dims,
identical_dims=identical_dims,
)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

storage_options=fsspec_open_kwargs,
)
| FilterVars(keep={*pattern.concat_dims, *IDENTICAL_DIMS, *SELECTED_VARS})
| WriteCombinedReference(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This depends on the main branch of pangeo-forge-recipes

@abarciauskas-bgse abarciauskas-bgse marked this pull request as draft January 12, 2024 22:18
@abarciauskas-bgse
Copy link
Copy Markdown

Moving this to draft until we can:

store_name=SHORT_NAME
)
| ConsolidateMetadata()
# | ValidateDatasetDimensions(expected_dims={'time': None, 'lat': (-90, 90), 'lon': (-180, 180)})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This does not work with the new output of ConsolidateMetadata so will need to revise or remove it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Can you try the local version of ConsolidateMetadata?

@beam.ptransform_fn
def ConsolidateMetadata(pcoll: beam.PCollection) -> beam.PCollection:
    """Consolidate metadata into a single .zmetadata field.
    See zarr.consolidate_metadata() for details.
    """

    def _consolidate(store: zarr.storage.FSStore) -> zarr.storage.FSStore:
        zarr.consolidate_metadata(store, path=None)
        return store

    return pcoll | beam.Map(_consolidate)

It would be nice if it returned FSStore like WriteCombinedReference @norlandrhagen

@abarciauskas-bgse Why is it preferred to write out the zarr and then consolidate the metadata?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@sbquinlan thanks for keeping track of this PR. I think we want to use transforms maintained by pangeo-forge-recipes when possible. In general, I think you have to write the zarr store before running a consolidate metadata operation but perhaps I am misunderstanding your question.

As it happens, we may be removing consolidate metadata altogether since we need to investigate if it is actually helpful to consolidate metadata for kerchunk reference files (or if someone can point me to where this has already been determined, that would be helpful).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think we want to use transforms maintained by pangeo-forge-recipes when possible

The question is basically should we change the committed implementation of ConsolidateMetadata to return the more useful FSStore instead of the less useful ConsolidatedMetadataStore. I can't see ConsolidatedMetadataStore being useful in pangeo-forge. This is more for @norlandrhagen rather than specific to this PR.

In general, I think you have to write the zarr store before running a consolidate metadata operation

Yeah I don't think this is true. It just needs a MutableMapping so you could do it in memory before writing it out, but that's my question basically: is it more performant to consolidate and then write out the references?

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.

2 participants