[R-sig-Geo] Create raster based on overlapping

Jan Verbesselt janverbesselt at gmail.com
Wed Aug 8 23:32:16 CEST 2012


Hi Alemu,

The MODIS package provides

Functions to download, mosaic, re-sample, re-project, analyse and
visualise of MODIS grid data. Manual:
http://www.wuala.com/IVFL/R_MODIS/

Best,
Jan

On Wed, Aug 8, 2012 at 6:54 PM, Alemu Tadesse <alemu.tadesse at gmail.com> wrote:
>
> Dear All,
>
> I was trying to download MODIS Aerosol data and extract values for a given latitude and longitude.  I am not familiar with the  HDF file format. I am trying to familiarize myself with it and started playing with the codes on http://www.r-gis.net/?q=ModisDownload. I downloaded the example_1.r file and run it. I have downloaded RTM and run the code. While running I got the error  "Mosaic failed!". Is there anything I should do ? Or do you have an advice for me on how to read MODIS aerosol data and extract values for a given lat/lon. I also would like to extract other values like water column , albedo and etc from MODIS. I really appreciate your help on this.
>
> Best regards,
>
> Alemu
>
>
> On Wed, Aug 8, 2012 at 8:32 AM, Jan Verbesselt <janverbesselt at gmail.com> wrote:
>>
>> Hi Thiago,
>>
>> one way is to:
>> first
>>
>> rr2 <- resample(r2)  ## assuming the pixels with 1 are the ones you want to
>> select and with NA you do not want to select
>>
>> sr1 <- rr2 * r1 ## and then multiple both rasters
>>
>> There are other options too probably via the extract() function etc.
>>
>> Cheers,
>> Jan
>>
>>
>> On Wed, Aug 8, 2012 at 3:17 PM, Thiago Veloso <thi_veloso at yahoo.com.br>wrote:
>>
>> >  Dear all,
>> >
>> >  I have two rasters: r1 is a 0.5 degree netcdf file produced by a
>> > vegetation model. r2 is a 30m shapefile which I rasterized to a raster with
>> > the same 30m resolution. r2 values are all NA and 1.
>> >
>> >  Please see below:
>> >
>> > > r1
>> > class       : RasterLayer
>> > dimensions  : 10, 18, 180  (nrow, ncol, ncell)
>> > resolution  : 0.5, 0.5  (x, y)
>> > extent      : -53, -44, -25, -20  (xmin, xmax, ymin, ymax)
>> > coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
>> > values      : in memory
>> > layer name  : variable
>> > zvar        : variable
>> >
>> > > r2
>> > class       : RasterLayer
>> > dimensions  : 14469, 22190, 321067110  (nrow, ncol, ncell)
>> > resolution  : 0.0002702699, 0.0002702702  (x, y)
>> > extent      : -52.60649, -46.6092, -23.7172, -19.80666  (xmin, xmax, ymin,
>> > ymax)
>> > coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
>> > +towgs84=0,0,0
>> > values      : in memory
>> > layer name  : cs_2005spx1
>> > min value   : 1
>> > max value   : 1
>> >
>> >  Here you can see a join plot:
>> > http://img855.imageshack.us/img855/2820/plotzoom.png
>> >
>> >  Is it possible to create a new raster, which is composed only by r1 cells
>> > which are "touched" by r2 cells?
>> >
>> >
>> > _______________________________________________
>> > R-sig-Geo mailing list
>> > R-sig-Geo at r-project.org
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> >
>>
>>         [[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
>
>



More information about the R-sig-Geo mailing list