ESMG / pyroms

Python tools for the Regional Ocean Modeling System (ROMS)
Other
141 stars 88 forks source link

Transect interpolation #44

Closed dykdhi closed 1 year ago

dykdhi commented 1 year ago

In the transect function, the near and nearp arrays are initialized with dtype=int eg:

https://github.com/ESMG/pyroms/blob/32320b16d30132d7bf2a3be15f2c2358e20af0d1/pyroms/pyroms/tools.py#L770

This change was done in this commit: https://github.com/ESMG/pyroms/commit/76b9101a96999f870aa96c599ded97911da44ae0

Further down in the function, I believe floats are expected because this would allow for interpolation between two columns of data:

https://github.com/ESMG/pyroms/blob/32320b16d30132d7bf2a3be15f2c2358e20af0d1/pyroms/pyroms/tools.py#L853 https://github.com/ESMG/pyroms/blob/32320b16d30132d7bf2a3be15f2c2358e20af0d1/pyroms/pyroms/tools.py#L854

Due to near[n,1] being forced to int, I think one of these terms will always be zero while the other always 1, so no interpolation will happen.

I was able to convert the near and nearp arrays to dtype=np.float64 and then perform int conversions lower down in the function for all those places where an int is expected for indexing.

kshedstrom commented 1 year ago

Would you care to send a pull request?

dykdhi commented 1 year ago

Sure, please see PR https://github.com/ESMG/pyroms/pull/45