Skip to content

Memory error when using pfocal on a large raster such as the ROF #28

Description

@see24

I get this error message when I use the caribouMetrics package with pfocal for the ROF dataset

Error: memory exhausted (limit reached?)

I assume this is because pfocal converts the raster to a matrix before passing it to the C++ code. The raster package has a way to handle this using canProcessInMemory to decide when to process the raster in blocks. It is a bit complicated for focal because you need overlapping blocks but raster::focal does it like this:
https://github.com/rspatial/raster/blob/6860faa17fd2f1e8b8b54b2a1bf5074930ff3795/R/focal.R#L125

I have found before that canProcessInMemory is quite conservative about what can be processed by default so you would want to be sure it was only triggered when actually necessary.

Would it be worth while to have something similar for pfocal?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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