Warning messages "matrix(ratvalues, nrow = length(ratvalues)/length(ratnames))" when cropping rasters

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Warning messages "matrix(ratvalues, nrow = length(ratvalues)/length(ratnames))" when cropping rasters

Nelly Reduan
Hello,

I�m working with one land cover raster and one shapefile representing study limit boundaries.

 However, I�m getting warning messages when I crop the raster using the function "crop" in

the package "raster".



>     rast_crop <- crop(x=rast,y=(extent(limit_study_area_prj) + 1000)) # crop the raster to the extent of the study area

Warning messages:

1: In matrix(ratvalues, nrow = length(ratvalues)/length(ratnames)) :

  data length [1923] is not a sub-multiple or multiple of the number of rows [147]

2: In .getRat(x, ratvalues, ratnames, rattypes) :

  NAs introduced by coercion

3: In .getRat(x, ratvalues, ratnames, rattypes) :

  NAs introduced by coercion

4: In .getRat(x, ratvalues, ratnames, rattypes) :

  NAs introduced by coercion



This is the raster:



> rast

class       : RasterLayer

dimensions  : 65770, 53928, 3546844560  (nrow, ncol, ncell)

resolution  : 30, 30  (x, y)

extent      : -830370, 787470, 117960, 2091060  (xmin, xmax, ymin, ymax)

coord. ref. : +proj=lcc +lat_1=46 +lat_2=60 +lat_0=44 +lon_0=-68.5 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0

data source : F:\rast.tif

names       : rast

values      : 10, 9999  (min, max)

This is the shapefile :

limit_study_area_prj

class       : SpatialPolygonsDataFrame

features    : 2

extent      : -486868.6, -146688.1, 117964.1, 246335.5  (xmin, xmax, ymin, ymax)

coord. ref. : +proj=lcc +lat_1=46 +lat_2=60 +lat_0=44 +lon_0=-68.5 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0

variables   : 12

This is the extent of the shapefile

> extent(limit_study_area_prj)

class       : Extent

xmin        : -486868.6

xmax        : -146688.1

ymin        : 117964.1

ymax        : 246335.5

Is there any way to avoid these warning messages? Are there consequences for extracting raster values (after cropping)?
Thank so much for your time
Have a nice day
Nell


        [[alternative HTML version deleted]]


_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo