-
Notifications
You must be signed in to change notification settings - Fork 3
New function: gcLocatorCreate #63
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
base: development
Are you sure you want to change the base?
New function: gcLocatorCreate #63
Conversation
|
I think there's a chance that we don't need this function since CBM_dataPrep and CBM_vol2biomass_SK can accept multiple columns for This will give you a More info here: PredictiveEcology/CBM_vol2biomass_SK#27 |
|
That's a good point it could work like this too, and I could get rid of this function entirely. Unless we would want to have a tangible gcLocator raster for whatever reason (in which case we can probably go about it a different way too). I'll look into doing a run this way with the SCANFI files. Currently our |
|
Definitely could still be a nice function to have in our repertoire regardless! One thing that is nice about using the multiple columns from "raw" sources is it leads to more reproducible code - no need to ask "how was this gcIndexLocator raster made"? It also makes it easy if we want to swap just one source - e.g. speciesID - to see how it changes things. |
|
So.... weird update here, I ran the SCANFI data with the edited |
|
Good work here. |
|
Looking into this a bit: I put a temporary stop here to ensure that I threw this in because there's quite a bit of following code in the |
This adds a new function called
gcLocatorCreate.This function builds the gcLocator raster layer. This was built according to the data we have for Saskatchewan, where we already had a productivity class and spatial unit raster layer, along with a growth curve lookup csv that assigns the correct gcid to each combination of productivity class, spatial unit id, and leading species for the province. Whenever I would try to run a new data source, I'd have to rebuild the gcLocator file, so I figured a quick function would be simplest moving forward.
Currently the function only works if all 3 raster layers are in the same CRS and all have the same extents. I can either add a check for this and put a stop in the function if they don't and explicitly let the user know that these don't match, or I can add some sort of if/else situation that will reproject so that all the layers match. I'm leaning towards just a check and letting the user mess with their own files rather than forcing a projection change.
With this function, you can build a gcLocator layer as long as you have a growth curve lookup table, and raster layers for productivity class, spatial unit IDs, and leading species. This should hopefully make using new data sources in traditional (non LandR) spadesCBM simpler.
I'm setting this as a draft for now, so I can settle on a decision about what to do if extents/CRS don't match, get the documentation in order, and also because the package version numbers will definitely be wildly different once some of the larger plotting PRs go through later, so I haven't change that on my end.