Suggested Function: InRange
There are situations where some points in a "destination" wave fall outside of that of the "source" wave. One example is when the destination wave is a rotated version of the source wave. In these situations the following code will throw an error:
destination = source(x)(y)
In some situations, the outlier points are irrelevant, and it is OK to set them to some default value (e. g., NaN). In these cases, it would be nice to have a function that calculates whether a specific value is in range. This would allow you to write:
destination = (InRange(x, 0, source) && InRange(y, 1, source)) ? source(x)(y) : NaN // second argument is dimension
While this is not terribly difficult to program on one's own (see below), it would be a handy utility function.
Just a thought (and nice new website!),
Melissa
variable yy, dim
wave wv
variable yMax, yMin
if(DimDelta(wv, dim) > 0)
yMax = DimOffset(wv, dim) + (DimSize(wv, dim) - 1) * DimDelta(wv,dim)
yMin = DimOffset(wv, dim)
else
yMin = DimOffset(wv, dim) + (DimSize(wv, dim) - 1) * DimDelta(wv,dim)
yMax = DimOffset(wv, dim)
endif
if((yy > yMin) && (yy < yMax))
return 1
else
return 0
endif
End
Hi Melissa,
Is this something that can be handled by Interp2d()?
AG
July 12, 2018 at 01:29 pm - Permalink