MathMarEcol / spatialplanr

Spatial Planning workflow for the MME Lab
https://mathmarecol.github.io/spatialplanr/
Other
9 stars 1 forks source link

Start incorporating additional data in spatialplanr vignette from oceandatr #82

Closed jaseeverett closed 7 months ago

jaseeverett commented 10 months ago

Start to write some code to extract additional features from offshoredatr for the East Australia planning region.

https://github.com/emlab-ucsb/offshoredatr

Below are some examples I wrote which use raster. Jason flower has now updated the code to accept sf objects so you should be a able to replace planning_grid = planning_grid with PUs and extract the same data.

bathymetry <- offshoredatr::get_bathymetry(planning_grid = planning_grid, keep = FALSE)
geomorphology <- offshoredatr::get_geomorphology(area_polygon = micro_eez, planning_grid = planning_grid)
knolls <- offshoredatr::get_knolls(area_polygon = micro_eez, planning_grid = planning_grid)
seamounts <- offshoredatr::get_seamounts_buffered(area_polygon = micro_eez, planning_grid = planning_grid, buffer_km = 30)
coral_habitat <- offshoredatr::get_coral_habitat(area_polygon = micro_eez, planning_grid = planning_grid)
enviro_regions <- offshoredatr::get_enviro_regions(area_polygon = micro_eez, planning_grid = planning_grid, max_num_clusters = 5)

When you are comfortable that these example work, include them in the spatialplanr.Rmd vignette BEFORE we start the prioritisation (just after the AquaMaps feature analysis and data prep)

jaseeverett commented 10 months ago

offshoredatr has now been renamed to oceandatr and some of the code has been simplified.

The simplified code looks like:

bathymetry <- oceandatr::get_bathymetry(planning_grid = planning_grid, keep = FALSE)
geomorphology <- oceandatr::get_geomorphology(planning_grid = planning_grid)
knolls <- oceandatr::get_knolls(planning_grid = planning_grid)
seamounts <- oceandatr::get_seamounts_buffered(planning_grid = planning_grid, buffer = 30000)
coral_habitat <- oceandatr::get_coral_habitat(planning_grid = planning_grid)
enviro_regions <- oceandatr::get_enviro_regions(planning_grid = planning_grid, max_num_clusters = 5)
jaseeverett commented 9 months ago

Thanks Kilian. Looks good. We also want to make it work for other data (like Bathymetry so rename the cost and cost_names to something like data and col_names In answer to your question on Slack, you should put a small bit of code (not a whole Rmd file) to allow me to run the function. Otherwise I can't tell if it works or not. But it looks like you are still playing with it, so it probably doesn't matter here.

jaseeverett commented 9 months ago

Another update to the oceandatr package.

The analysis/gridding code from oceandatr has been moved into a new package called spatialgridr. So oceandatr contains all the data. spatialgridr contains the code. So the data_to_planning_grid code will now be housed in spatialgridr. Both packages are still available on the emlab GitHub organisation.

Also note some name changes:

From Jason Flower:

I've made a lot of changes to spatialgridr and wanted to summarize these as they will have cascading effects for you both - sorry, but hopefully this will be the last name changes for a while! The renaming was partly based on a suggestion from Jase: Function data_to_planning_grid renamed get_data_in_grid and argument planning_grid = changed to spatial_grid = Function get_planning_grid renamed to get_grid and will now be housed in the spatialgridr package Internal functions raster_to_planning_grid and sf_to_planning_grid both dropped the planning part of their name and renamed argument planning_grid = to spatial_grid = I've also built the spatialgridr webpage!