[R-sig-Geo] 答复: How to adjust two maps with different extent in R
Zhang Tianyi
zhang_t_y at hotmail.com
Tue Dec 20 08:15:43 CET 2016
Thank you!! This works!
________________________________
·¢¼þÈË: R-sig-Geo <r-sig-geo-bounces at r-project.org> ´ú±í Francisco Rodriguez Sanchez <f.rodriguez.sanc at gmail.com>
·¢ËÍʱ¼ä: 2016Äê12ÔÂ19ÈÕ 19:28
ÊÕ¼þÈË: r-sig-geo at r-project.org
Ö÷Ìâ: Re: [R-sig-Geo] How to adjust two maps with different extent in R
Hi Tianyi,
I think raster::rotate will do what you need
https://www.rdocumentation.org/packages/raster/versions/2.5-8/topics/rotate
rotate | RDocumentation<https://www.rdocumentation.org/packages/raster/versions/2.5-8/topics/rotate>
www.rdocumentation.org
Rotate a Raster* object that has x coordinates (longitude) from 0 to 360, to standard coordinates between -180 and 180 degrees. Longitude between 0 and 360 is frequently used in global climate models.
Cheers,
Paco
El 19/12/2016 a las 07:50, Zhang Tianyi escribi¨®:
> Two maps with different extents
>
> I am using R to process two maps (raster package). I have two maps with both WGS84 coordinates see figure. [image of map] <https://i.stack.imgur.com/bD84y.png>
>
> But one layer is from -180 to 180 in longitude (the map on surface) another one is from 0 to 360 (the map on the bottom).
>
> I need to adjust the bottom layer to -180 to 180 so that they can match. How can I do that?
>
> I think I need to find all grid greater than 180 and then minus 360. But I cannot find the longitude vector and cannot modify it from the Raster data.
>
> Description of the map is:
>
> class : RasterLayer
> dimensions : 94, 192, 18048 (nrow, ncol, ncell)
> resolution : 1.865234, 1.883872 (x, y)
> extent : 0, 358.125, -88.542, 88.542 (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
> data source : in memory
> names : TMAX_2015_01_01
> values : 220.9, 324.3 (min, max)
>
>
> Regadrs,
> Tianyi Zhang
>
> [[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 Francisco Rodriguez-Sanchez
Integrative Ecology Group
Estacion Biologica de Do?ana - CSIC
Avda. Americo Vespucio s/n
41092 Sevilla (Spain)
http://bit.ly/frod_san
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[https://i.stack.imgur.com/bD84y.png]
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list