Working with many landsat files and separating into lists by date

29 Views Asked by At

So I have about 1000 landsat files of all the bands for different dates from 1980s to present. Overall I'm trying to create a time series of NDVI but at the moment I'm just trying to separate out the files by date and in a way which I can use them in calculations

I've used this code to separate the files by the date and it's worked

#splits files into groups by date
d <- sub(".*_([0-9]{8}_[0-9]{8}).*", "\\1", all_landsat_bands)
dates <- split(all_landsat_bands, d)
dates

I get an output looking like this:

output from file separation by date

What I'm struggling with is completing calculations using the bands within the separated groups.

I tried getting one band for example band 3

date <- dates["19901119_20211122"]
date[3]

but I just get $<NA> NULL

0

There are 0 best solutions below