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

regrid nearest with mask fails for input grid extent less than target grid extent #1718

Closed
anja-bom opened this issue May 16, 2022 · 2 comments · Fixed by #1720
Closed

regrid nearest with mask fails for input grid extent less than target grid extent #1718

anja-bom opened this issue May 16, 2022 · 2 comments · Fixed by #1720
Assignees

Comments

@anja-bom
Copy link
Contributor

anja-bom commented May 16, 2022

When running land-sea-aware regridding there is an issue where the input grid-extent is smaller than the target grid-extent ( there are output points where no mapping to input points)

Command run:

improver regrid --regrid-mode nearest-with-mask input.nc output_grid.nc input_landmask.nc --output output.nc

input_landmask.nc and input.nc have grid extents smaller than that of output_grid.nc

The error:

improver/utilities/spatial.py", line 458, in maximum_within_vicinity
    unmasked_cube_data[cube.data.mask] = -np.inf
OverflowError: cannot convert float infinity to integer

The -np.inf does not convert to an integer, replacing this with a regular number (eg. netcdf fill-value for integers) would solve the issue.

Acceptance criteria:

  • Agreed approach to handling initialisation of unmasked_cube_data
  • Code changes so CLI runs successfully independent of size of relevant extents of initial and target grids
  • All acceptance and unit tests pass with code-changes implemented.
@tjtg
Copy link
Contributor

tjtg commented May 16, 2022

It would also be worthwhile to add unit and/or acceptance tests for this case where the input grid is smaller than the output grid.

@anja-bom anja-bom self-assigned this May 17, 2022
@tjtg
Copy link
Contributor

tjtg commented Jun 8, 2022

Addition of tests to cover this situation is being tracked in issue #1737.

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 a pull request may close this issue.

2 participants