[R-sig-Geo] Recs for R tools that subset/tile raster bricks?

Megan Maloney maloneymc at appstate.edu
Thu May 25 01:18:10 CEST 2017


Thanks for your response, Mike! The files are ENVI images (*.dat). The
output of print() on one is copied below. The other images have slightly
different row/col sizes but the same number of layers.

Thanks for the tip on the vignettes. It looks like "Writing functions with
the ”raster” package" is the one you're referring to? blockSize() looks
helpful as I'm not sure what size would be appropriate to crop to.

--

class       : RasterBrick
dimensions  : 24390, 2032, 49560480, 373  (nrow, ncol, ncell, nlayers)
resolution  : 1, 1  (x, y)
extent      : 520554.6, 522586.6, 4766639, 4791029  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=11 +datum=NAD83 +units=m +no_defs
+ellps=GRS80 +towgs84=0,0,0
data source : E:\RCEW_CoReg_2014\183421\183421_Georegistered
names       :
Warp..Band.8.ang20140919t183421_corr_v1c_img...381.360260.Nanometers.,
Warp..Band.9.ang20140919t183421_corr_v1c_img...386.368927.Nanometers.,
Warp..Band.10.ang20140919t183421_corr_v1c_img...391.377594.Nanometers.,
Warp..Band.11.ang20140919t183421_corr_v1c_img...396.386292.Nanometers.,
Warp..Band.12.ang20140919t183421_corr_v1c_img...401.394958.Nanometers.,
Warp..Band.13.ang20140919t183421_corr_v1c_img...406.403625.Nanometers.,
Warp..Band.14.ang20140919t183421_corr_v1c_img...411.412292.Nanometers.,
Warp..Band.15.ang20140919t183421_corr_v1c_img...416.420959.Nanometers.,
Warp..Band.16.ang20140919t183421_corr_v1c_img...421.429626.Nanometers.,
Warp..Band.17.ang20140919t183421_corr_v1c_img...426.438293.Nanometers.,
Warp..Band.18.ang20140919t183421_corr_v1c_img...431.446960.Nanometers.,
Warp..Band.19.ang20140919t183421_corr_v1c_img...436.455627.Nanometers.,
Warp..Band.20.ang20140919t183421_corr_v1c_img...441.464294.Nanometers.,
Warp..Band.21.ang20140919t183421_corr_v1c_img...446.... <truncated>

Thanks,
Megan

On Wed, May 24, 2017 at 6:58 PM, Michael Sumner <mdsumner at gmail.com> wrote:

> Do also see the raster vignettes, there is one on performance and using
> line- or block- based chunks for large jobs.
>
> Cheers, Mike
>
>
> On Thu, 25 May 2017, 08:32 Michael Sumner <mdsumner at gmail.com> wrote:
>
>> Try crop() (or more abstractly extract(raster, cells) once you've
>> determined which cells x-y are needed).
>>
>> Getting the most efficient way to do this depends on the source of the
>> brick. It's not possible to know without knowing details on your setup. The
>> file format, method of creation and dimensions of the brick and sizes of
>> your subset query can all affect the best ways to go.
>>
>> Happy to help but it might take a bit of conversation to figure out
>> what's best. If you can share the output of print on the brick anf the
>> extent of a subset that is a good start.
>>
>> Cheers, Mike
>>
>> On Thu, 25 May 2017, 05:50 Megan Maloney <maloneymc at appstate.edu> wrote:
>>
>>> Hello all,
>>>
>>> Does anyone know of a good R tool to subset/tile raster bricks?
>>>
>>> I'd like to break a raster brick into smaller pieces to process. I'm
>>> finding functions to subset or tile a single raster layer, but not for
>>> multi-layer raster bricks.
>>>
>>> The brick input is hyperspectral flightlines - very large, 1 m^2
>>> resampling
>>> covering a watershed, 340 layers. My code currently takes in a raster
>>> brick, extracts values per cell, applies beta coefficients, and outputs a
>>> nitrogen value to a raster.
>>>
>>> I don't need the subsets/tiles to be a particular size or number, just
>>> smaller. I was warned against dropping a whole flightline into R. I'm
>>> new to
>>> R, so I'm not sure what limitations I'm running into except processing
>>> time.
>>> All advice is welcome.
>>>
>>> Thank you very much for your help.
>>> Megan
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>> --
>> Dr. Michael Sumner
>> Software and Database Engineer
>> Australian Antarctic Division
>> 203 Channel Highway
>> Kingston Tasmania 7050 Australia
>>
>> --
> Dr. Michael Sumner
> Software and Database Engineer
> Australian Antarctic Division
> 203 Channel Highway
> Kingston Tasmania 7050 Australia
>
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list