A thin, inspectable alternative to writing the Python yourself. The
return value is a plain string, so dbGetQuery(con, xr_query(...))
and dbGetQuery(con, "ds.sst.isel(time=0)") are the same thing. Print
it, log it, put it in a registry row.
Details
Rules for sel and isel values:
a length-2 numeric,
DateorPOSIXctvector becomes a Pythonslice(a, b)(a range on that dimension; forselthis is label-based and inclusive per xarray)a length-1 value is a scalar selection (drops the dimension)
character vectors, even of length 2, and longer vectors become Python lists: exact labels (
sel = list(station = c("A01", "B02"))) or positions. For a time range giveDateorPOSIXct, not stringsa
POSIXctis written as its instant in UTC, as xarray stores times
NOTE isel uses zero-based Python indices, faithfully: this function
interpolates values into Python source and does not translate them.
The compiled expression is the contract; inspect it.
See also
XarrayResult to run the statement; tbl() to compile statements from dplyr verbs instead.