NCC-CNC / wtw-data-prep

Scripts to prepare data for Where To Work tool
0 stars 0 forks source link

reshape species csv #6

Closed DanWismer closed 1 year ago

DanWismer commented 1 year ago

After the national data extractions, I build a csv that bins and counts .tiffs via their source:

https://github.com/NCC-CNC/wtw-data-prep/blob/9c317e4d96d608f1eb89073db7c3b06a9e5916ec/scripts/natdata_to_aoi_1km_grid.R#L308-L407

Here is an example of the output: SPECIES.csv

Instead, how about we pivot this, so there is a row for each layer? Much like how the metadata.csv looks. The reason for this species csv is mainly to get a quick idea of what species intersect your AOI. This has come up a few times where folks need that info, but don't need a full-out WTW project.

edwardsmarc commented 1 year ago

I like this idea. It would allow us to add additional columns if people requested more info. e.g. the number of PUs each species covers.

DanWismer commented 1 year ago

I took a first crack at it on the natdata-to-aoi repo (will retire this eventually). I parsed it out into its own script that can be ran after natdata-to-aoi. I like the area suggestion, I added that in. Takes a little longer to process but worth it.

https://github.com/NCC-CNC/natdata-to-aoi/blob/main/R/summarize_species.R

@edwardsmarc when you have time, could you add this into the wtw-data-prep repo?