Closed imcslatte closed 2 years ago
Hi @imcslatte! I guess my PR closed this issue automatically, but just wanted to come back and say thanks for the issue report and I tried your example code with the small change I made to comment out some code (indeed the code was clearly wrong) and seems to work now.
I'm probably missing something, but there seems to be an issue interpolating in space the barotropic (2-d spatial., plus time) output variables. (such as zeta) in the below code I and trying to interpolate zeta to a -D set of spatial points, and throws an error.
`import xroms import xarray as xr
lat=[-68.7712, -69.0220, -68.9802, -69.5237, -70.7780, -72.0740, -73.1610, -73.2865, -73.9972, -74.6661] lon=[ 43.1379, 42.3528, 41.6986, 40.9136, 40.7173, 40.3902, 40.0304, 39.3435, 38.5911, 37.5117]
url='https://tds.marine.rutgers.edu/thredds/dodsC/roms/doppio/2017_da/his/History_Best' ds=xroms.open_netcdf(url) dstmp=ds.isel(time=100) test = dstmp.zeta.xroms.interpll(lon, lat,which='pairs') `
The error is:
IndexError Traceback (most recent call last) /tmp/ipykernel_184701/2301636929.py in
26 ds=xroms.open_netcdf(url)
27 dstmp=ds.isel(time=100)
---> 28 test = dstmp.zeta.xroms.interpll(lon, lat,which='pairs')
/cache/home/elhunter/python/packages/xroms/xroms/accessor.py in interpll(self, lons, lats, which) 1360 """ 1361 -> 1362 return xroms.interpll(self.da, lons, lats, which=which) 1363 1364 def isoslice(self, iso_values, iso_array=None, axis="Z"):
/cache/home/elhunter/python/packages/xroms/xroms/interp.py in interpll(var, lons, lats, which) 102 # get z coordinates to go with interpolated output if not available 103 if zkeyvarint == []: --> 104 zkey = [coord for coord in var.coords if "z" in coord and "0" not in coord][ 105 0 106 ] # str
IndexError: list index out of range
It looks as though it is trying to find a vertical coordinate, and fails since the zeta variable does not have one. Is that correct?
Thanks, Eli