Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MUR SST Kerchunk Recipe #259

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from

Conversation

sbquinlan
Copy link

@sbquinlan
Copy link
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
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(

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

Moving this to draft until we can:

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

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
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?

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
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