Geographic Information Systems Asked on May 21, 2021
I am new to using .nc files and am struggling to get the output I need in GeoTIFF format to upload to GEE.
I have downloaded the 2015 zip file of fire data from the CCI archive here: http://data.ceda.ac.uk/neodc/esacci/fire/data/burned_area/AVHRR-LTDR/grid/v1.0/Compressed. And have written a loop to load in the .nc files and export them as GeoTIFFs so I can use them in GEE. However, when I look at them in GEE they do not have band names. Secondly, I am expecting 11 bands as there are 11 variables detailed here: https://catalogue.ceda.ac.uk/uuid/4f377defc2454db9b2a6d032abfd0cbd. However, there are 18 in GEE.
So I am wondering if I have been able to load all of the bands in properly? (I need to use all of them).
Finally, I am not sure that a time variable is included in the data. Each .nc file represents a month, and I need to combine them all into one GEE image collection which I can filter by date.
My basic code is shown below.
### convert .nc files to .tif
### load libraries ###
library(ncdf4)
library(raster)
library(rgdal)
setwd("filepathArchive Fire CCI grid2015")`
### list all files in the folder
ncfiles <- list.files()
ncfileTest <- brick(ncfiles[1])
ncfileTest
##loop over every file in the folder, exporting tif with simplified name
for(i in ncfiles){
ncfile <- brick(i)
## file name doesnt agree with GEE so needs to be cleaned
cleanname <- gsub("-","_", i)
cleanname2 <- gsub("_AVHRR_LTDR_fv1.0.nc","",cleanname)
writeRaster(ncfile, file.path("Output file pathESA CCI Fire Archive",cleanname2), format="GTiff",overwrite=TRUE)
}
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP