Displaying 20 results from an estimated 22 matches for "nlayers".
Did you mean:
layers
2018 Mar 05
4
raster time series statistics
...equire(rts)
require(stringi)
r <- raster(ncol=100, nrow=100)
values(r) <- runif(ncell(r))
list(ID=seq(1:24),month=rep(str_pad(1:12, pad = 0,width = 2 , "left"),2),year=sort(rep(2016:2017,12)))->dt
stack(r)->s
r->rs
for(i in 1:23){
rs[]<-r[]*i
addLayer(s,rs)->s
print(nlayers(s))
}
timelst<-paste0(unlist(dt['year']),'-',unlist(dt['month']))
rts(s,time=as.yearmon(timelst))->rsts
str(rsts at time)
apply.monthly(rsts,mean)
I was expecting that the statistics accept the yearmonth format of the timeslot, as it allows subsetting.
Any suggestions...
2018 Mar 06
2
raster time series statistics
Last line in the following (updated) code produces the error
require(raster)
require(rts)
require(stringr)
r <- raster(ncol=100, nrow=100)
values(r) <- runif(ncell(r))
stack(r)->s
r->rs
for(i in 1:23){
rs[]<-r[]*i
addLayer(s,rs)->s
print(nlayers(s))
}
dt<-list(ID=seq(1:24),month=rep(formatC(1:12,flag=0,width=2),2),
year=sort(rep(2016:2017,12)))
timelst<-paste0(unlist(dt['year']),'-',unlist(dt['month']),"-01")
strptime(timelst,format="%Y-%m-%d")->t1
rts(s,time=as.yearmon(t1))->rsts...
2018 Mar 06
0
raster time series statistics
...ster(ncol=100, nrow=100)
> values(r) <- runif(ncell(r))
> list(ID=seq(1:24),month=rep(str_pad(1:12, pad = 0,width = 2 , "left"),2),year=sort(rep(2016:2017,12)))->dt
> stack(r)->s
> r->rs
> for(i in 1:23){
> rs[]<-r[]*i
> addLayer(s,rs)->s
> print(nlayers(s))
> }
> timelst<-paste0(unlist(dt['year']),'-',unlist(dt['month']))
> rts(s,time=as.yearmon(timelst))->rsts
> str(rsts at time)
> apply.monthly(rsts,mean)
>
> I was expecting that the statistics accept the yearmonth format of the timeslot, as it...
2018 Mar 06
0
raster time series statistics
...e following (updated) code produces the error
> require(raster)
> require(rts)
> require(stringr)
> r <- raster(ncol=100, nrow=100)
> values(r) <- runif(ncell(r))
> stack(r)->s
> r->rs
> for(i in 1:23){
> rs[]<-r[]*i
> addLayer(s,rs)->s
> print(nlayers(s))
> }
> dt<-list(ID=seq(1:24),month=rep(formatC(1:12,flag=0,width=2),2),
> year=sort(rep(2016:2017,12)))
> timelst<-paste0(unlist(dt['year']),'-',unlist(dt['month']),"-01")
> strptime(timelst,format="%Y-%m-%d")->t1
>
> rt...
2018 Mar 06
0
raster time series statistics
...ter(ncol=100, nrow=100)
> values(r) <- runif(ncell(r))
> list(ID=seq(1:24),month=rep(str_pad(1:12, pad = 0,width = 2 , "left"),2),year=sort(rep(2016:2017,12)))->dt
> stack(r)->s
> r->rs
> for(i in 1:23){
> rs[]<-r[]*i
> addLayer(s,rs)->s
> print(nlayers(s))
> }
> timelst<-paste0(unlist(dt['year']),'-',unlist(dt['month']))
> rts(s,time=as.yearmon(timelst))->rsts
> str(rsts at time)
> apply.monthly(rsts,mean)
>
> I was expecting that the statistics accept the yearmonth format of the timeslot, as it...
2018 Mar 06
1
raster time series statistics
It works if you use as.Date. But this defeates the purpose for the yearmon notion...
require(raster)
require(rts)
require(stringr)
r <- raster(ncol=100, nrow=100)
values(r) <- runif(ncell(r))
stack(r)->s
r->rs
for(i in 1:23){
rs[]<-r[]*i
addLayer(s,rs)->s
print(nlayers(s))
}
dt<-list(ID=seq(1:24),month=rep(formatC(1:12,flag=0,width=2),2), year=sort(rep(2016:2017,12)))
timelst<-paste0(unlist(dt['year']),'-',unlist(dt['month']),"-01")
strptime(timelst,format="%Y-%m-%d")->t1
rts(s,time=as.yearmon(t1))->rsts...
2012 Jun 06
0
randomForest Species Distribution Modelling
...onemtal raster layers and stacked them.
>files <-list.files(("C:/Users/GIS-Modeller/Documents/10m/ASCII"), pattern=
'asc', full.names=TRUE)
>predictors <-stack(files)
> predictors
class : RasterStack
dimensions : 1745, 3909, 6821205, 10 (nrow, ncol, ncell, nlayers)
resolution : 10, 10 (x, y)
extent : 417085.1, 456175.1, 5556329, 5573779 (xmin, xmax, ymin, ymax)
coord. ref. : NA
min values : NA -2.1e+09 -2.1e+09 -2.1e+09 -2.1e+09 -2.1e+09 -2.1e+09
NA NA NA
max values : NA 2.1e+09 2.1e+09 2.1e+09 2.1e+09 2.1e+09 2.1e+09...
2018 May 24
2
Problem with adding a raster and a brick
...+datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source :
/home/mpayne/Documents/Predictability_engine/scratch/Bluefin/HadISST/
obs_climatology.nc
names : sst
z-value : 1988-02-15
zvar : sst
> mdl.anom
class : RasterBrick
dimensions : 60, 200, 12000, 1 (nrow, ncol, ncell, nlayers)
resolution : 0.5, 0.5 (x, y)
extent : -70, 30, 50, 80 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source :
/home/mpayne/Documents/Predictability_engine/scratch/Bluefin/DCPP-hindcasts/IPSL-CM5A-LR/B.realmean/IPSL-CM5A-LR_S19610101_L0000...
2018 Jun 01
1
rasterize SpatialPolygon object using a RasterBrick object
...function explicitly says this is
allowed. Here's what I am doing
# load the raster package
library("raster")
# create a raster brick object using the example from the brick
function documentation
b <- brick(system.file("external/rlogo.grd", package="raster"))
b
nlayers(b)
names(b)
extract(b, 870)
# create a SpatialPolygon object using the example from the function
documentation
Sr1 = Polygon(10*cbind(c(2,4,4,1,2),10*c(2,3,5,4,2)))
Sr2 = Polygon(10*cbind(c(5,4,2,5),10*c(2,3,2,2)))
Sr3 = Polygon(10*cbind(c(4,4,5,10,4),c(5,3,2,5,5)))
Sr4 = Polygon(10*cbind(c(5,6,6,5...
2013 Mar 18
4
Why stacking rasters return NAs?
...ot use this formula, probably because it is not vectorized
I then checked the data but found that all values were returnd as NA and
this may explain why i am getting the error.
saf
class : RasterStack
dimensions : 720, 1440, 1036800, 601 (nrow, ncol, ncell, nlayers)
resolution : 0.25, 0.25 (x, y)
extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0
+no_defs
names : Vol_025_H//00_1_wgs84, Vol_025_H//00_1_wgs84,
Vol_025_H//00_1_wgs84, Vol_025_H//00_1_wgs84...
2024 Sep 24
2
Problem with converting grib file to excel
...<- raster_data[[grep("t2m", layer_names)]]
> d2m <- raster_data[[grep("d2m", layer_names)]]
> tcc <- raster_data[[grep("tcc", layer_names)]]
> valid_time <- raster_data[[grep("valid_time", layer_names)]]
> t2m
class : RasterStack
nlayers : 0
> # Check if the raster layers are loaded correctly
> if (is.null(t2m) || is.null(d2m) || is.null(tcc) || is.null(valid_time))
{
+ stop("One or more raster layers could not be loaded. Please check the
layer names.")
+ }
> # Convert raster values to vectors
> t2m_v...
2024 Sep 24
1
Problem with converting grib file to excel
...;t2m", layer_names)]]
> > d2m <- raster_data[[grep("d2m", layer_names)]]
> > tcc <- raster_data[[grep("tcc", layer_names)]]
> > valid_time <- raster_data[[grep("valid_time", layer_names)]]
> > t2m
> class : RasterStack
> nlayers : 0
>
> > # Check if the raster layers are loaded correctly
> > if (is.null(t2m) || is.null(d2m) || is.null(tcc) || is.null(valid_time))
> {
> + stop("One or more raster layers could not be loaded. Please check the
> layer names.")
> + }
>
> > #...
2024 Sep 25
1
Problem with converting grib file to excel
...; > > d2m <- raster_data[[grep("d2m", layer_names)]]
> > > tcc <- raster_data[[grep("tcc", layer_names)]]
> > > valid_time <- raster_data[[grep("valid_time", layer_names)]]
> > > t2m
> > class : RasterStack
> > nlayers : 0
> >
> > > # Check if the raster layers are loaded correctly
> > > if (is.null(t2m) || is.null(d2m) || is.null(tcc) ||
> is.null(valid_time))
> > {
> > + stop("One or more raster layers could not be loaded. Please check
> the
> > layer...
2013 Mar 19
1
How to get the rolling standard deviation in rasters?
...na.rm=TRUE))
### did not work
Error in .overlayList(x, fun = fun, filename = filename, ...) :
cannot use this formula, probably because it is not vectorized
> saf
class : RasterStack
dimensions : 720, 1440, 1036800, 12 (nrow, ncol, ncell, nlayers)
resolution : 0.25, 0.25 (x, y)
extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
+towgs84=0,0,0
names : SM_RE01_M//7_amenlast, SM_RE01_M//7_amenlast,
SM_RE01_M//7_amenlast, SM_RE01_M//7_ame...
2018 May 24
0
Problem with adding a raster and a brick
...ord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source :
/home/mpayne/Documents/Predictability_engine/scratch/Bluefin/HadISST/
obs_climatology.nc
names : sst
z-value : 1988-02-15
zvar : sst
> mdl.anom
class : RasterBrick
dimensions : 60, 200, 12000, 1 (nrow, ncol, ncell, nlayers)
resolution : 0.5, 0.5 (x, y)
extent : -70, 30, 50, 80 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source :
/home/mpayne/Documents/Predictability_engine/scratch/Bluefin/DCPP-hindcasts/IPSL-CM5A-LR/B.realmean/IPSL-CM5A-LR_S19610101_L000000_realm...
2024 Sep 25
1
Problem with converting grib file to excel
...d2m <- raster_data[[grep("d2m", layer_names)]]
>>>> tcc <- raster_data[[grep("tcc", layer_names)]]
>>>> valid_time <- raster_data[[grep("valid_time", layer_names)]]
>>>> t2m
>>> class : RasterStack
>>> nlayers : 0
>>>
>>>> # Check if the raster layers are loaded correctly
>>>> if (is.null(t2m) || is.null(d2m) || is.null(tcc) ||
>> is.null(valid_time))
>>> {
>>> + stop("One or more raster layers could not be loaded. Please check
>>...
2018 Jun 01
0
Problem with adding a raster and a brick
...84 +towgs84=0,0,0
> data source :
> /home/mpayne/Documents/Predictability_engine/scratch/Bluefin/HadISST/
> obs_climatology.nc
> names : sst
> z-value : 1988-02-15
> zvar : sst
>
> > mdl.anom
> class : RasterBrick
> dimensions : 60, 200, 12000, 1 (nrow, ncol, ncell, nlayers)
> resolution : 0.5, 0.5 (x, y)
> extent : -70, 30, 50, 80 (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
> data source :
>
> /home/mpayne/Documents/Predictability_engine/scratch/Bluefin/DCPP-hindcasts/IPSL-CM5A-LR/B.realmean/IPSL-C...
2024 Sep 26
1
Problem with converting grib file to excel
...ep("d2m", layer_names)]]
> >>>> tcc <- raster_data[[grep("tcc", layer_names)]]
> >>>> valid_time <- raster_data[[grep("valid_time", layer_names)]]
> >>>> t2m
> >>> class : RasterStack
> >>> nlayers : 0
> >>>
> >>>> # Check if the raster layers are loaded correctly
> >>>> if (is.null(t2m) || is.null(d2m) || is.null(tcc) ||
> >> is.null(valid_time))
> >>> {
> >>> + stop("One or more raster layers could not be...
2024 Sep 26
1
Problem with converting grib file to excel
...layer_names)]]
>> >>>> tcc <- raster_data[[grep("tcc", layer_names)]]
>> >>>> valid_time <- raster_data[[grep("valid_time", layer_names)]]
>> >>>> t2m
>> >>> class : RasterStack
>> >>> nlayers : 0
>> >>>
>> >>>> # Check if the raster layers are loaded correctly
>> >>>> if (is.null(t2m) || is.null(d2m) || is.null(tcc) ||
>> >> is.null(valid_time))
>> >>> {
>> >>> + stop("One or more r...
2024 Sep 26
1
Problem with converting grib file to excel
...layer_names)]]
>> >>>> tcc <- raster_data[[grep("tcc", layer_names)]]
>> >>>> valid_time <- raster_data[[grep("valid_time", layer_names)]]
>> >>>> t2m
>> >>> class : RasterStack
>> >>> nlayers : 0
>> >>>
>> >>>> # Check if the raster layers are loaded correctly
>> >>>> if (is.null(t2m) || is.null(d2m) || is.null(tcc) ||
>> >> is.null(valid_time))
>> >>> {
>> >>> + stop("One or more ra...