I have a regional netcdf file with chlorophyll data and want to add a new variable "region" that maps information about the maritime region. So for each coordinate point there would be an information to which region this point belongs.
So for all points in the netcdf file laying in the region of the Mediterranean sea, the variable "region" would for example contain the value 0 and for all points laying in the region of the North Sea, the variable "region" would for example contain the value 1 and so on...
I found a shapefile containing maritime regions based on biogeochemical processes (Longhurst Provinces). Now I want to use this shapefile to define my "region" variable in the netcdf file. Does anybody know how I could do that in R?
I think my question is close to this post by DKRZ but I don't want to extract/mask only one region but map all regions that are defined in the shapefile.
The files can be found here:
https://drive.google.com/file/d/1kgPpHFapmuclDyUvw2TH_10i018GE9YH/view?usp=sharing
https://drive.google.com/file/d/1WLYEUs6XllZv6i0xjRif-N0syhR2lX01/view?usp=sharing
Thanks a lot already!
EDIT
I found this post that helped me to solve my problem:
https://www.r-bloggers.com/2014/05/converting-shapefiles-to-rasters-in-r/)