GithubHelp home page GithubHelp logo

mpb's People

Contributors

achubaty avatar eliotmcintire avatar

Watchers

 avatar  avatar  avatar  avatar

mpb's Issues

implement caching for data import modules

once we have a working copy of the crop-reproject function/module from @MelinaHoule we can use it instead of separate (yet otherwise identical) data transformation steps for studyArea.

  • mpbClimateData (née mpbClimate)
  • mpbPine
  • mpbMassAttacksData

estimate pine stem densities from percent cover and pine volume data

Currently, we use the Beaudoin et al. (2014) kNN percent pine data, but we really need to get an estimate of stem density (i.e. stems/ha or stems/pixel) in order to model the MPB dynamics.

kNN-StructureBiomass.tar provides pine volume ($m^3/ha$ at 250 m x 250 m). We can also use age (AGE), as well as total volume (VOL_T) multiplied by proportion pine per species, together with stand density managment (SDM) diagrams to get estimates of stems per hectare. However, this isn't necessarily clear-cut (no pun intended).

I've added @BarryCooke's notes on this topic — which follow from our discussions at GLFC last month — to the repo in bf9b19b. Updated in 81cf999.

update recent (1998-2016) MPB data

There's a gap in the AB data from the website (1999 and 2000 are missing), so the raster only uses 1998, 2001-2016.

TO DO: use the 1997-2011 AB data to fill in the gap.

fix symlinking in app R code

  • using R for symlinking is creating the link as a subdirectory. fix this.
  • make sure the symlinking code works on Windows

BioSim integration

After following up with Remi, we have a means to invoke BioSim from the commandline by passing the -e option using BioSim11.

@BarryCooke will recreate/import the necessary project (XML) files to produce the MPB climatic suitability projections using each of the previously used indices (R, S, L, G) plus the MPB iMod index (I?).

Use the BioSim/ directory for these files.

See also #4

mpbBoreal app enhancements

  • update module data descriptions from report draft

  • add studyArea polygon to the dropdown list and make it default

  • use the selected polygon as the area to run for demo

  • add SpaDES/MPB logos (in sidebar?)

  • create input widgets for parameters:

    • mpbClimateData$index
    • mpbRedTopGrowth$dataSet
    • mpbRedTopSpread$dispersalKernel

improve efficiency of code that imports/processes bc polygon data

BC poly data is huge, and something is buggy/wrong with R that is preventing release of memory when working on these files. Thus RAM usage quickly exceeds 12-16 GB (likely more).

Suggestions:

  • store the SpatialPolygonsDataFrames in an environment instead of a list (will require some custom looping code because lapply returns a list, so is not suitable for this task)

add info on generation of MPB climatic suitability maps

@BarryCooke

mpb-maps/climate-projections.Rmd needs to be updated to explain the generated maps.

  • How were these generated, and how can they be regenerated as needed? Include scripts/code.

  • What do the maps represent, exactly? What do the raster values mean and how should they be interpreted?

    The response is a float number which can be used as a climatic multiplier on MPB baseline reproductive rate.

    Not sure if this is totally accurate, since values aren't bound between [0, 1].

  • What are the caveats to using these maps (i.e., assumptions, limitations, etc.)?

  • What is the availability of the maps and their underlying data? Are they publicly available? From where can they be downloaded? With whom can they be shared?

how best to deal with point & polygon data?

MPB mass attack data from AB and BC are available as points and polygons. Our first crack at generating rasters of red atttacked trees was to use both the points and polygons together for each province. However, looking more closely at the data, while there are differences in the locations for points and polygons, there appears to be some overlap.

I'm not sure how best to deal with points that are inside polygons. What does it mean when a polygon has NUM_TREES attacked but also has points with their own NUM_TREES values? Should the points values be added to the pixel value derived from the polygon average? Or does the points value represent the correct value for that pixel? @BarryCooke, any thoughts about how to effectively merge the point data with the polygons to generate the rasters?

My workaround for now was to produce the rasters using only points for AB and only use polygons for BC (c755614), but this likely needs to be revisited.

Note to self: use points.in.polygon() to determine which points are inside polygons.

MPB_maps.Rmd needs to be updated

Some of the scripts from McIntire-lab repo were (re)moved so there are pieces of this .Rmd that no longer run.

  • boreal.R was drastically modified into and Rmarkdown file, and lots of additonal stuff was added and the file became part of mapLoadingManip.Rmd and lazyMaps... Need to re-extract only the download, extract, and load components. Do we need to reproject etc? I don't think so.

spreading fail

something is still weird (buggy) with the insect_spread function

  • edge problem: neer stops running if spreads off map
  • weird overlap and shape when doing repeated iterations of insect_spread

screenshot from 2018-01-26 12-30-08

suppressPackageStartupMessages({
  library(amc)
  library(data.table)
  library(sp)
  library(quickPlot)
  library(reproducible)
  library(rgdal)
  library(raster)
  library(SpaDES.tools)
})

clearPlot()
dev.useRSGD(FALSE)
dev()

modulePath <- "~/Documents/GitHub/MPB/SpaDES/modules"

## spread
source(file.path(modulePath, "mpbRedTopSpread", "R", "insect_spread.R"))

# create a dummy raster
XMAX <- YMAX <- 100
r <- raster(extent(0, XMAX, 0, YMAX), res = 1)
pine <- gaussMap(r)
pine[] <- pine[] / maxValue(pine)

r2 <- insect_spread(pine, loci = sample(ncell(r), 3),
                    asymmetry = 5, asymmetryAngle = 75,
                    lambda = 0.12,
                    saturationDensity = 332,
                    total = round(1125 * (250 / 100)^2),
                    debug = TRUE)

# plot the result
clearPlot()
Plot(r2, zero.color = "blue", new = TRUE, col = "Reds")

for (i in 1:1) {
  ids <- which(r2[] > (332 * 2/3))
  r2 <- insect_spread(pine, loci = ids,
                      asymmetry = 5, asymmetryAngle = 90,
                      lambda = 0.12,
                      saturationDensity = 332,
                      total = round(1125 * (250 / 100)^2),
                      debug = FALSE)
  Plot(r2)
}

.gc()

merge mpbGrowth_* modules

@BarryCooke

Instead of writing multiple otherwise identical modules that differ only by their data source and model fit, I will merge the mpbGrowth_B79fit and mpbGrowth_B79forced modules into a single mpbRedTopGrowth module that takes a parameter identifying which dataset / model fit to use.

restore packrat for this project

packrat was previously removed due to corrupted library (issues with the old version of the package?).

we should be using it.

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.