Output maps with different resolution compared to input maps

182 views
Skip to first unread message

Elena

unread,
Jun 3, 2015, 11:56:14 PM6/3/15
to landis-...@googlegroups.com

I have run LANDIS-II 6.0 (official release) with "Age-only Succession" and with the "Century Succession" (separately). In both cases my input maps (ecoregions, initial communities) have cell length = 50 m

However, the output maps (see below) have cell length = 1 m.

Can anyone help me to understand why this might be?

Many thanks,

Elena

LandisData "Output Cohort Statistics"

Timestep 10

SpeciesAgeStats

MapNames output/cohort-stats/{species}-{statistic}-{timestep}.img
MAX betupend cratmono fagusylv ilexaqui pinusylv prunspin querrobu ulexeuro << maximum age for each species
MIN betupend cratmono fagusylv ilexaqui pinusylv prunspin querrobu ulexeuro << minimum age for each species

SiteAgeStats
MapNames output/cohort-stats/AGE-{statistic}-{timestep}.img
MAX << maximum age across all species on site

SiteSpeciesStats

MapNames output/cohort-stats/SPP-{statistic}-{timestep}.img
RICH <<count of species


Elena

unread,
Jun 17, 2015, 9:25:07 AM6/17/15
to landis-...@googlegroups.com
I have done a bit of detective work and do still seem to have the same problem, i.e. the outputs have a different resolution compared to the inputs.

My input maps have cell size 50 m and they are projected in the British National Grid.
The output maps have cell size 1 m and when you add them in ArcGIS they are shifted.

So, in brief to do some analysis I need to: (i) shift all of the maps by x= 40995.5 and y= 85804.5, (ii) rescale them by a factor of 50.

I have tried the following extensions and have the same problem:
Age-only Succession v4.1
Base Harvest v2.2
Century Succession v4.0

My questions are:
1. did the model work correctly?
2. if yes, is there an automatic way to shift and rescale all of the maps?

Many thanks,
Elena



Brian Miranda

unread,
Jun 18, 2015, 1:49:16 PM6/18/15
to landis-...@googlegroups.com
Elena,

The issue here is that the maps output from LANDIS have no spatial attributes.  That is, they don't have a defined cell size or spatial coordinates.  The outputs are in what I call "LANDIS space", and they can be frustrating to work with.  As you have discovered, to get them back into real space you need to rescale and shift the rasters.

A couple things that I do to make working with the outputs easier:
1)  Convert other layers that you want to overlay with the outputs into "LANDIS space". Often there is a lot more LANDIS output than there are other layers, so converting the other layers is easier than converting all of the LANDIS output.

2)  The LANDIS output rasters have the same numbers of rows and columns as the input rasters (ecoregions, initial communities, etc.).  So you can work with the rasters as a matrix (where cell size and spatial coordinates are irrelevant) in something like R and you can calculate the result of raster overlays that way.  This depends on the fact that the rows and columns in these data sets match up, and wouldn't work if you wanted to overlay something with a different extent.  But any raster clipped to the same extent as the simulation area could be overlaid in this way.

Hope this helps,
-Brian

Thiago Sanna Freire Silva

unread,
Jun 22, 2015, 11:33:56 AM6/22/15
to landis-...@googlegroups.com
If your output raster matches a georeferenced input file (i.e. has the same number of rows and columns), you can "steal" the georeferencing from the original image in R :


library(raster) # Load raster package

geo_raster <- raster("input_raster_with_georeferencing.tif") # Read georeferenced input raster. Should be a single band file.

landis_raster <- raster("landsi_raster_same_rows_columns_as_input.tif") # Read landis raster. Should also be single band.

landis_geo <- geo_raster # Creates new raster as a copy of input raster

values(landis_geo) <- values(landis_raster) # Replaces input raster values with landis raster values

writeRaster(landis_geo,file="landis_with_georeferencing.tif", format="GTiff", datatype="FLT4S") # Save new raster as Geotiff with georeferencing

# FLT4S is floating point data, see help(dataType) for other options


-Thiago

Caren Dymond

unread,
Jun 22, 2015, 11:34:04 AM6/22/15
to landis-...@googlegroups.com
Hi
I'm not sure what your project is, but the ForCS output all has row and column in the csv output so you can make maps and do spatial analyses.

best,
Caren

Elena

unread,
Jun 25, 2015, 10:14:04 AM6/25/15
to landis-...@googlegroups.com
Thank you Thiago and everyone else who replied. I should certainty tried R!

Craig Robinson

unread,
Aug 26, 2021, 8:34:42 AM8/26/21
to LANDIS-II Users
I thought I would reply to this old thread as I struggled with this a little bit.  I put together a small function that will transform your output Landis rasters back into the same projections as your original input rasters.  I found this useful so that I could then display my outputs along with my inputs in ArcGIS, or using leaflet to make some pretty output maps, or to mask outputs with my inputs, etc.

I hope this helps someone.

  # R function
  # transform a raster output from Landis, back to original input raster
  # you need to know the original raster projection and min and max x,y, and then also the extents of the output Landis raster to make this work for you
  # pass in a Landis output raster object
  
  transformraster <- function(r_in) {
    # the projection of the raster I am trying to create (from original input raster)
    projection =  "+proj=aea +lat_0=45 +lon_0=-126 +lat_1=50 +lat_2=58.5 +x_0=1000000 +y_0=0 +datum=NAD83 +units=m +no_defs"
    ## the min x, max x, min y, max y extents of my initial input rasters
    ex <- matrix(c(1602375, 1871189, 489728.7,734294.2), nrow = 2, ncol = 2, byrow = T)
    # convert them to an extent
    ex <- extent(ex)
    ## the x and y extent of my out put Landis rasters
    r <- raster(nrows = 1412, ncols = 1552, crs=projection)
    r <- setExtent(r, ex, keepres=F)
    # transfer the values of the input raster into the new raster
    n <- values(r_in)
    values(r) <- n
    return(r)
  }

Reply all
Reply to author
Forward
0 new messages