Obțineți fișiere pentru tot anul 2024 disponibile în /data/MODIS/C61/MCD14ML.
Vom folosi binning pe o rețea globală discretă de 250 km.
# countries background
world <- ne_countries(scale = 10) |>
st_make_valid() |>
st_wrap_dateline()
# build the grid
dggs <- dgconstruct(spacing = 250)
hex <- dggs |>
dgshptogrid(world, cellsize = 0.5) |>
st_make_valid() |>
st_wrap_dateline() |>
st_filter(world) |>
select(seqnum)
# read all MODIS files and find their grid cell ID
modis <- dir("~/data/modis/", full.names = TRUE) |>
read_fwf(
skip = 1,
col_types = cols("YYYYMMDD" = col_date(format = "%Y%m%d")),
fwf_positions(
c(1, 10, 15, 17, 26, 36, 42, 48, 53, 61, 65, 68),
c(9, 14, 16, 25, 35, 41, 47, 52, 60, 64, 67, 69),
c("YYYYMMDD", "HHMM", "sat", "lat", "lon", "T21", "T31", "sample", "FRP",
"conf", "type", "dn")),
num_threads = 10) |>
mutate(seqnum = dgGEO_to_SEQNUM(dggs, lon, lat)$seqnum)
