Coder Social home page Coder Social logo

pinskylab / climateandmsp Goto Github PK

View Code? Open in Web Editor NEW
1.0 6.0 0.0 1.96 GB

Test the benefits and costs of proactively preparing for climate change-driven species shifts.

License: MIT License

R 100.00%
ocean-planning marine-conservation climate-change protected-areas marine-protected-areas biogeography ecosystem-services invest natural-capital

climateandmsp's Introduction

ClimateAndMSP

Scripts and data to test whether proactively preparing for climate change-driven shifts in species habitats produces effective ocean plans and whether it imposes tradeoffs.

These scripts are provided in the interests of open science. If you have questions or find errors, please let us know.

Contact:
Malin Pinsky
Rutgers University
[email protected]

DOI

Software versions

  • Software was executed on a laptop running Mac OS and on a Linux workstation running CentOS.
  • R version 3.6.1. Main scripting language, with the following packages:
    • maps 3.3.0
    • mapdata 2.3.0
    • maptools 0.9-5
    • rgdal 1.4-4
    • rgeos 0.5-1
    • raster 3.0-2
    • sf 0.7-7
    • data.table 1.12.8
    • beanplot 1.2
    • RColorBrewer 1.1-2
    • lme4 1.1-21
  • R version 3.5.3. This version of R was needed to run gurobi, part of the conservation planning algorithm. We used these packages:
    • prioritizr 4.1.4
    • gurobi 8.1-1
  • InVEST-3.7.0 and InVEST-3.7.0.post212+hd9612c04a8dc. Used for generating wind and wave energy estimates. The latter development version does not appear to be available anymore, but presumably, the bugs have been fixed in the newer releases.
  • Gurobi 8.1.1 with an academic license. Used for solving conservation planning problems.

Directory structure

  • code: scripts that are run using data, data_dl, and output, produce temp, output, figures, and tables
  • data/natcapt: has data and parameter files generated for this project. Only used for InVEST runs.
  • data_dl: has data that is easily downloaded (not tracked by git)
  • figures: plotted figures
  • output: files output by scripts and also used as input for some scripts (tracked by git)
  • tables: output tables
  • temp: temporary files output by scripts (not tracked by git)
  • temp_figures: temporary figures output by scripts (not tracked by git)

Analysis workflow (roughly... see below for more details)

  • 0.2_averageSBT.r: to set up a climatology
  • 1.0_processWDPA.r: grid the World Database on Protected Areas (WDPA)
  • 1.1_summarizeWDPAbygrid.r: calculate the fraction of protected area in each grid cell
  • 1.2_evalWDPA.r: compare protected areas to projected shifts in species habitats
  • 1.3_WDPAstats.r: summarize the shifts
  • 1.4_compare_WDPA_projections_data.r: Compare the projections to ecological survey observations
  • 3.0_make_NatCap_files.r: make input files for the wind and wave energy calculations by InVEST
  • 3.1_processNatCap.r: process the output from InVEST
  • 5.0_define_CMSP.r: set up the ocean planning analysis
  • 5.0.1_process_species_proj.r: summarize species habitat suitability on the ocean planning analysis grid
  • 5.1_prioritizr.r: run the ocean planning analysis with prioritizr
  • 5.2_evalprioritizr_ensemble.R: compare the ocean plans to the ensemble species projections
  • 5.2_evalprioritizr.r: compare the ocean plans to the individual species projections
  • 5.3_map_species_proj.r: optional maps of species habitat suitability
  • 5.3_plot_and_stats_prioritizr_evaluation.r: some optional plots and analysis examining the ocean plans
  • 6.0_WDPAnetworkstatsbyregion.R: statistics on the protected area networks
  • 6.1_evalRandomNetworks.r: evaluate randomly selected protected areas against shifts in species distribution
  • 6.2_turnover_by_CMSPgrid.R: community change in each ocean planning grid cell
  • prioritizr_frontier.r: ocean planning runs with a limited total area
  • plot_figures.r to make figures and some tables

Scripts and files behind figures, tables, and other calculations

All figures and Table S1 are produced by plot_figures.r. The nested lists below indicate which files are needed for each figure or table, as well as which scripts produce those files.

  1. General statistics from plot_figures.r.
    1. temp/presmap_*_rcp*_*.csv.gz and temp/biomassmap_*_rcp*_*.csv.gz
      1. 5.0.1_process_species_proj.r
        1. Species distribution projections from Morley et al. 2018 PLOS ONE, available from BCO DMO
    2. temp/wdpaturnbyMPAbymod.csv.gz
      1. 1.2_evalWDPA.r
        1. output/wdpa_cov_by_grid0.05.csv.gz
          1. 1.1_summarizeWDPAbygrid.r
            1. temp/wdpa_by_grid0.05_intersect.rds and temp/SPsf2.rds
              1. 1.0_processWDPA.r
                1. Species distribution projections from Morley et al. 2018 PLOS ONE: see above
                2. dataDL/WDPA/WDPA_Aug2019_marine-shapefile/WDPA_Aug2019_marine-shapefile
        2. Species distribution projections from Morley et al. 2018 PLOS ONE: see above
  2. Figure 1
    1. output/turnover_by_CMSPgrid.csv
      1. 6.2_turnover_by_CMSPgrid.R
        1. temp/presmap_*_rcp*_*.csv.gz: see above
    2. output/region_grid.csv.gz
      1. 5.0_define_CMSP.r
        1. temp/SPsf2.rds: see above
        2. dataDL/marineregions/World_EEZ_v10_20180221/eez_v10.shp
        3. dataDL/natcap/Marine/Land/global_polyline.shp
  3. Figure 2
    1. output/goalsmetbymod_hist_all.csv and output/goalsmetbymod_2per_all.csv
      1. 5.2_evalprioritizr.r
        1. output/prioritizr_runs/solution_*.csv and output/prioritizr_runs/spp_*.csv
          1. 5.1_prioritizr.r
            1. temp/presmap_*_rcp*_*.csv.gz and temp/biomassmap_*_rcp*_*.csv.gz: see above
            2. Kappa thresholds from Morley et al. 2018 PLOS ONE available here
            3. output/wind_npv.csv.gz and output/wave_npv.csv.gz
              1. 3.1_processNatCap.r
                1. ../NatCap_temp/westcoastwind/output/npv_US_millions.tif and ../NatCap_temp/eastcoastwind/output/npv_US_millions.tif
                  1. Produced with InVEST 3.7.0 (see below)
                    1. dataDL/natcap/WindEnergy/*.*
                    2. dataDL/natcap/Marine/*.*
                    3. temp/AOI_east.shp and temp/AOI_west.shp, made by 3.0_make_NatCap_files.r, which needs temp/SPsf2.rds (see above)
                2. temp/SPsf2.rds: see above
                3. ../NatCap_temp/westcoastwave/output/npv_usd.tif and ../NatCap_temp/eastcoastwave/output/npv_usd.tif
                  1. Produced with InVEST 3.7.0 (see below)
                    1. temp/AOI_east.shp and temp/AOI_west.shp: see above
                    2. dataDL/natcap/WaveEnergy/*.*
                    3. dataDL/natcap/Marine/*.*
                    4. output/landgridpts_northamerica.csv, made by 3.0_make_NatCap_files.r, which uses data/natcap/NAmainland_lines.shp, dataDL/usgs/citiesx020_nt00007/citiesx020.shp, and dataDL/statcan/lpc_000b16a_e/lpc_000b16a_e.shp
                    5. data/natcap/Machine_Pelamis_Economic_Kimetal2012r0.05.csv
            4. output/fishery_spps.csv
              1. 5.0_define_CMSP.r
                1. Species distribution projections from Morley et al. 2018 PLOS ONE: see above
                2. dataDL/sau/*.*
            5. output/region_grid.csv.gz: see above
        2. Kappa thresholds from Morley et al. 2018 PLOS ONE: see above
        3. output/region_grid.csv.gz: see above
        4. temp/presmap_*_rcp*_*.csv.gz and temp/biomassmap_*_rcp*_*.csv.gz: see above
  4. Figure 3
    1. output/prioritizr_runs/solution_*.csv: see above
  5. Figure 4
    1. temp/frontierall_2019-12-31_075440.csv
      1. prioritizr_frontier.r
        1. temp/presmap_*_rcp*_*.csv.gz and temp/biomassmap_*_rcp*_*.csv.gz: see above
        2. Kappa thresholds from Morley et al. 2018 PLOS ONE: see above
        3. output/wind_npv.csv.gz and output/wave_npv.csv.gz: see above
        4. output/fishery_spps.csv: see above
        5. output/region_grid.csv.gz: see above
    2. output/prioritizr_runs/spp_*.csv: see above
  6. Figure 5
    1. temp/wdpaturnbyMPAbymod.csv.gz and temp/wdpaturnbynetbymod.csv.gz
      1. 1.2_evalWDPA.r
        1. Species distribution projections from Morley et al. 2018 PLOS ONE: see above
        2. output/wdpa_cov_by_grid0.05.csv.gz: see above
  7. Figure S1
    1. temp/frontierall_2019-12-22_071607.csv and temp/frontierall_2019-12-31_075440.csv
      1. prioritizr_frontier.r: see above
      2. output/prioritizr_runs/spp_*.csv: see above
  8. Figure S2
    1. output/randMPAs_byBT.csv
      1. 6.1_evalRandomNetworks
        1. output/climatology.csv.gz
          1. 0.2_averageSBT.r
            1. Temperature projections from Morley et al. 2018 PLOS ONE: see above
        2. output/region_grid.csv.gz
        3. Species distribution projections from Morley et al. 2018 PLOS ONE: see above
    2. output/MPA_network_stats.csv
      1. 6.0_WDPAnetworkstatsbyregion.R
        1. output/climatology.csv.gz: see above
        2. output/wdpa_cov_by_grid0.05.csv.gz: see above
        3. temp/wdpaturnbyMPAbymod.csv.gz: see above
        4. output/region_grid.csv.gz: see above
  9. Figure S3
    1. temp/wdpa_trawlsppobs_byreg.csv.gz and output/MPAvstrawl_NPV_PPV.csv
      1. 1.4_compare_WDPA_projections_data.r
        1. dataDL/oceanadapt/all-regions-full.rds
        2. temp/wdpa_by_spp_projnow.rds
          1. 1.2_evalWDPA.r: see above
        3. output/name_conversions_obs_to_proj.csv
          1. generated by early part of 1.4_compare_WDPA_projections_data.r in an interactive loop
        4. temp/wdpa_by_grid0.05_intersect.rds: see above
        5. dataDL/WDPA/WDPA_Aug2019_marine-shapefile/WDPA_Aug2019_marine-shapefile-polygons.shp: see above
        6. Kappa thresholds from Morley et al. 2018 PLOS ONE: see above
  10. Table S1
    1. output/prioritizr_runs/solution_*.csv and output/prioritizr_runs/spp_*.csv: see above
  11. Table S4
    1. output/fishery_spps.csv: see above

InVEST runs

These are the detailed program settings used when InVEST was run.

  • East coast wind
    • run with InVEST-3.7.0.post212+hd9612c04a8dc version
    • wind data points: dataDL/natcap/WindEnergy/input/Global_EEZ_WEBPAR_90pct_100ms.csv
    • area of interest: temp/AOI_east.shp: see above
    • Bathymetric DEM: dataDL/natcap/Marine/DEMs/global_dem/w001001.adf
    • Land polygon: dataDL/natcap/Marine/Land/global_polygon.shp
    • Global wind energy parameters: dataDL/natcap/WindEnergy/input/global_wind_energy_parameters.csv
    • turbine type: dataDL/natcap/WindEnergy/input/5_0_turbine.csv
    • number of turbines: 16
    • min depth: 3m
    • max depth: 60 m
    • min distance: 0 m
    • max distance: 200000 m
    • turn on valuation
      • foundation: $2.5M/turbine
      • discount rate 0.05
      • Grid connections: [none]
      • average shore to grid distance: 5 km
      • no price table
      • price of energy: $0.161/kWhr
      • rate of price change: 0.025
  • West coast wind
    • run with InVEST-3.7.0.post212+hd9612c04a8dc version
    • wind data points: dataDL/natcap/WindEnergy/input/Global_EEZ_WEBPAR_90pct_100ms.csv
    • area of interest: temp/AOI_west.shp: see above
    • Bathymetric DEM: dataDL/natcap/Marine/DEMs/global_dem/w001001.adf
    • Land polygon: dataDL/natcap/Marine/Land/global_polygon.shp
    • Global wind energy parameters: dataDL/natcap/WindEnergy/input/global_wind_energy_parameters.csv
    • turbine type: dataDL/natcap/WindEnergy/input/5_0_turbine.csv
    • number of turbines: 16
    • min depth: 3m
    • max depth: 60 m
    • min distance: 0 m
    • max distance: 200000 m
    • turn on valuation
      • foundation: $2.5M/turbine
      • discount rate 0.05
      • Grid connections: [none]
      • average shore to grid distance: 5 km
      • no price table
      • price of energy: $0.161/kWhr
      • rate of price change: 0.025
  • East coast wave
    • run with InVEST-3.7.0.post212+hd9612c04a8dc version
    • wave data: dataDL/natcap/WaveEnergy/input/WaveData
    • analysis area: Global
    • AOI: temp/AOI_east.shp: see above
    • Machine performance table: dataDL/natcap/WaveEnergy/input/Machine_Pelamis_Performance.csv
    • Machine parameter table: dataDL/natcap/WaveEnergy/input/Machine_Pelamis_Parameter.csv
    • Global DEM: dataDL/natcap/Marine/DEMs/global_dem/w001001.adf
    • Valuation: yes
  • West coast wave
    • run with InVEST-3.7.0.post212+hd9612c04a8dc version
    • wave data: dataDL/natcap/WaveEnergy/input/WaveData
    • analysis area: Global
    • AOI: temp/AOI_west.shp: see above
    • Machine performance table: dataDL/natcap/WaveEnergy/input/Machine_Pelamis_Performance.csv
    • Machine parameter table: dataDL/natcap/WaveEnergy/input/Machine_Pelamis_Parameter.csv
    • Global DEM: dataDL/natcap/Marine/DEMs/global_dem/w001001.adf
    • Valuation: yes

climateandmsp's People

Contributors

bselden avatar larogers123 avatar mpinsky avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

climateandmsp's Issues

Projections outside of historical regions?

@larogers123
Something for us to ponder: should we project a species' model to a region in which the species has never been observed? We could restrict it to the same ocean, however.

The benefits are that we might capture new species moving into a region. The downside is that it's pretty far outside historical conditions to which our model has been fit. We'd have to come up with a dummy meanbiomass for the new region (which wouldn't be hard).

Confounded Seasons and Regions

We currently deal with seasons and regions inconsistently. For instance, the NEUS is divided into two "regions", i.e. surveys, which represent the two seasons surveys are conducted. Other surveys are not divided by season although they occur over multiple seasons. And the US West Coast is divided into two surveys that cover approx the same region and seasons, but in different years and possibly (?) with different gears.

This matters for model fitting details, particularly how we calculate a yearly mean biomass and whether we need different intercepts for each season. I/we need to think through this a bit more thoroughly to be sure we're not making a mistake.

Projection units and survey points on land

Currently in 7_rangeprojection.r, projections of CPUE (by wt) are made on a lat/lon grid. This is essentially the projected catch per unit of survey effort (~= survey haul) were a haul to be made in that particular place.

We then take the average of all projections within a larger grid box to calculate an average projected CPUE per cell (essentially accounting for the differences in rugosity within that cell).

For points that fall on land, rather than setting their CPUE to zero (as is currently in the code), I think we should just omit them from the average. Setting them to zero implies that our final output raster will be equivalent to a total catch within that cell (thus the catch within these coastal cells is lower in total), but I've rather been thinking of that raster as showing the relative density of fish. In this case, giving points on land a value of zero makes it look like the density of fish in the coastal areas is lower than otherwise.

It would be great to get from a density index (CPUE) to an absolute number, but I'm not sure how to do that. Possibly we could dig in to assessments (for assessed species), assume catchability for non-assessed species), and calculate area swept for a haul, etc. to get up to total abundance in an area, but would we gain much by doing this?

This should become clear at the next stage, so I'm flagging the points-on-land issue for now. To remove from average, just drop them from rugos object before merging with clim object.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.