achubaty / mpb Goto Github PK
View Code? Open in Web Editor NEWMountain pine beetle spread model for the Canadian western boreal forest
Mountain pine beetle spread model for the Canadian western boreal forest
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
.
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 (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.
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.
Per discussions with Barry, a smaller study area spanning roughly from Lesser Slave Lake to the west, past Cold Lake and across the SK border to the east will be used. This area include the Martin Hills in AB.
I used Google Earth to draw a polygon (https://github.com/achubaty/MPB/blob/master/SpaDES/studyArea/studyArea.kml), which I converted to a shapefile.
TO DO: refine this further
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
from 4cf688d
NA
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:
complete the transition of relevant parts of Eliot's old code in cleanup.maps.R into the MPB_maps.Rmd file.
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:
lapply
returns a list, so is not suitable for this task)Since this module is simply doing data import and cropping to the study area, it makes sense to adjust the name.
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?
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.
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.mostly completed now, but a few pieces can't yet be implemented:
fasterize
can do point datafasterize
doesn't have the option to calculate pixels based on 'percent cover' of a polygons in each cellsomething is still weird (buggy) with the insect_spread function
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()
Since this module isn't generating the forecast, merely reading them in, it should be renamed to reflect that.
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.
need to add bib refs for r
values-data.Rmd
packrat was previously removed due to corrupted library (issues with the old version of the package?).
we should be using it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.