Mercurial > repos > greg > insect_phenology_model
comparison insect_phenology_model.R @ 87:522fe34a1dfc draft
Uploaded
author | greg |
---|---|
date | Wed, 22 Nov 2017 13:14:08 -0500 |
parents | 8f5c05be4efe |
children | b387ea636ff8 |
comparison
equal
deleted
inserted
replaced
86:5e1f9fde280c | 87:522fe34a1dfc |
---|---|
16 make_option(c("-p", "--oviposition"), action="store", dest="oviposition", type="integer", help="Adjustment for oviposition rate"), | 16 make_option(c("-p", "--oviposition"), action="store", dest="oviposition", type="integer", help="Adjustment for oviposition rate"), |
17 make_option(c("-q", "--photoperiod"), action="store", dest="photoperiod", type="double", help="Critical photoperiod for diapause induction/termination"), | 17 make_option(c("-q", "--photoperiod"), action="store", dest="photoperiod", type="double", help="Critical photoperiod for diapause induction/termination"), |
18 make_option(c("-s", "--replications"), action="store", dest="replications", type="integer", help="Number of replications"), | 18 make_option(c("-s", "--replications"), action="store", dest="replications", type="integer", help="Number of replications"), |
19 make_option(c("-t", "--se_plot"), action="store", dest="se_plot", help="Plot SE"), | 19 make_option(c("-t", "--se_plot"), action="store", dest="se_plot", help="Plot SE"), |
20 make_option(c("-v", "--input"), action="store", dest="input", help="Temperature data for selected location"), | 20 make_option(c("-v", "--input"), action="store", dest="input", help="Temperature data for selected location"), |
21 make_option(c("-y", "--young_nymph_accum"), action="store", dest="young_nymph_accum", type="integer", help="Adjustment of DD accumulation (egg->young nymph)") | 21 make_option(c("-y", "--young_nymph_accum"), action="store", dest="young_nymph_accum", type="integer", help="Adjustment of DD accumulation (egg->young nymph)"), |
22 make_option(c("-x", "--insect"), action="store", dest="insect", help="Insect name") | |
22 ) | 23 ) |
23 | 24 |
24 parser <- OptionParser(usage="%prog [options] file", option_list=option_list) | 25 parser <- OptionParser(usage="%prog [options] file", option_list=option_list) |
25 args <- parse_args(parser, positional_arguments=TRUE) | 26 args <- parse_args(parser, positional_arguments=TRUE) |
26 opt <- args$options | 27 opt <- args$options |
573 pdf(file=opt$output, width=20, height=30, bg="white") | 574 pdf(file=opt$output, width=20, height=30, bg="white") |
574 | 575 |
575 par(mar = c(5, 6, 4, 4), mfrow=c(3, 1)) | 576 par(mar = c(5, 6, 4, 4), mfrow=c(3, 1)) |
576 | 577 |
577 # Subfigure 1: population size by life stage | 578 # Subfigure 1: population size by life stage |
578 title <- paste("BSMB total population by life stage :", opt$location, ": Lat:", latitude, ":", start_date, "to", end_date, sep=" ") | 579 title <- paste("opt$insect : Total pop. by life stage :", opt$location, ": Lat:", latitude, ":", start_date, "-", end_date, sep=" ") |
579 plot(day.all, sa, main=title, type="l", ylim=c(0, max(se + se.se, sn + sn.se, sa + sa.se)), axes=F, lwd=2, xlab="", ylab="", cex=3, cex.lab=3, cex.axis=3, cex.main=3) | 580 plot(day.all, sa, main=title, type="l", ylim=c(0, max(se + se.se, sn + sn.se, sa + sa.se)), axes=F, lwd=2, xlab="", ylab="", cex=3, cex.lab=3, cex.axis=3, cex.main=3) |
580 # Young and old nymphs. | 581 # Young and old nymphs. |
581 lines(day.all, sn, lwd=2, lty=1, col=2) | 582 lines(day.all, sn, lwd=2, lty=1, col=2) |
582 # Eggs | 583 # Eggs |
583 lines(day.all, se, lwd=2, lty=1, col=4) | 584 lines(day.all, se, lwd=2, lty=1, col=4) |
597 lines (day.all, se + se.se, col=4, lty=2) | 598 lines (day.all, se + se.se, col=4, lty=2) |
598 lines (day.all, se - se.se, col=4, lty=2) | 599 lines (day.all, se - se.se, col=4, lty=2) |
599 } | 600 } |
600 | 601 |
601 # Subfigure 2: population size by generation | 602 # Subfigure 2: population size by generation |
602 title <- paste("BSMB total population by generation :", opt$location, ": Lat:", latitude, ":", start_date, "to", end_date, sep=" ") | 603 title <- paste("opt$insect : Total pop. by generation :", opt$location, ": Lat:", latitude, ":", start_date, "-", end_date, sep=" ") |
603 plot(day.all, g0, main=title, type="l", ylim=c(0, max(g2)), axes=F, lwd=2, xlab="", ylab="", cex=3, cex.lab=3, cex.axis=3, cex.main=3) | 604 plot(day.all, g0, main=title, type="l", ylim=c(0, max(g2)), axes=F, lwd=2, xlab="", ylab="", cex=3, cex.lab=3, cex.axis=3, cex.main=3) |
604 lines(day.all, g1, lwd = 2, lty = 1, col=2) | 605 lines(day.all, g1, lwd = 2, lty = 1, col=2) |
605 lines(day.all, g2, lwd = 2, lty = 1, col=4) | 606 lines(day.all, g2, lwd = 2, lty = 1, col=4) |
606 axis(1, at=c(1:12) * 30 - 15, cex.axis=3, labels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")) | 607 axis(1, at=c(1:12) * 30 - 15, cex.axis=3, labels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")) |
607 axis(2, cex.axis=3) | 608 axis(2, cex.axis=3) |
619 lines (day.all, g2+g2.se, col=4, lty=2) | 620 lines (day.all, g2+g2.se, col=4, lty=2) |
620 lines (day.all, g2-g2.se, col=4, lty=2) | 621 lines (day.all, g2-g2.se, col=4, lty=2) |
621 } | 622 } |
622 | 623 |
623 # Subfigure 3: adult population size by generation | 624 # Subfigure 3: adult population size by generation |
624 title <- paste("BSMB adult population by generation :", opt$location, ": Lat:", latitude, ":", start_date, "to", end_date, sep=" ") | 625 title <- paste("opt$insect : Adult pop. by generation :", opt$location, ": Lat:", latitude, ":", start_date, "-", end_date, sep=" ") |
625 plot(day.all, g0a, ylim=c(0, max(g2a) + 100), main=title, type="l", axes=F, lwd=2, xlab="", ylab="", cex=3, cex.lab=3, cex.axis=3, cex.main=3) | 626 plot(day.all, g0a, ylim=c(0, max(g2a) + 100), main=title, type="l", axes=F, lwd=2, xlab="", ylab="", cex=3, cex.lab=3, cex.axis=3, cex.main=3) |
626 lines(day.all, g1a, lwd = 2, lty = 1, col=2) | 627 lines(day.all, g1a, lwd = 2, lty = 1, col=2) |
627 lines(day.all, g2a, lwd = 2, lty = 1, col=4) | 628 lines(day.all, g2a, lwd = 2, lty = 1, col=4) |
628 axis(1, at=c(1:12) * 30 - 15, cex.axis=3, labels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")) | 629 axis(1, at=c(1:12) * 30 - 15, cex.axis=3, labels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")) |
629 axis(2, cex.axis=3) | 630 axis(2, cex.axis=3) |