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

Propagate pixels_per_tile_kwarg #131

Merged
Merged
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
10 changes: 8 additions & 2 deletions ndpyramid/regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def make_grid_ds(
def make_grid_pyramid(
levels: int = 6,
projection: typing.Literal['web-mercator', 'equidistant-cylindrical'] = 'web-mercator',
pixels_per_tile: int = 128,
) -> dt.DataTree:
"""helper function to create a grid pyramid for use with xesmf

Expand All @@ -136,7 +137,10 @@ def make_grid_pyramid(
Multiscale grid definition
"""
plevels = {
str(level): make_grid_ds(level, projection=projection).chunk(-1) for level in range(levels)
str(level): make_grid_ds(
level, projection=projection, pixels_per_tile=pixels_per_tile
).chunk(-1)
for level in range(levels)
}
return dt.DataTree.from_dict(plevels)

Expand Down Expand Up @@ -233,7 +237,9 @@ def pyramid_regrid(

if target_pyramid is None:
if levels is not None:
target_pyramid = make_grid_pyramid(levels, projection=projection)
target_pyramid = make_grid_pyramid(
levels, projection=projection, pixels_per_tile=pixels_per_tile
)
else:
raise ValueError('must either provide a target_pyramid or number of levels')
if levels is None:
Expand Down