James Gibson
07/31/23

An R Script was used to convert the provided .nc files into geotiff format

The code snippet can be gound below:


library(raster)
library(rasterVis)
library(ncdf4)
library(lattice)
library(glue)

# Convert Single .nc file to Geotiff
inFile = '/Users/james/Documents/CIESIN/SEDAC/GlobalAnnualPM2.5Grids/Data/Annual_Global_0101/V5GL03.HybridPM25.Global.202101-202112.nc'
ncfile = ncdf4::nc_open(inFile)
names(ncfile$var) 
varname = 'GWRPM25'
nc2raster = stack(inFile,varname = varname)
output = '/Users/james/Documents/CIESIN/SEDAC/GlobalAnnualPM2.5Grids/Data/Geotiff/V5GL03.HybridPM25.Global.202101-202112.tif'
writeRaster(nc2raster,output,format = 'GTiff',overwrite = TRUE)


The original source of this code can be bound here:
https://sites.wustl.edu/acag/datasets/surface-pm2-5/

Lijian Han (ljhan@rcees.ac.cn) has prepared an example R-based code that converts the below netcdf files to raster for import into GIS-based programs that lack netcdf support. 
It can be accessed via this link: [NC to Geotif.txt]. Please contact Lijian if you have further questions.