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

update with newest options #1

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions recipes/gpm_imerg/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from requests.auth import HTTPBasicAuth

from pangeo_forge_recipes.patterns import ConcatDim, FilePattern
from pangeo_forge_recipes.transforms import OpenWithKerchunk, WriteCombinedReference
from pangeo_forge_recipes.transforms import OpenWithKerchunk, WriteCombinedReference, ConsolidateMetadata

ED_USERNAME = os.environ['EARTHDATA_USERNAME']
ED_PASSWORD = os.environ['EARTHDATA_PASSWORD']
Expand Down Expand Up @@ -109,20 +109,6 @@ def earthdata_auth(username: str, password: str):
fsspec_open_kwargs = earthdata_auth(ED_USERNAME, ED_PASSWORD)


# Remove method when https://github.com/pangeo-forge/pangeo-forge-recipes/pull/556/files is merged.
@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)


@dataclass
class ValidateDatasetDimensions(beam.PTransform):
"""Open the reference.json in xarray and validate dimensions."""
Expand Down Expand Up @@ -163,9 +149,6 @@ def expand(
concat_dims=CONCAT_DIMS,
identical_dims=IDENTICAL_DIMS,
store_name=SHORT_NAME,
target_options=fsspec_open_kwargs,
remote_options=fsspec_open_kwargs,
remote_protocol=earthdata_protocol,
)
| ConsolidateMetadata()
| ValidateDatasetDimensions(
Expand Down
1 change: 1 addition & 0 deletions recipes/gpm_imerg/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
s3fs==2023.10.0
boto3==1.28.71
pangeo-forge-recipes>=0.10.4