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

Issue with horiz_interp #1533

Open
wfcooke opened this issue May 22, 2024 · 0 comments · May be fixed by #1538
Open

Issue with horiz_interp #1533

wfcooke opened this issue May 22, 2024 · 0 comments · May be fixed by #1538

Comments

@wfcooke
Copy link

wfcooke commented May 22, 2024

flag to show that weight arrays have been allocated may not be set.
optional arguments to bilinear interp_new cannot be used if using horiz_interp_new.

I assume that with FMS2 the desired use of horiz_interp_new is as follows.

call horiz_interp_new ( Interp, T_grid%x, T_grid%y, lon_out, lat_out, interp_method="bilinear")
followed by a
call horiz_interp_del( Interp )

I'm running into an issue where the interpolation point seems to be right on the corner of the grid. When this happens I end up at
call mpp_error(FATAL, "horiz_interp_bilinear_mod: No solution found")

I'll assume this issue cropped up previously as there used to be a workaround for this with the new_search and no_crash_when_not_found arguments.
However I can't send these down through the horiz_interp_new interface.

I used to call
call horiz_interp_bilinear_new (Interp, T_grid%xDEG_TO_RAD, T_grid%yDEG_TO_RAD,&
& lon_out, lat_out, new_search=.true., no_crash_when_not_found=.true.)

If I use this format and call
call horiz_interp_bilinear_del( Interp )
I then run into an issue when it loops around and tries to call horiz_interp_new again. It gives an allocation error.
The reason is that even though
include/horiz_interp_bilinear.inc HORIZ_INTERP_BILINEAR_NEW_2D
allocates
Interp%HI_KIND_TYPE_%wti
etc.
it does not set the value of
Interp% HI_KIND_TYPE_ % is allocated.
That is done in include/horiz_interp.inc HORIZ_INTERP_NEW

But when I call horiz_interp_bilinear_del it checks the value of is_allocated and neither the Real4 or Real8 logical is true. So it doesn't deallocate the weights and when I call the next horiz_interp_new I find they are already allocated.

How to get around this?

  1. Add the optional arguments to horiz_interp_new and pass them to horiz_interp_bilinear_new
    (this would allow me to use horz_interp_new/del)
    and
  2. Set Interp%XXX%is_allocated to true in each _new routine (bilinear,spherical, conserve)
    ?
@rem1776 rem1776 linked a pull request Jun 3, 2024 that will close this issue
8 tasks
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.

1 participant