Skip to content

Grabbing too much data when using a particular server, using xoak.sel #43

Open
@kthyng

Description

@kthyng

Hi! I am hitting a memory problem I think due to what the docs describe for xoak.sel of "This triggers dask.compute() if the given indexers and/or the index coordinates are chunked." But, is there any way to move past this given that behavior?

Here is an example to see what I mean:

import xarray as xr
import xoak
loc = "https://opendap.co-ops.nos.noaa.gov/thredds/dodsC/CIOFS/fmrc/Aggregated_7_day_CIOFS_Fields_Forecast_best.ncd"
ds = xr.open_dataset(loc, drop_variables=["ocean_time","time_run"], chunks={})
var = ds["temp"]
lon, lat = -151, 59
ds_to_find = xr.Dataset(
    {
        "lat_to_find": ("locs", [lat], {"standard_name": "latitude"}),
        "lon_to_find": ("locs", [lon], {"standard_name": "longitude"}),
    }
)
var.xoak.set_index(["lat_rho", "lon_rho"], "sklearn_geo_balltree")
output = var.xoak.sel(
        {"lat_rho": ds_to_find.lat_to_find, "lon_rho": ds_to_find.lon_to_find}
    )
output.isel(s_rho=-1).load()

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions