12/29/2023 0 Comments Raster in r![]() > march = grep("^.03.$",names(Ldata))Īnd then extract those elements into a new list: > Lmarchapril = LdataĬheck the names are expected: > names(Lmarchapril) To get a subset of them, for example March and April, you can use base string matching to see what names have 03 or 04 in the right place. To get a sub-list, subset using single square brackets: > Ldata Give each element the day string name: > names(Ldata)=d Make a list that long with content 1 to N > Ldata = as.list(1:length(d)) Make the day strings in the right format: > d = format(seq(as.Date(""), Lets make a test list from the first day of 1991 to the last day of 2001. ![]() How do I create a new list and choose specific dates to put into it?Ī list of anything with names in R can be subsetted using square brackets. So now I have a raster list (raster_list) of all my files that are named by their date. # renaming the files so that only the date remains # looping over all the files and filling the list bin file (extract all file names, then isolate date)įiles <- list.files("data") # make a vector of all file namesĭates <- str_sub(files, 4, -12) # drop all text except for the date # making a vector of all dates for every. GeoTiffFile<- paste('geoTiffs/', ymd,'.tif',sep='') Rr <- setValues(r, x) # place result in raster Pixel 251] <- 0 # set all non-ice pixels to 0% ice cover bin files into R and creating the raster list itself: #making the raster bin files for sea ice concentration values from NSIDC. But, I have a raster list made up of 3872 elements (or separate rasters, I am guessing) and I am hoping to make a new smaller raster list by pulling out some of the rasters in the larger list based on their name. I am very new to R, so this is tough for me to explain.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |