Lambda-based worker for running the R package marlin and integrating with geoprocessing.
This system relies on Lambda's support for containerized functions using a Dockerfile so that R can be included in the runtime environment, and lambdr which coordinates I/O between R and AWS.
Creates a docker image rlambda which is then hosted on AWS ECR. This image can be used to create a new Lambda function called run_marlin (must match name of function in runtime.R). See marlin reports for an example of using in SeaSketch.
(1) Perfect compliance with MPA no-take designations (2) All no-take MPAs for target species
Dockerfile: Builds image capable of running R and marlin in AWS lambda environment
runtime.R: Function which is individually called and run in lambda
local.R: Contains all the code to (1) setup required inputs for runtime.R and (2) reproduce plots locally
data: Contains all data inputs necessary for marlin
-
reef_ras.tif: Input reef dataset -
reef_ras.csv: Generated byreef_ras.tifinlocal.Rand used inruntime.R -
seagrass_ras.tif: Input seagrass dataset -
seagrass_ras.csv: Generated byseagrass_ras.tifinlocal.Rand used inruntime.R -
seagrass_reef_ras.tif: Input seagrass reef dataset -
seagrass_reef_ras.csv: Generated byseagrass_reef_ras.tifinlocal.Rand used inruntime.R -
Existing-MPAs.geojson.json: Existing Belize MPA polygons -
existingMPAs.json: Output of running marlin withExisting-MPAs.geojson.jsoninlocal.R, used in comparison plot in SeaSketch -
noMPA.json: Output of running marlin with no MPAs inlocal.R, used in comparison plot in SeaSketch -
sketch.geojson.json: Test proposed MPA polygons, used in running and testingruntime.Rand running locally -
coordinates.json: X and Y coordinates within Belize study area, generated inlocal.R, used in SeaSketch
docker build --progress=plain -t rlambda .
aws ecr create-repository --repository-name marlin --image-scanning-configuration scanOnPush=true
docker tag rlambda:latest [REPOSITORY_URL]:latest
docker push [REPOSITORY_URL]:latest