LandSciTech / ROFSim

Other
0 stars 1 forks source link

Add bird models #9

Closed see24 closed 2 years ago

see24 commented 2 years ago

@josie-hughes This is working now if you want to take a look. You will need the bird model files and a lookup table for the plc classes which the setup script expects to be at file.path(sourceData, "ROFBirdModels") I can upload this folder with models for 2 bird species to google drive if there is a folder that works for you or you could build the models using this script in the ROFBirds repo I made https://github.com/LandSciTech/ROFBirds/blob/main/analysis/scripts/prepare_data.R but you will need to download the bird data from Andy on google drive. Make sure to install the latest version of caribouMetrics before attempting to run as I needed to tweak the loadSpatialInputs function to make it work.

My approach was to use data that was already included in the demo library to train the models and then use the same to do the predictions. I had to make additional rasterized versions of the roads and esker data in the data preparation step since the caribouHabitat model needs these at a 400m resolution. The bird model script loads the data similarly to the caribou model, does a moving window and then loads the fitted brt object based on a folder and the species code that are passed as inputs.

It would probably be good to consider making the data loading and filtering to timestep/iteration part a function since it is now used twice. That might also help with allowing more flexible data to be provided.