[R-sig-Geo] Subset a Raster* object read from a 4D NetCDF file

Pascal Oettli kridox at ymail.com
Mon Apr 14 12:01:07 CEST 2014


Hello,

Thank you.

The same appears when the file is locally stored.

Regards,
Pascal

On Mon, Apr 14, 2014 at 6:51 PM, Dutrieux, Loic <loic.dutrieux at wur.nl> wrote:
> Dear Pascal,
>
> It appears that you can't do this type of operations if the file is only open through a remote connection.
> You may try:
>
> library(raster)
> out <- brick('http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/godas/pottmp.2013.nc',
> lvar=3, level=1, varname='pottmp')
> out2 <- readAll(out)
>
> # subset
> pottmp <- subset(out2, 1:3)
>
> Best regards,
> Loïc
> ________________________________________
> From: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org] on behalf of Pascal Oettli [kridox at ymail.com]
> Sent: Monday, April 14, 2014 10:25 AM
> To: r-sig-geo at r-project.org
> Subject: [R-sig-Geo] Subset a Raster* object read from a 4D NetCDF file
>
> Dear list members,
>
> Could someone help me to understand the following case (works on
> Linux. I don't know for other OS):
>
> library(raster)
> out <- brick('http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/godas/pottmp.2013.nc',
> lvar=3, level=1, varname='pottmp')
>
> # error while subsetting
> pottmp <- subset(out, 1:3)
>
> # multiply by 1
> out <- out * 1
>
> # no error
> pottmp <- subset(out, 1:3)
>
>
> Thank you,
> Pascal
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan



More information about the R-sig-Geo mailing list