Once we have defined the geographical extent of the area of interest, we can parse it into a crop function as an argument to chop sea surface temperature only the area of interest sst.tz = sst %>% raster::crop(tz.bbox) This is how we’d crop using a GIS shapefile (with a rectangular shape) tz.bbox = extent(38, 60, -6, 0) We define the bounding box of the area of interest using the extent function. We can crop rasters in R using various method, however, in this case,I chose a manual work of defining a geographical, which span from longitude 38 and 60 East and latitude 6 and 0 South of the equator. We notice that the dataset cover the global extent, hence we need to crop it to small areas of interest. cellStats(x = sst, stat = min) -1.86 cellStats(x = sst, stat = max) 32.145 cellStats(x = sst, stat = range) -1.860 32.145 cellStats(x = sst, stat = mean) 16.6292 cellStats(x = sst, stat = median) 19.5 cellStats(x = sst, stat = sd) 10.16192 We can further view the raster’s min, max, range, median, mean, sd values and the range of values contained within the pixels. Notice the minimum and maximum values of sea surface temperature is now included as attributes and shows the min and max values for the pixels in the raster. In short, the function calculates and save the min and max values of the raster to the raster object sst %>% setMinMax() class : RasterLayer This raster is in UTM (Universal Trans Mercator) zone 11 with a datum of WGS 84īy default this raster doesn’t have the min or max values associated with it’s attributes Let’s change that by using the setMinMax() function.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |