{"id":2364,"date":"2023-12-08T17:02:09","date_gmt":"2023-12-08T22:02:09","guid":{"rendered":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/?post_type=chapter&#038;p=2364"},"modified":"2025-10-31T08:08:25","modified_gmt":"2025-10-31T12:08:25","slug":"tutorial-ecospace-maps","status":"publish","type":"chapter","link":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/chapter\/tutorial-ecospace-maps\/","title":{"raw":"Tutorial: Ecospace maps","rendered":"Tutorial: Ecospace maps"},"content":{"raw":"<p style=\"font-weight: 400\">So, you have an Ecospace model, it looks good, well, on the screen it does, but how do you make publication ready plots? That\u2019s what this tutorial intends to give you some hints about.<\/p>\r\n<p style=\"font-weight: 400\">In the process we\u2019ll be using some GIS maps for the study area, but unfortunately we only have low-resolution maps of Anchovy Bay (and no GIS map for overlay), so we\u2019ll use a colder study area, the Barents Sea. There, snow crabs have been expanding, and we\u2019ll produce some maps to visualize how their distribution has changed.<\/p>\r\n<p style=\"font-weight: 400\">We have a spatial model for the area, developed as part of the <a href=\"https:\/\/akvaplan.no\/en\/news?q=eisa\">EISA<\/a> project, coordinated by <a href=\"https:\/\/akvaplan.no\/en\/about\">NIVA<\/a>. Open your Ecospace scenario, the go <em>Menu &gt; Tools &gt; Options &gt; File management<\/em>, and check the <em>Ecospace &gt; Run results &gt; Biomass maps (ASCII format) <\/em>option. Make a run, and Ecospace will save ASCIII raster maps to the directory that is specified on the <em>File management<\/em> form. That\u2019s a lot of files being saved, by the way, so we need some reasonably smart way of handling them.<\/p>\r\n<p style=\"font-weight: 400\">Let\u2019s attack this using R. Get R up and running, make a folder for your mapping code, create an empty R file and save it (or download the zip file with R code and ASCII files below). Copy the ASCII files you want to work with to a subfolder, in this example named <em>asc<\/em>.<\/p>\r\nHere's code that you may be able to copy to R:\r\n<p style=\"font-weight: 400\"># Then load libraries (install as needed):<\/p>\r\n<p style=\"font-weight: 400\"><em>library(terra) # for spatial operations<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>library(viridisLite) # colour blind friendly scheme for plotting<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>library(viridis) # colour blind friendly scheme for plotting<\/em><\/p>\r\n<p style=\"font-weight: 400\"># Next set your working directory:<\/p>\r\n<p style=\"font-weight: 400\">#============= Set up working directory =============================<\/p>\r\n<p style=\"font-weight: 400\"><em>work.dir = dirname(rstudioapi::getActiveDocumentContext()$path)<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>setwd(work.dir)<\/em><\/p>\r\n<p style=\"font-weight: 400\"># We need some colours to work with, here they are in a block:<\/p>\r\n<p style=\"font-weight: 400\"># =======We need some colours to work with ========================<\/p>\r\n<em>colrD=viridis(n=128,begin=0, end=1, direction=-1, option='C') <\/em>\r\n\r\n<em>for(ix in 1:3) {colrD[ix] = '#FFFFFF'} <\/em>\r\n<p style=\"font-weight: 400\"># =======end of colours ===========================================<\/p>\r\n<p style=\"font-weight: 400\"># Let\u2019s tell R where to find the ASCII maps:<\/p>\r\n<p style=\"font-weight: 400\"><em>files.start = list.files(path='asc'<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,full.names=T,pattern=glob2rx('EcospaceMapBiomass-some-crab*.asc') )<\/em><\/p>\r\n<p style=\"font-weight: 400\"># And let\u2019s count how may files there are in the folder:<\/p>\r\n<p style=\"font-weight: 400\"><em>how.many = length(files.start)<\/em><\/p>\r\n<p style=\"font-weight: 400\"># We'll need a background to mark the area outside of our study area<\/p>\r\n<p style=\"font-weight: 400\"><em>backgr = rast(files.start[1])<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>values(backgr) = 0 #cells outside study value needs to get a value (will be NA otherwise)<\/em><\/p>\r\n<p style=\"font-weight: 400\"># Find the max biomass on any map for scaling maps:<\/p>\r\n<p style=\"font-weight: 400\"><em>maxv=0<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>for(i in (1:how.many)){<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>\u00a0 bef = rast(files.start[i])<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>\u00a0 max.bef = max(setMinMax(bef))<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>\u00a0 maxv = max(max.bef,maxv)<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>}<\/em><\/p>\r\n<p style=\"font-weight: 400\"># Get a map of land to put on top of Ecospace map, this makes it much easier to see where your area is (compare Figure 1 B and 1C, below):<\/p>\r\n<p style=\"font-weight: 400\"><em>land = rast('land_10k.asc')<\/em><\/p>\r\n<p style=\"font-weight: 400\"># Let R know your file name and type<\/p>\r\n<p style=\"font-weight: 400\"><em>pdf(file='Four strong maps.pdf',width=6,height=8,bg='transparent')<\/em><\/p>\r\n<p style=\"font-weight: 400\"># We here want four plots for demo:<\/p>\r\n<p style=\"font-weight: 400\"><em>par(mfrow=c(2,2))<\/em><\/p>\r\n<p style=\"font-weight: 400\"># Set margins to make plots fill the space better<\/p>\r\n<p style=\"font-weight: 400\"><em>par(mar=c(0,0,0,0))<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>par(oma=c(0,0,0,0))<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>par(xaxt='n', yaxt = 'n', bty='n')<\/em><\/p>\r\n<p style=\"font-weight: 400\"># There are so many files, we only want to select some:<\/p>\r\n<p style=\"font-weight: 400\"><em>for(i in seq(11,how.many,by=6)){<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>\u00a0 plt = rast(files.start[i])<\/em><\/p>\r\n<p style=\"font-weight: 400\">\u00a0 # first plot a grey background (Figure 1 A)<\/p>\r\n<p style=\"font-weight: 400\"><em>\u00a0 image(backgr,xlab='',ylab='',useRaster=T,cex.main=2,zlim=c(0,1),col='grey70')<\/em><\/p>\r\n<p style=\"font-weight: 400\">\u00a0 # use the same scale for all plots (Figure 1 B)<\/p>\r\n<p style=\"font-weight: 400\"><em>\u00a0 image(plt\/maxv,xlab='',ylab='',add=TRUE,useRaster=T,cex.main=2,zlim=c(0,1),col=colrD)<\/em><\/p>\r\n<p style=\"font-weight: 400\">\u00a0 # add land on top of plot (Figure 1 C)<\/p>\r\n<p style=\"font-weight: 400\"><em>\u00a0 image(land,xlab='',ylab='',add=TRUE,useRaster=T,cex.main=2,zlim=c(0.5,1),col='grey30')<\/em><\/p>\r\n<p style=\"font-weight: 400\">\u00a0 # check the plot to find the X-Y coordinates for where to place a legend on top (Figure 1 D)<\/p>\r\n<p style=\"font-weight: 400\"><em>\u00a0 year=as.character(1984+i)<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>\u00a0 text(700000,-2300000,year,col='white',cex=2.5)<\/em><\/p>\r\n<p style=\"font-weight: 400\"><em>}<\/em><\/p>\r\n<p style=\"font-weight: 400\"># turn off the device to save the pdf<\/p>\r\n<p style=\"font-weight: 400\"><em>dev.off()<\/em><\/p>\r\n<img class=\"alignnone size-full wp-image-2366\" src=\"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2023-12-08-at-23.09.59.png\" alt=\"\" width=\"1812\" height=\"1444\" \/>\r\n\r\n<strong>Figure 1. Maps of species distribution showing four stages of the plotting as described in text above.<\/strong>\r\n<p style=\"font-weight: 400\">That\u2019s it, you now have some sample code with which you can read Ecospace maps and plot it.<\/p>\r\n\r\n<div class=\"textbox shaded\">\r\n<p style=\"font-weight: 400\">You can download the R-code and sample files for this tutorial at <a href=\"https:\/\/ln5.sync.com\/dl\/a688c7e80\/ijhj7q6t-dimdf9wb-66xyyw8f-5r4tst6b\">this link<\/a>.<\/p>\r\n\r\n<\/div>\r\n&nbsp;\r\n<h2>What about Anchovy Bay?<\/h2>\r\n<img class=\"alignnone size-full wp-image-4192\" src=\"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2025-03-20-at-15.47.49.png\" alt=\"\" width=\"1918\" height=\"1286\" \/>\r\n\r\n<strong>Figure 2. Map of mackerel biomass in Anchovy Bay at the first and last year of the model run, along with the difference (last-first) in the third plot.<\/strong>\r\n\r\nAnchovy Bay should not be left out, so we've stored the R-code for the plots at the link in the textbook below. You should be able to download the code, place it in a folder, then open the R-code, run the model, and it should produce the plot. The plots will be in the pdf sub folder.\r\n\r\nTo use the code for your own plot, you will need to\r\n<ul>\r\n \t<li>Run your model in Ecospace set to save: Click the floppy disk icon, then check <em>Ecospace &gt; Run results &gt; Biomass maps<\/em> (and any other maps you may want to plot)<\/li>\r\n \t<li>Line 20, set filedir = the folder where you have stored your Ecospace ascii files (.asc)<\/li>\r\n \t<li>Line 23, check the ascii files and get the first map about one year into the run (probably named 013).\u00a0Set mth1 = \"013\" (or whatever yours is called, enter as string, i.e. with \"\" around the number)<\/li>\r\n \t<li>Line 25, set mth2 = the last month in your data files (e.g., \"481\")<\/li>\r\n \t<li>Line 27, enter title for the first set of plots<\/li>\r\n \t<li>Line 29 Enter title for second set of plots<\/li>\r\n<\/ul>\r\nThat's all, the code should produce a pdf for each group in your model.\r\n\r\n&nbsp;\r\n<div class=\"textbox shaded\">\r\n\r\nYou can download the R-code (and data files) for producing the Anchovy Bay maps in Figure 2 from this <a href=\"https:\/\/ln5.sync.com\/dl\/8730eb050\/tkhzfgtw-mi9t7aek-wjb8me4y-kxz6npu8\">link<\/a>.\r\n\r\n<\/div>\r\n&nbsp;\r\n<div class=\"textbox textbox--examples\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Attribution<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n\r\nThe underlying spatial model used for the first part of tutorial was developed by the EISA project, coordinated by NIVA.\r\n\r\n<\/div>\r\n<\/div>\r\n&nbsp;","rendered":"<p style=\"font-weight: 400\">So, you have an Ecospace model, it looks good, well, on the screen it does, but how do you make publication ready plots? That\u2019s what this tutorial intends to give you some hints about.<\/p>\n<p style=\"font-weight: 400\">In the process we\u2019ll be using some GIS maps for the study area, but unfortunately we only have low-resolution maps of Anchovy Bay (and no GIS map for overlay), so we\u2019ll use a colder study area, the Barents Sea. There, snow crabs have been expanding, and we\u2019ll produce some maps to visualize how their distribution has changed.<\/p>\n<p style=\"font-weight: 400\">We have a spatial model for the area, developed as part of the <a href=\"https:\/\/akvaplan.no\/en\/news?q=eisa\">EISA<\/a> project, coordinated by <a href=\"https:\/\/akvaplan.no\/en\/about\">NIVA<\/a>. Open your Ecospace scenario, the go <em>Menu &gt; Tools &gt; Options &gt; File management<\/em>, and check the <em>Ecospace &gt; Run results &gt; Biomass maps (ASCII format) <\/em>option. Make a run, and Ecospace will save ASCIII raster maps to the directory that is specified on the <em>File management<\/em> form. That\u2019s a lot of files being saved, by the way, so we need some reasonably smart way of handling them.<\/p>\n<p style=\"font-weight: 400\">Let\u2019s attack this using R. Get R up and running, make a folder for your mapping code, create an empty R file and save it (or download the zip file with R code and ASCII files below). Copy the ASCII files you want to work with to a subfolder, in this example named <em>asc<\/em>.<\/p>\n<p>Here&#8217;s code that you may be able to copy to R:<\/p>\n<p style=\"font-weight: 400\"># Then load libraries (install as needed):<\/p>\n<p style=\"font-weight: 400\"><em>library(terra) # for spatial operations<\/em><\/p>\n<p style=\"font-weight: 400\"><em>library(viridisLite) # colour blind friendly scheme for plotting<\/em><\/p>\n<p style=\"font-weight: 400\"><em>library(viridis) # colour blind friendly scheme for plotting<\/em><\/p>\n<p style=\"font-weight: 400\"># Next set your working directory:<\/p>\n<p style=\"font-weight: 400\">#============= Set up working directory =============================<\/p>\n<p style=\"font-weight: 400\"><em>work.dir = dirname(rstudioapi::getActiveDocumentContext()$path)<\/em><\/p>\n<p style=\"font-weight: 400\"><em>setwd(work.dir)<\/em><\/p>\n<p style=\"font-weight: 400\"># We need some colours to work with, here they are in a block:<\/p>\n<p style=\"font-weight: 400\"># =======We need some colours to work with ========================<\/p>\n<p><em>colrD=viridis(n=128,begin=0, end=1, direction=-1, option=&#8217;C&#8217;) <\/em><\/p>\n<p><em>for(ix in 1:3) {colrD[ix] = &#8216;#FFFFFF&#8217;} <\/em><\/p>\n<p style=\"font-weight: 400\"># =======end of colours ===========================================<\/p>\n<p style=\"font-weight: 400\"># Let\u2019s tell R where to find the ASCII maps:<\/p>\n<p style=\"font-weight: 400\"><em>files.start = list.files(path=&#8217;asc&#8217;<\/em><\/p>\n<p style=\"font-weight: 400\"><em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,full.names=T,pattern=glob2rx(&#8216;EcospaceMapBiomass-some-crab*.asc&#8217;) )<\/em><\/p>\n<p style=\"font-weight: 400\"># And let\u2019s count how may files there are in the folder:<\/p>\n<p style=\"font-weight: 400\"><em>how.many = length(files.start)<\/em><\/p>\n<p style=\"font-weight: 400\"># We&#8217;ll need a background to mark the area outside of our study area<\/p>\n<p style=\"font-weight: 400\"><em>backgr = rast(files.start[1])<\/em><\/p>\n<p style=\"font-weight: 400\"><em>values(backgr) = 0 #cells outside study value needs to get a value (will be NA otherwise)<\/em><\/p>\n<p style=\"font-weight: 400\"># Find the max biomass on any map for scaling maps:<\/p>\n<p style=\"font-weight: 400\"><em>maxv=0<\/em><\/p>\n<p style=\"font-weight: 400\"><em>for(i in (1:how.many)){<\/em><\/p>\n<p style=\"font-weight: 400\"><em>\u00a0 bef = rast(files.start[i])<\/em><\/p>\n<p style=\"font-weight: 400\"><em>\u00a0 max.bef = max(setMinMax(bef))<\/em><\/p>\n<p style=\"font-weight: 400\"><em>\u00a0 maxv = max(max.bef,maxv)<\/em><\/p>\n<p style=\"font-weight: 400\"><em>}<\/em><\/p>\n<p style=\"font-weight: 400\"># Get a map of land to put on top of Ecospace map, this makes it much easier to see where your area is (compare Figure 1 B and 1C, below):<\/p>\n<p style=\"font-weight: 400\"><em>land = rast(&#8216;land_10k.asc&#8217;)<\/em><\/p>\n<p style=\"font-weight: 400\"># Let R know your file name and type<\/p>\n<p style=\"font-weight: 400\"><em>pdf(file=&#8217;Four strong maps.pdf&#8217;,width=6,height=8,bg=&#8217;transparent&#8217;)<\/em><\/p>\n<p style=\"font-weight: 400\"># We here want four plots for demo:<\/p>\n<p style=\"font-weight: 400\"><em>par(mfrow=c(2,2))<\/em><\/p>\n<p style=\"font-weight: 400\"># Set margins to make plots fill the space better<\/p>\n<p style=\"font-weight: 400\"><em>par(mar=c(0,0,0,0))<\/em><\/p>\n<p style=\"font-weight: 400\"><em>par(oma=c(0,0,0,0))<\/em><\/p>\n<p style=\"font-weight: 400\"><em>par(xaxt=&#8217;n&#8217;, yaxt = &#8216;n&#8217;, bty=&#8217;n&#8217;)<\/em><\/p>\n<p style=\"font-weight: 400\"># There are so many files, we only want to select some:<\/p>\n<p style=\"font-weight: 400\"><em>for(i in seq(11,how.many,by=6)){<\/em><\/p>\n<p style=\"font-weight: 400\"><em>\u00a0 plt = rast(files.start[i])<\/em><\/p>\n<p style=\"font-weight: 400\">\u00a0 # first plot a grey background (Figure 1 A)<\/p>\n<p style=\"font-weight: 400\"><em>\u00a0 image(backgr,xlab=&#8221;,ylab=&#8221;,useRaster=T,cex.main=2,zlim=c(0,1),col=&#8217;grey70&#8242;)<\/em><\/p>\n<p style=\"font-weight: 400\">\u00a0 # use the same scale for all plots (Figure 1 B)<\/p>\n<p style=\"font-weight: 400\"><em>\u00a0 image(plt\/maxv,xlab=&#8221;,ylab=&#8221;,add=TRUE,useRaster=T,cex.main=2,zlim=c(0,1),col=colrD)<\/em><\/p>\n<p style=\"font-weight: 400\">\u00a0 # add land on top of plot (Figure 1 C)<\/p>\n<p style=\"font-weight: 400\"><em>\u00a0 image(land,xlab=&#8221;,ylab=&#8221;,add=TRUE,useRaster=T,cex.main=2,zlim=c(0.5,1),col=&#8217;grey30&#8242;)<\/em><\/p>\n<p style=\"font-weight: 400\">\u00a0 # check the plot to find the X-Y coordinates for where to place a legend on top (Figure 1 D)<\/p>\n<p style=\"font-weight: 400\"><em>\u00a0 year=as.character(1984+i)<\/em><\/p>\n<p style=\"font-weight: 400\"><em>\u00a0 text(700000,-2300000,year,col=&#8217;white&#8217;,cex=2.5)<\/em><\/p>\n<p style=\"font-weight: 400\"><em>}<\/em><\/p>\n<p style=\"font-weight: 400\"># turn off the device to save the pdf<\/p>\n<p style=\"font-weight: 400\"><em>dev.off()<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2366\" src=\"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2023-12-08-at-23.09.59.png\" alt=\"\" width=\"1812\" height=\"1444\" srcset=\"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2023-12-08-at-23.09.59.png 1812w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2023-12-08-at-23.09.59-300x239.png 300w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2023-12-08-at-23.09.59-1024x816.png 1024w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2023-12-08-at-23.09.59-768x612.png 768w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2023-12-08-at-23.09.59-1536x1224.png 1536w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2023-12-08-at-23.09.59-65x52.png 65w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2023-12-08-at-23.09.59-225x179.png 225w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2023-12-08-at-23.09.59-350x279.png 350w\" sizes=\"auto, (max-width: 1812px) 100vw, 1812px\" \/><\/p>\n<p><strong>Figure 1. Maps of species distribution showing four stages of the plotting as described in text above.<\/strong><\/p>\n<p style=\"font-weight: 400\">That\u2019s it, you now have some sample code with which you can read Ecospace maps and plot it.<\/p>\n<div class=\"textbox shaded\">\n<p style=\"font-weight: 400\">You can download the R-code and sample files for this tutorial at <a href=\"https:\/\/ln5.sync.com\/dl\/a688c7e80\/ijhj7q6t-dimdf9wb-66xyyw8f-5r4tst6b\">this link<\/a>.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<h2>What about Anchovy Bay?<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4192\" src=\"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2025-03-20-at-15.47.49.png\" alt=\"\" width=\"1918\" height=\"1286\" srcset=\"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2025-03-20-at-15.47.49.png 1918w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2025-03-20-at-15.47.49-300x201.png 300w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2025-03-20-at-15.47.49-1024x687.png 1024w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2025-03-20-at-15.47.49-768x515.png 768w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2025-03-20-at-15.47.49-1536x1030.png 1536w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2025-03-20-at-15.47.49-65x44.png 65w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2025-03-20-at-15.47.49-225x151.png 225w, https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-content\/uploads\/sites\/1902\/2023\/12\/Screenshot-2025-03-20-at-15.47.49-350x235.png 350w\" sizes=\"auto, (max-width: 1918px) 100vw, 1918px\" \/><\/p>\n<p><strong>Figure 2. Map of mackerel biomass in Anchovy Bay at the first and last year of the model run, along with the difference (last-first) in the third plot.<\/strong><\/p>\n<p>Anchovy Bay should not be left out, so we&#8217;ve stored the R-code for the plots at the link in the textbook below. You should be able to download the code, place it in a folder, then open the R-code, run the model, and it should produce the plot. The plots will be in the pdf sub folder.<\/p>\n<p>To use the code for your own plot, you will need to<\/p>\n<ul>\n<li>Run your model in Ecospace set to save: Click the floppy disk icon, then check <em>Ecospace &gt; Run results &gt; Biomass maps<\/em> (and any other maps you may want to plot)<\/li>\n<li>Line 20, set filedir = the folder where you have stored your Ecospace ascii files (.asc)<\/li>\n<li>Line 23, check the ascii files and get the first map about one year into the run (probably named 013).\u00a0Set mth1 = &#8220;013&#8221; (or whatever yours is called, enter as string, i.e. with &#8220;&#8221; around the number)<\/li>\n<li>Line 25, set mth2 = the last month in your data files (e.g., &#8220;481&#8221;)<\/li>\n<li>Line 27, enter title for the first set of plots<\/li>\n<li>Line 29 Enter title for second set of plots<\/li>\n<\/ul>\n<p>That&#8217;s all, the code should produce a pdf for each group in your model.<\/p>\n<p>&nbsp;<\/p>\n<div class=\"textbox shaded\">\n<p>You can download the R-code (and data files) for producing the Anchovy Bay maps in Figure 2 from this <a href=\"https:\/\/ln5.sync.com\/dl\/8730eb050\/tkhzfgtw-mi9t7aek-wjb8me4y-kxz6npu8\">link<\/a>.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<div class=\"textbox textbox--examples\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Attribution<\/p>\n<\/header>\n<div class=\"textbox__content\">\n<p>The underlying spatial model used for the first part of tutorial was developed by the EISA project, coordinated by NIVA.<\/p>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<div class=\"media-attributions clear\" prefix:cc=\"http:\/\/creativecommons.org\/ns#\" prefix:dc=\"http:\/\/purl.org\/dc\/terms\/\"><h2>Media Attributions<\/h2><ul><li >Original       <\/li><\/ul><\/div>","protected":false},"author":1909,"menu_order":12,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[49],"contributor":[],"license":[],"class_list":["post-2364","chapter","type-chapter","status-publish","hentry","chapter-type-numberless"],"part":418,"_links":{"self":[{"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/chapters\/2364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/wp\/v2\/users\/1909"}],"version-history":[{"count":16,"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/chapters\/2364\/revisions"}],"predecessor-version":[{"id":4228,"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/chapters\/2364\/revisions\/4228"}],"part":[{"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/parts\/418"}],"metadata":[{"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/chapters\/2364\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/wp\/v2\/media?parent=2364"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/chapter-type?post=2364"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/wp\/v2\/contributor?post=2364"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/wp\/v2\/license?post=2364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}