Skip to content

Update prepEcoregions() to use terra #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: development
Choose a base branch
from

Conversation

DominiqueCaron
Copy link

I realized that we currently are probably not able to provide a ecoregionRst to Biomass_borealDataPrep, since the function LandR::prepEcoregions was still using the raster syntax.

Here is my fix.

@achubaty
Copy link
Contributor

  1. yes, you can pass it to the module (but you can also pass ecoregionLayer and specify which field/column to use and have the module make it);
  2. can you confirm this change doesn't break the previous behaviour for raster object?

@DominiqueCaron DominiqueCaron marked this pull request as draft March 12, 2025 14:22
@DominiqueCaron
Copy link
Author

Ok - I put this as a draft for now.

Either way, I believe ecoregionRst could not be a spatRaster (because of the notation ecoregionRst@data@attributes).

I'll make some change to make sure it keeps the same behaviour as before when its a raster object.

@DominiqueCaron DominiqueCaron marked this pull request as ready for review March 12, 2025 15:58
@DominiqueCaron
Copy link
Author

Should be good now.

@achubaty
Copy link
Contributor

it's weird that ecoregionTable is created for the SpatRaster cases (NULL or user-supplied) when it's not being created for the RasterLayer case -- this suggests the RasterLayer case remains broken. are you able to look at that? git blame is likely useful here to see whether relevant code was inadvertently removed.

@DominiqueCaron
Copy link
Author

The lines creating ecoregionTable when it's a RasterLayer were deleted here: 03907db

I re-added them.

@ianmseddy
Copy link
Contributor

I noticed the spatRaster issue earlier - I believe Dom is correct, due to that data@attributes line - something was missed in the conversion to terra. I had a fix locally but did not push as I wasn't sure if it was correct for factor rasters - I'll review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants