1 # Load required packages
6 ncfile <- nc_open("smoke.nc")
8 # Read the variables from the NetCDF file
9 pm25 <- ncvar_get(ncfile, "pm25")
10 lon <- ncvar_get(ncfile, "XLONG")
11 lat <- ncvar_get(ncfile, "XLAT")
13 # Close the NetCDF file
16 print("Create a data frame with the latitude, longitude, and pm25 values")
17 df <- data.frame(lat = as.vector(lat), lon = as.vector(lon), pm25 = as.vector(pm25))
19 print("Create a scatter plot of the pm25 values at the lat/lon points")
22 plot(df$lon, df$lat, col = df$pm25)